Image rendering method, device, electronic device and storage medium
By determining the light acceleration structure and calculating the light source sampling weight in the target scene based on the physical properties of the light source and the path tracing algorithm, the problem of low rendering efficiency caused by inaccurate judgment of the importance of the light source is solved, and the noise convergence speed and rendering efficiency are improved. .
Patent Information
- Application Number
- CN202410844303.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-27
AI Technical Summary
In the prior art, inaccurate judgment of the importance of light sources results in reduced offline rendering efficiency and affected noise convergence speed.
By determining the light acceleration structure based on the physical properties of each light source in the target scene, using a path tracing algorithm to execute the light acceleration structure in each spatial area, obtaining the guidance weight distribution and real-time weight distribution of the light source, and calculating the light source sampling weight to render the image.
Accurately determine the light source sampling weight, improve the noise convergence speed during rendering, and improve rendering efficiency.
Smart Images

Figure CN118397166B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to an image rendering method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of offline rendering technology in the home furnishing industry, the market has higher and higher requirements for rendering efficiency, and various cache-based technologies are constantly being applied to offline rendering. However, in actual applications, the estimated importance of light sources may not match the actual importance of light sources. This inaccurate judgment of light source importance will seriously affect the convergence speed of actual rendering noise, thereby reducing the efficiency of offline rendering. Summary of the invention
[0003] The present disclosure provides an image rendering method, an apparatus, an electronic device, and a storage medium to solve or alleviate one or more technical problems in the prior art.
[0004] In a first aspect, the present disclosure provides an image rendering method, comprising:
[0005] Determine the lighting acceleration structure based on the physical properties of each light source in the target scene;
[0006] Based on the path tracing algorithm, the light acceleration structure is executed in each spatial area of the target scene to obtain the guidance weight distribution of each spatial area;
[0007] Obtaining the light of a target light source in a target scene, determining the real-time weight distribution of a light acceleration structure when the intersection position of the light of the target light source and the target scene is located in a first spatial region in the target scene, and obtaining the light source sampling weight of the target light source based on the guided weight distribution and the real-time weight distribution in the first spatial region;
[0008] Based on the light source sampling weights, a target image is rendered.
[0009] In a second aspect, the present disclosure provides an image rendering device, comprising:
[0010] A determination module, for determining a light acceleration structure based on the physical properties of each light source in the target scene;
[0011] A processing module, for executing a light acceleration structure in each spatial region of the target scene based on a path tracing algorithm to obtain a guide weight distribution of each spatial region;
[0012] A weight calculation module is used to obtain the light of the target light source in the target scene, determine the real-time weight distribution of the light acceleration structure when the intersection position of the light of the target light source and the target scene is located in the first spatial region in the target scene, and obtain the light source sampling weight of the target light source based on the guide weight distribution and the real-time weight distribution in the first spatial region;
[0013] The image rendering module is used to render the target image based on the light source sampling weight.
[0014] In a third aspect, an electronic device is provided, including:
[0015] at least one processor; and
[0016] A memory communicatively connected to the at least one processor; characterized in that,
[0017] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any method in the embodiments of the present disclosure.
[0018] In a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any method according to the embodiments of the present disclosure.
[0019] The beneficial effects of the technical solution provided by the present disclosure include at least: the light source in each spatial region of the target scene can be processed by the light acceleration structure respectively, and the guiding weight distribution of the light acceleration structure in each spatial region can be obtained, and the light source sampling weight of the target light source can be obtained through the real-time weight distribution of the light acceleration structure and the guiding weight distribution of the first spatial region. Thus, the light source sampling weight can be accurately determined, and the application of the light source sampling weight when rendering an image can improve the noise convergence speed during rendering, thereby improving the rendering efficiency.
[0020] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar components or blocks. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments provided according to the present disclosure and should not be regarded as limiting the scope of the present disclosure.
[0022] Figure 1 is a flowchart of an image rendering method according to an embodiment of the present disclosure;
[0023] Figure 2 is a structural schematic diagram of a light acceleration structure according to an embodiment of the present disclosure;
[0024] Figure 3 is a flow chart of the path guidance preprocessing disclosed herein;
[0025] Figure 4 is a flow chart of calculating the guidance weights by the disclosed path tracing algorithm;
[0026] Figure 5 is a flowchart of the present disclosure guiding weights to participate in calculation;
[0027] Figure 6 is a flow chart of the main process of path tracing disclosed in the present invention;
[0028] Figure 7 is a flow chart of the overall structure of the image rendering method disclosed herein;
[0029] Figure 8 is a schematic block diagram of an image rendering device provided by an embodiment of the present disclosure;
[0030] Fig. 9 It is a block diagram of an electronic device used to implement the image rendering method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] The present disclosure will be further described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0032] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present disclosure.
[0033] In order to facilitate understanding of the image rendering method provided by the embodiment of the present disclosure, the related technologies of the embodiment of the present disclosure are explained below. The following related technologies can be arbitrarily combined with the technical solutions of the embodiment of the present disclosure as optional solutions, and they all belong to the protection scope of the embodiment of the present disclosure.
[0034] In the process of rendering a scene, in order to improve rendering efficiency and quality, it is usually necessary to determine the impact of each light source in the scene on the scene, that is, the importance of the light source. When sampling a light source with a higher importance, the noise convergence speed during rendering will be improved. Therefore, how to accurately determine the importance of the light source in the scene is crucial.
[0035] With the rapid development of offline rendering technology in the home furnishing industry, the market has higher and higher requirements for rendering efficiency, and various cache-based technologies are constantly being applied to offline rendering. However, in actual applications, there will be situations where the assessed importance of the light source does not match the actual importance of the light source, such as when the light source is blocked or the material has a highlight attribute. This inaccurate judgment of the importance of the light source will cause the actual rendering noise convergence speed to be seriously affected, thereby reducing the efficiency of offline rendering.
[0036] In order to solve at least one of the above problems, in the technical solution of the embodiment of the present disclosure, the light source in each spatial region in the target scene can be processed by the light acceleration structure respectively to obtain the guiding weight distribution of the light acceleration structure in each spatial region, and the light source sampling weight of the target light source can be obtained through the real-time weight distribution of the light acceleration structure and the guiding weight distribution of the first spatial region. In this way, the light source sampling weight can be accurately determined, and the application of the light source sampling weight when rendering an image can improve the noise convergence speed during rendering, thereby improving the efficiency of rendering.
[0037] Figure 1 A schematic diagram of an image rendering method provided by an embodiment of the present disclosure is shown. The method can be applied to an image rendering device, which can be deployed in an electronic device. The electronic device is, for example, a single-machine or multi-machine terminal, server or other processing device. It is characterized in that the terminal can be a user equipment (UE) such as a mobile device, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the method can also be implemented by a processor calling computer-readable instructions stored in a memory. For example Figure 1 As shown, the method may include the following steps S110 to S130.
[0038] Step S110: Determine a light acceleration structure based on the physical properties of each light source in the target scene.
[0039] Exemplarily, the physical properties of the light source may include intensity information and / or position information of the light source.
[0040] The disclosed embodiments can be applied to the offline rendering process of various target scenes. Offline rendering is a process of pre-calculating and generating images on an electronic device. The user can upload relevant data of the target scene to the electronic device. The physical properties of each light source in the subsequent target scene will not change. After the physical properties of each light source in the target scene are loaded, the lighting acceleration structure can be predetermined.
[0041] Optionally, the target scene may be various real or virtual scenes, such as architectural scenes, natural scenes, game scenes, etc., or may be constructed by the user through modeling of electronic devices.
[0042] It can be understood that the physical properties of each light source may include the position, color, brightness, etc. of the light source, and these properties may be obtained by modeling the target scene, or by setting up detection devices such as cameras and sensors in the target scene.
[0043] In the embodiments of the present disclosure, the physical properties of each light source in the target scene are used to determine a lighting acceleration structure. The lighting acceleration structure can be understood as a data structure. The lighting acceleration structure may include multiple nodes and connection relationships between the nodes. Based on the lighting acceleration structure, the position and / or hierarchical distribution of each node in the lighting acceleration structure can be determined. A node may correspond to a light source, and the weight between a child node and its parent node is used to indicate the importance of the light source corresponding to the child node.
[0044] The light acceleration structure may be any data structure, for example, a bounding box, a KD tree (K-Dimension Tree, K-dimensional tree), etc., wherein the K-dimensional tree may include a binary tree.
[0045] In one example, if Figure 2 As shown in the figure, each leaf node represents a light source (for example, leaf nodes A, B, C, D, and E represent 5 light sources). The weight of any parent node to the left and right child nodes can refer to the two probabilities a and b from the parent node to the left and right child nodes, satisfying a+b=1. These two probabilities a and b are calculated in real time based on information such as the position of the shading point and the intensity of the light source. Through this binary tree that assigns weighted probabilities to the child nodes, the most suitable light source can be selected each time the light is sampled.
[0046] Step S120: Based on the path tracing algorithm, a light acceleration structure is executed in each spatial region of the target scene to obtain a guiding weight distribution of each spatial region.
[0047] In the embodiment of the present disclosure, the target scene can be divided into multiple spatial regions, each of which can include one or more light sources, and the spatial region where each light source is located can be determined based on the position information of each light source. Exemplarily, a spatial grid can be set, and the grid can be set denser at a position closer to the camera, and the grid can be set sparser at a position farther from the camera.
[0048] It can be understood that the light acceleration structure is associated with a weight distribution. Specifically, a node in the light acceleration structure corresponds to a light source, and the weight between a child node and its parent node can be understood as the probability of selecting the left and right subtrees for the parent node, that is, the probability of selecting the left and right subtrees each time the branch is selected in the process of searching from the root node to the leaf node of the binary tree, which is used to indicate the importance of the light source corresponding to each node. The weight distribution includes the weight information corresponding to each node. For the light source in each spatial area, the light acceleration structure can be executed. In the process of executing the light acceleration structure, the light acceleration structure executed by the light source in each spatial area is the same, and the weight distribution obtained by the execution can be different.
[0049] In the disclosed embodiment, the light acceleration structure weight distribution corresponding to each spatial region obtained by executing the path tracing algorithm in the screen space coordinate system can be recorded as the guided weight distribution. For example, for each spatial region, the path tracing algorithm can be executed in the screen space coordinate system, and the path tracing algorithm can be used to calculate the weight distribution based on the light acceleration structure to obtain the guided weight distribution of the light acceleration structure in each spatial region. The guided weight distribution can be used to adjust the light source sampling weight of the light acceleration structure in each spatial region, and the light source sampling weight is the weight distribution ultimately used to render the image.
[0050] Step S130, obtaining the light of the target light source in the target scene, and when the intersection position of the light of the target light source and the target scene is located in the first spatial area in the target scene, determining the real-time weight distribution of the light acceleration structure, and obtaining the light source sampling weight of the target light source based on the guided weight distribution and the real-time weight distribution in the first spatial area.
[0051] In the disclosed embodiment, after the guiding weights of each spatial area are distributed in advance, light rays can be emitted pixel by pixel from the screen space to intersect with the target scene, that is, the light rays of the target light source in the target scene are obtained, and the intersection position of the light rays of the target light source and the target scene is determined.
[0052] The intersection position of the light of the target light source and the target scene can be understood as the light of the target light source intersects with the object in the target scene, and the light can be reflected. The intersection position of the light of the target light source and the target scene can be obtained through the reflected light using devices such as cameras and sensors.
[0053] The intersection position of the light of the target light source and the target scene may be located in any one of the multiple spatial regions, and the spatial region where the intersection position is located, ie, the first spatial region, may be obtained.
[0054] In the above steps, the target light source may be any one of a plurality of light sources of the target scene, and the first spatial region may be any one of a plurality of spatial regions of the target scene.
[0055] In the disclosed embodiment, the real-time weight distribution in the light acceleration structure can be determined according to the spatial region (i.e., the first spatial region) where the intersection of the light of the target light source and the scene is located. Then, the guided weight distribution of the first spatial region obtained in step S120 is combined with the real-time weight distribution (e.g., calculating the arithmetic mean of the two), so as to obtain a more accurate weight distribution of the light acceleration structure, i.e., the light source sampling weight. This light source sampling weight can be applied during rendering, and the frequency of sampling to light sources with higher light source sampling weights can be increased, thereby improving the noise convergence speed during rendering.
[0056] In practical applications, the light of each light source in the target scene can be obtained, and the spatial area in the target scene where the intersection of the light of each light source and the scene is located is determined. Based on the spatial area where the intersection is located, the real-time weight distribution of each sub-node in the light acceleration structure is determined. Based on the guided weight distribution of the spatial area and the real-time weight distribution of each sub-node, the light source sampling weight of each light source is obtained.
[0057] S140: Render a target image based on the light source sampling weights.
[0058] Exemplarily, the pixel value of each pixel in the target image may be calculated based on the light source sampling weight, thereby rendering the target image.
[0059] In order to facilitate understanding of the above technical solution, Figure 3 A flowchart of an example application of path-guided preprocessing is provided. Figure 3 As shown, the following processing can be performed:
[0060] S31: dividing the spatial region, that is, dividing the target scene into multiple spatial regions;
[0061] S32: screen space calculation irradiance cache;
[0062] S33: Assign guidance weights to the light acceleration structures in each spatial region.
[0063] Specifically, Figure 4 A flow chart of the path tracing algorithm for calculating the guide weight is provided, such as Figure 4 As shown, the following processing can be performed:
[0064] S41: The path tracing algorithm samples a single sample; here, the path tracing algorithm refers to tracing the light rays of multiple light sources pixel by pixel. In this step, one of the ray tracing results is sampled;
[0065] S42: Select a light source;
[0066] S43: Calculate the pixel color value of the light source;
[0067] Cycle S41-S43 N times to calculate the pixel color value of the light source N times, where N is an integer greater than or equal to 1;
[0068] S44: storing the light source and the corresponding color value;
[0069] S45: Obtaining a weight value of each light source in a certain area (first spatial area) according to the sum of the color values stored in each light source.
[0070] For example, the accumulated color value of light source A is 1600, and the accumulated color value of light source B is 800. Then, in actual sampling, the probability of A being sampled is twice that of B.
[0071] In order to facilitate understanding of the above technical solution, Figure 5 A flowchart of an application example is provided to guide the weights involved in the calculation. Figure 5 As shown, the following processing can be performed:
[0072] S51: Find out which spatial region the intersection point belongs to;
[0073] S52: taking the guidance weight in the spatial region;
[0074] S53: combining the guided weight with the real-time calculated weight to obtain a new weight (i.e., the light source sampling weight);
[0075] S54: Use the new weight to participate in light source sampling calculation.
[0076] According to the technical solution of the embodiment of the present disclosure, the light source in each spatial area in the target scene can be processed separately using the light acceleration structure to obtain the guiding weight distribution of the light acceleration structure in each spatial area, and the light source sampling weight of the target light source can be obtained through the real-time weight distribution of the light acceleration structure and the guiding weight distribution of the first spatial area. In this way, the light source sampling weight can be accurately determined, and the light source sampling weight is applied when rendering the image, which can increase the frequency of sampling to light sources with higher light source sampling weights, improve the noise convergence speed during rendering, and thus improve the rendering efficiency. In addition, the data structures in the embodiments of the present disclosure are relatively simple, which is easy to implement in a GPU (Graphic Processing Unit) renderer.
[0077] In some embodiments, based on the light source sampling weights, rendering a target image includes:
[0078] Based on the light source sampling weight of the target light source, determining the light source sampling data of the target light source;
[0079] Determine the pixel value of the intersection position based on the light source sampling data of the target light source;
[0080] Based on the pixel value at the intersection position, the target image is rendered.
[0081] In the disclosed embodiment, the light acceleration structure includes a light source sampling weight of the target light source. The light acceleration structure can be used to process the target light source during the light source sampling and illumination calculation process, thereby solving for the light source illumination, that is, the brightness at the intersection of the light of the target light source and the scene, that is, the light source sampling data of the target light source.
[0082] The pixel value of the target light source is used to represent the color at the intersection of the light of the target light source and the scene. The pixel value at the intersection can be calculated by combining the light source sampling data of the target light source with the physical properties of the target light source. The pixel value at the intersection can be applied to the pixel at the corresponding position in the rendered image by the GPU renderer.
[0083] In practical applications, the light source sampling data of each light source can be determined based on the light source sampling weight of each light source, and then the pixel value of each intersection position can be determined. The pixel value of each intersection position can be applied to the pixel at the corresponding position in the image through the GPU renderer to obtain the completed rendered image, that is, the rendered image.
[0084] According to the technical solution of the embodiment of the present disclosure, based on the light source sampling weight of the target light source, the light source sampling data of the target light source can be accurately obtained, and then the pixel value of the intersection position can be determined. Based on the pixel value of each intersection position, the rendered image can be accurately obtained, and the noise convergence speed during rendering is further improved, thereby improving the rendering efficiency. In addition, the data structure is relatively simple, which is easy to implement in the GPU renderer.
[0085] In some embodiments, based on the light source sampling weights, rendering a target image includes:
[0086] The pixel value of the intersection position is determined based on the light source sampling data and the material sampling data of the target light source.
[0087] In the disclosed embodiment, the material sampling data can be understood as the surface material data at the intersection position of the light of the target light source and the target scene. The material sampling data can be obtained by sampling and calculating the surface material of the intersection. Specifically, the surface material sampling and calculation of the intersection may include: obtaining the material properties of the intersection position, which include diffuse reflection coefficient, specular reflection coefficient, refraction coefficient, map texture, etc. The material properties define the way the surface of the object reacts to light. Then, material sampling can be performed based on the material properties. For example, color information can be obtained from the texture map, and the sampling results can be adjusted according to other properties (such as roughness, glossiness, etc.).
[0088] The pixel value at the intersection position can be obtained more accurately through the light sampling data and material sampling data of the target light source. In practical applications, based on the light sampling data and material sampling data of each light source, the pixel value at each intersection position can be applied to the pixel at the corresponding position in the image through the GPU renderer to obtain the completed rendered image, that is, the target image.
[0089] In order to facilitate understanding of the above technical solution, Figure 6 A flow chart of the main process of path tracing is provided. Figure 6 As shown, the following processing can be performed:
[0090] S61: Screen space emits rays image by image;
[0091] S62: Calculating pixel values. Calculating pixel values may include sampling and calculating the intersection surface material and sampling and calculating the light source illumination. Material sampling data may be obtained by sampling and calculating the intersection surface material, and light source sampling data may be obtained by sampling and calculating the light source illumination.
[0092] S63: In the process of light source sampling and illumination calculation, inputting a guide weight;
[0093] S64: Output the result image (ie, the rendered image).
[0094] According to the technical solution of the embodiment of the present disclosure, based on the light source sampling data and material sampling data of the target light source, the pixel value of the target light source can be further accurately obtained, the noise convergence speed during rendering is improved, and thus the rendering efficiency is improved. In addition, the data structure is relatively simple, which is easy to implement in the GPU renderer.
[0095] In some embodiments, based on the path tracing algorithm, a light acceleration structure is executed in each spatial region to obtain a guide weight distribution for each spatial region, including:
[0096] Based on the path tracing algorithm, the acceleration structure is executed for the light sources of the preset number of frames in each spatial area to obtain the guidance weights of multiple frames;
[0097] Based on the guidance weights of multiple frames, the guidance weight distribution of each spatial region is obtained.
[0098] In the disclosed embodiment, the user can set a preset number of frames in the electronic device, such as 8 frames, 16 frames, etc., and execute the acceleration structure for the light source of the preset number of frames in each spatial area respectively to obtain the guidance weights of multiple frame numbers. The guidance weights of multiple frame numbers can be combined to obtain the guidance weight of each spatial area.
[0099] According to the technical solution of the embodiment of the present disclosure, by utilizing the guidance weights of multiple frames, the guidance weight distribution of each spatial area can be further accurately obtained, thereby improving the accuracy of the light source sampling weights, further increasing the frequency of sampling light sources with higher light source sampling weights, and improving the noise convergence speed during rendering.
[0100] In some embodiments, based on the physical properties of each light source in the target scene, determining a light acceleration structure includes:
[0101] Based on the intensity information and position information of each light source, determining the connection relationship of each light source in the binary tree structure;
[0102] Based on the connection relationship between each light source, the light acceleration structure is determined.
[0103] It can be understood that the physical properties of each light source may include intensity information and position information of each light source, and the intensity information and position information of each light source may be acquired by setting a detection device such as a camera and a sensor in the target scene.
[0104] The light acceleration structure may be a binary tree structure, which includes a left node and a right node, and the left node and the right node may include multiple child nodes. Each child node in the binary tree structure may represent a light source, and each child node may be located in a different level in the left node or the right node, or in the same level in the left node or the right node. In this embodiment, based on the intensity information and position information of each light source, it may be determined that the child node corresponding to each light source may be located in the left node or the right node of the binary tree structure, and in the level in the left node or the right node, that is, the connection relationship of each light source in the binary tree structure.
[0105] It can be understood that when constructing a binary tree structure, the light sources need to be partitioned. For example, the light source on the left side of the target scene can be divided into the left node.
[0106] In one example, if Figure 2 As shown, the three light sources A, B, and C are located in one room, and the two light sources D and E are located in another room. Therefore, the child nodes of A, B, and C can be divided into the left node, and the child nodes of D and E can be divided into the right node. In addition, the level at which the child nodes of A, B, and C are located in the left node can be determined based on the location information of the three light sources A, B, and C.
[0107] According to the technical solution of the embodiment of the present disclosure, the light acceleration structure can be accurately constructed through the intensity information and position information of each light source, laying a good foundation for the subsequent determination of the guiding weight distribution of the spatial area.
[0108] Figure 7A flowchart showing the overall structure of the image rendering method is shown in FIG. Figure 7 As shown, the specific process is as follows:
[0109] S71: scene data loading, that is, the user uploads relevant data of the target scene to the electronic device, and the electronic device loads the scene data;
[0110] S72: path guidance preprocessing, through which the guidance weight distribution of the light acceleration structure in each spatial area can be obtained;
[0111] S73: Path tracing main process, applying the guidance weight distribution of each spatial area to light source sampling and illumination calculation to achieve the effect of accelerating noise convergence;
[0112] S74: Output the result, that is, output the rendered target image.
[0113] According to an embodiment of the present disclosure, the present disclosure also provides an image rendering device, Figure 8 A schematic block diagram of an image rendering device provided by an embodiment of the present disclosure is shown. Figure 8 As shown, the image rendering device includes:
[0114] A determination module 810, for determining a light acceleration structure based on the physical properties of each light source in the target scene;
[0115] A processing module 820 is used to execute a light acceleration structure in each spatial region based on a path tracing algorithm to obtain a guide weight distribution in each spatial region;
[0116] The weight calculation module 830 is used to obtain the light of the target light source in the target scene, determine the real-time weight distribution of the light acceleration structure when the intersection position of the light of the target light source and the target scene is located in the first spatial region in the target scene, and obtain the light source sampling weight of the target light source based on the guide weight distribution and the real-time weight distribution in the first spatial region;
[0117] The image rendering module 840 is used to render a target image based on the light source sampling weight.
[0118] In some embodiments, the image rendering module 840 is further configured to:
[0119] Based on the light source sampling weight of the target light source, determining the light source sampling data of the target light source;
[0120] Determine the pixel value of the intersection position based on the light source sampling data of the target light source;
[0121] The target image is rendered based on the pixel value at the intersection position to render the target image.
[0122] In some embodiments, the image rendering module 840 is further configured to:
[0123] Based on the light sampling data and material sampling data of the target light source, the pixel value at the intersection position is determined.
[0124] In some embodiments, the processing module 820 is further configured to:
[0125] Based on the path tracing algorithm, the acceleration structure is executed for the light sources of the preset number of frames in each spatial area to obtain the guidance weights of multiple frames;
[0126] Based on the guidance weights of multiple frames, the guidance weight distribution of each spatial region is obtained.
[0127] In some embodiments, the determination module 810 is further configured to:
[0128] Based on the intensity information and position information of each light source, determining the connection relationship of each light source in the binary tree structure;
[0129] Based on the connection relationship between each light source, the light acceleration structure is determined.
[0130] Fig. 9 FIG. 1 is a structural block diagram of an electronic device according to an embodiment of the present disclosure. Fig. 9 As shown, the electronic device includes: a memory 910 and a processor 920, and the memory 910 stores a computer program that can be run on the processor 920. The number of memories 910 and processors 920 can be one or more. The memory 910 can store one or more computer programs. When the one or more computer programs are executed by the electronic device, the electronic device executes the method provided by the above method embodiment. The electronic device may also include: a communication interface 930, which is used to communicate with external devices and perform data exchange transmission.
[0131] If the memory 910, the processor 920 and the communication interface 930 are implemented independently, the memory 910, the processor 920 and the communication interface 930 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0132] Optionally, in a specific implementation, if the memory 910, the processor 920 and the communication interface 930 are integrated on a chip, the memory 910, the processor 920 and the communication interface 930 can communicate with each other through an internal interface.
[0133] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.
[0134] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. It is characterized in that the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of exemplary but not limiting description, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).
[0135] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present disclosure is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (for example: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (for example: infrared, Bluetooth, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc. It is worth noting that the computer-readable storage medium mentioned in the present disclosure may be a non-volatile storage medium, in other words, a non-transient storage medium.
[0136] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0137] In the description of the embodiments of the present disclosure, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0138] In the description of the embodiments of the present disclosure, unless otherwise specified, " / " means or, for example, A / B can mean A or B. "And / or" in this article is only a way to describe the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0139] In the description of the embodiments of the present disclosure, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "plurality" means two or more.
[0140] The above description is only an exemplary embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. An image rendering method, characterized in that: include: Determine the lighting acceleration structure based on the physical properties of each light source in the target scene; Based on a path tracing algorithm, executing the light acceleration structure in each spatial region of the target scene to obtain a guide weight distribution of each spatial region; Acquire the light of the target light source in the target scene, determine the real-time weight distribution of the light acceleration structure when the intersection position of the light of the target light source and the target scene is located in a first spatial region in the target scene, and obtain the light source sampling weight of the target light source based on the guided weight distribution in the first spatial region and the real-time weight distribution; Rendering a target image based on the light source sampling weights; The path tracing algorithm is based on which the light acceleration structure is executed in each spatial region of the target scene to obtain the guide weight distribution of each spatial region, including: For each spatial region, a path tracing algorithm is executed in the screen space coordinate system, and the path tracing algorithm is used to calculate the weight distribution based on the light acceleration structure to obtain the guiding weight distribution of the light acceleration structure in each spatial region; wherein, a node in the light acceleration structure corresponds to a light source, and the weight between a child node and its parent node is the probability of selecting a left or right subtree for the parent node, which is used to indicate the importance of the light source corresponding to each node, and the weight distribution includes the weight information corresponding to each node.
2. The method according to claim 1, characterized in that The rendering of a target image based on the light source sampling weight includes: Determining light source sampling data of the target light source based on the light source sampling weight of the target light source; Determining a pixel value at the intersection position based on light source sampling data of the target light source; A target image is rendered based on the pixel value at the intersection position.
3. The method according to claim 2, characterized in that The step of determining the pixel value of the intersection position based on the light source sampling data of the target light source includes: The pixel value of the intersection position is determined based on the light source sampling data and the material sampling data of the target light source.
4. The method according to any one of claims 1 to 3, characterized in that The path tracing algorithm is based on executing the light acceleration structure in each spatial region of the target scene to obtain the guide weight distribution of each spatial region, including: Based on the path tracing algorithm, the acceleration structure is executed on the light sources of the preset number of frames in each spatial region respectively to obtain the guidance weights of the plurality of frames; Based on the guidance weights of the multiple frames, a guidance weight distribution of each spatial region is obtained.
5. The method according to any one of claims 1 to 3, characterized in that: The step of determining the light acceleration structure based on the physical properties of each light source in the target scene includes: Based on the intensity information and position information of each light source, determining the connection relationship of each light source in the binary tree structure; Based on the connection relationship between each light source, the light acceleration structure is determined.
6. An image rendering device, characterized in that: include: A determination module, for determining a light acceleration structure based on the physical properties of each light source in the target scene; A processing module, configured to execute the light acceleration structure in each spatial region of the target scene based on a path tracing algorithm to obtain a guide weight distribution of each spatial region; a weight calculation module, configured to obtain the light of a target light source in the target scene, determine the real-time weight distribution of the light acceleration structure when the intersection position of the light of the target light source and the target scene is located in a first spatial region in the target scene, and obtain the light source sampling weight of the target light source based on the guide weight distribution in the first spatial region and the real-time weight distribution; An image rendering module, used for rendering a target image based on the light source sampling weight; Wherein, the processing module is also used for: For each spatial region, a path tracing algorithm is executed in the screen space coordinate system, and the path tracing algorithm is used to calculate the weight distribution based on the light acceleration structure to obtain the guiding weight distribution of the light acceleration structure in each spatial region; wherein, a node in the light acceleration structure corresponds to a light source, and the weight between a child node and its parent node is the probability of selecting a left or right subtree for the parent node, which is used to indicate the importance of the light source corresponding to each node, and the weight distribution includes the weight information corresponding to each node.
7. The device according to claim 6, characterized in that The rendering of a target image based on the light source sampling weight includes: Determining light source sampling data of the target light source based on the light source sampling weight of the target light source; Determining a pixel value at the intersection position based on light source sampling data of the target light source; A target image is rendered based on the pixel value at the intersection position.
8. The device according to claim 6 or 7, characterized in that The processing module is used for: Based on the path tracing algorithm, the acceleration structure is executed on the light sources of the preset number of frames in each spatial region respectively to obtain the guidance weights of the plurality of frames; Based on the guidance weights of the multiple frames, a guidance weight distribution of each spatial region is obtained.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5.
Citation Information
Patent Citations
Rendering method based on indirect reflection highlight calculation in screen space
CN105261059A
Method and device for rendering
CN109741437A
Scene rendering method and device, electronic equipment and storage medium
CN113674389A
Light source sampling weight determination method for multi-light source scene rendering and related equipment
CN114549730A
Image rendering method and device
CN117218273A
Cited By
Distributed rendering task scheduling method based on dynamic load balancing
CN123118876A
