WO2024002130A1 - Image rendering method and related device thereof - Google Patents

Image rendering method and related device thereof Download PDF

Info

Publication number
WO2024002130A1
WO2024002130A1 PCT/CN2023/103064 CN2023103064W WO2024002130A1 WO 2024002130 A1 WO2024002130 A1 WO 2024002130A1 CN 2023103064 W CN2023103064 W CN 2023103064W WO 2024002130 A1 WO2024002130 A1 WO 2024002130A1
Authority
WO
WIPO (PCT)
Prior art keywords
target object
light
image
light path
sample pool
Prior art date
Application number
PCT/CN2023/103064
Other languages
French (fr)
Chinese (zh)
Inventor
周鹏
龚哲
徐维超
林澈
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024002130A1 publication Critical patent/WO2024002130A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/06Ray-tracing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/506Illumination models

Definitions

  • the embodiments of the present application relate to the technical field of computer graphics, and in particular, to an image rendering method and related equipment.
  • a ray tracing algorithm based on path resampling.
  • the light path can be resampled based on the original light path, thereby collecting A new ray path formed by a new ray that intersects the object for the first time.
  • a corresponding sample pool can be obtained based on the new ray path, and the sample pool is used to indicate the new rays forming the new ray path.
  • An image of the object can then be rendered based on this pool of samples.
  • the effect of light on an object is diffuse reflection
  • the light re-emitted for the object will often have a large reflection range after the light hits the object. Even if the light continues to hit other objects, it has a higher probability of reaching the light source, so it can be easily resampled to a valid new light path. Then, the rendering effect displayed on the object will be better.
  • the effect of light on the object is specular reflection or specular reflection
  • the reflection range after the light hits the object is often small. After the reflected light continues to hit other objects, it will only There is a small chance of reaching the light source, so it is difficult to resample an effective new light path. As a result, a high-quality sample pool cannot be obtained, so the rendering effect displayed on the object is often poor.
  • Embodiments of the present application provide an image rendering method and related equipment, which can render the image of the target object regardless of whether the phenomenon caused by the light hitting the target object is diffuse reflection, specular reflection or specular reflection.
  • the rendering effect is high enough.
  • a first aspect of the embodiments of the present application provides an image rendering method, which method includes:
  • the light path between the light sources is reconstructed, that is, the light path between the two is resampled to obtain a new light path between the target object and the light source.
  • the new light path starts with the light source and ends with the target object.
  • Obtaining the new light path between the target object and the light source is equivalent to obtaining the light rays that form the new light path.
  • Information related to these rays can then be obtained and used to construct a sample pool. For example, the intensity value of these rays before hitting the target object can be obtained, and the intensity value of these rays before hitting the target object can be stored in the sample pool. In this way, the sample cell can be used to indicate these rays hitting the target object.
  • the sample pool After obtaining the sample pool, the sample pool can be used to render the target object, thereby obtaining an image of the target object. Then, the image of the target object is the displayed image, which can be displayed on the screen for the user to view and use.
  • the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path.
  • the original light path passes through the light path. It is traced that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object.
  • a pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed.
  • the target object can be rendered based on the sample pool to obtain the image of the target object.
  • the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Ground resampling of light paths can improve the success rate of sampling to effective new light paths, that is, it can easily resample to effective new light paths between the target object and the light source. In this way, no matter the light that forms the new light path Regardless of whether the phenomenon produced by the target object is direct illumination, diffuse reflection, specular reflection or specular reflection, a high-quality and sufficient sample pool can be successfully obtained to target the target object. The rendering effect of the target object is high enough.
  • the new light path includes a first light path and a second light path.
  • the first light path starts with the light source, ends with the target object, and passes through other objects.
  • the second light path starts with the light source.
  • the starting point is the target object as the end point, and does not pass through other objects;
  • the sample pool includes the first sample pool and the second sample pool.
  • the first sample pool is used to indicate the first light ray directed to the target object.
  • the first light path is A first ray is formed, a second sample cell is used to direct a second ray directed to the target object, and a second ray path is formed by the second ray.
  • the light path between the target object and the light source can be reconstructed in some way, that is, the light path between the two can be reconstructed.
  • the first light path starts from the light source and ends with the target object, and in the middle Passing through other objects (that is, the first light path has the light source and the target object as two endpoints, and passes through at least one intermediate node in the middle.
  • the light path between the two can also be reconstructed in another way based on the original light path of the two, that is, the light path between the two can be first resampled to obtain the relationship between the target object and the light source.
  • the second light path (can also be called the direct light path), the second light path starts with the light source and ends with the target object, and does not pass through other objects in the middle (that is, the second light path starts with the light source and the target object as two endpoints, and does not pass through any intermediate nodes, that is, it does not pass through other objects in the space where the target object is located, except the target object).
  • Obtaining the first ray path and the second ray path between the target object and the light source is equivalent to obtaining the first ray between the target object and the light source (which can also be called indirect rays. These rays start from the light source and hit After other objects, it shoots indirectly to the target object) and the second ray between the target object and the light source (also called direct rays, these rays start from the light source and shoot directly to the target object). Then, information related to the first ray can be obtained, and the information can be used to construct the first sample pool.
  • the light intensity value of the first ray after hitting other objects and before hitting the target object can be obtained, and the light intensity value of the first ray after hitting other objects and before hitting the target object can be stored in the first in this pool.
  • the first sample cell can be used to indicate the first light ray directed to the target object.
  • Information related to the second ray can also be obtained and used to construct a second sample pool.
  • the light intensity value of the second light ray before hitting the target object may be obtained, and the light intensity value of the second light ray before hitting the target object may be stored in the second sample pool.
  • the second sample cell can be used to indicate the second light ray directed to the target object.
  • the target object can be rendered based on the first sample pool and the second sample pool together, thereby obtaining an image of the target object.
  • the foregoing implementation provides a ray tracing technology based on multiple sample pools, where the multiple sample pools refer to at least one first sample pool and at least one second sample pool.
  • two first sample pools and one second sample pool can be constructed.
  • the rendering effects corresponding to the two first sample pools are specular reflection and specular reflection respectively.
  • the rendering effects corresponding to the second sample pool The effect is direct lighting.
  • the image of the target object rendered based on multiple sample pools can present not only direct lighting effects, but also indirect lighting effects such as specular reflection effects and highlight reflection effects. , the resulting image is more realistic and beautiful, which is conducive to improving user experience.
  • the phenomenon caused by the first light ray hitting the target object includes at least one of the following: diffuse reflection, specular reflection or specular reflection.
  • the first sample pool of the group of first rays corresponds to a certain rendering effect, and the rendering effect can be one of the following: diffuse reflection, specular reflection, or specular reflection.
  • the rendering effect corresponding to the first sample pool will appear as diffuse reflection, and so on.
  • the phenomenon produced by the first set of rays after hitting the target object is diffuse reflection
  • the rendering effect corresponding to the first sample pool will appear as diffuse reflection, and so on.
  • multiple sets of first light paths between the target object and the light source can be obtained, and multiple sets of first light paths forming these multiple sets of first light paths can be obtained.
  • the phenomenon produced by the group of first rays after hitting the target object can be controlled to be one of the following: diffuse reflection, specular reflection, or specular reflection. It should be noted that the phenomena produced by the multiple sets of first light rays after hitting the target object may be the same or different, and are not limited here.
  • the first sample pool corresponds to a certain rendering effect
  • the rendering effect can present Is one of the following: diffuse, specular, or specular.
  • the rendering effects corresponding to the multiple first sample pools may be the same or different.
  • a conventional sample pool configuration can be: construct two first sample pools, the rendering effect corresponding to the first first sample pool is presented as specular reflection, and the rendering effect corresponding to the second first sample pool is For high light reflection.
  • the multi-sample pool technology provided by the aforementioned implementation can not only make different first sample pools correspond to different rendering effects, but also make different first sample pools correspond to the same rendering effect. Depending on the material of the target object, Making choices increases the flexibility and comprehensiveness of the plan.
  • the number of first rays indicated by the first sample pool is less than the number of pixels displayed on the screen, and the second The number of second rays indicated by the sample pool is equal to the number of pixels displayed on the screen used to display the image of the target object.
  • the first sample pool may contain a set of light intensity values of the first light after hitting other objects and before hitting the target object. Then, the first sample pool The size of this cell is the number of these light intensity values, that is, the number of first rays in the group (that is, the size of the first sample cell is the number of first rays indicated by the first sample cell ).
  • the size of the first sample pool is smaller than the resolution of the screen (that is, the number of pixels displayed on the screen), and the screen is used to display the final image of the target object.
  • the second sample pool may contain a set of light intensity values before the second light hits the target object. Then, the size of the second sample pool is the number of these light intensity values, also It is the number of the second rays of the group (that is, the size of the second sample cell is the number of the second rays indicated by the second sample cell). It is worth noting that the size of the second sample pool is equal to the resolution of the screen (ie, the number of pixels displayed on the screen). It can be seen that the foregoing implementation method can make the size of the first sample pool smaller than the resolution of the screen, which can improve the efficiency of acquiring the first sample pool.
  • rendering the target object based on the first sample pool and the second sample pool to obtain an image of the target object includes: rendering the target object based on the first sample pool to obtain the target object The first illumination image of the object; rendering the target object based on the second sample pool to obtain the second illumination image of the target object; fusing the first illumination image and the second illumination image to obtain the image of the target object.
  • the at least one first sample pool can be colored respectively to obtain at least one indirect illumination image of the target object (ie, the aforementioned first illumination image).
  • the at least one second sample pool can be colored respectively to obtain at least one direct illumination image of the target object (ie, the aforementioned second illumination image).
  • the at least one indirect illumination image of the target object and at least one direct illumination image of the target object After obtaining at least one indirect illumination image of the target object and at least one direct illumination image of the target object, these multiple images can be regarded as multiple layers. Therefore, at least one indirect illumination image of the target object and at least one direct illumination image of the target object can be obtained.
  • the direct illumination images are superimposed to obtain the final image of the target object that can be displayed.
  • the method before fusing the first illumination image and the second illumination image to obtain the image of the target object, the method further includes: obtaining a noise-free component of the material information of the target object; based on the noise-free component Perform first processing on the first illumination image to obtain the processed first illumination image.
  • the first processing includes demodulation processing, noise reduction processing and modulation processing; perform second processing on the second illumination image based on the noise-free component to obtain Obtaining the processed second illumination image, the second processing includes demodulation processing, noise reduction processing and modulation processing; fusing the first illumination image and the second illumination image to obtain the image of the target object includes: The first illumination image and the processed second illumination image are fused to obtain an image of the target object.
  • At least one indirect illumination image of the target object can be divided by the noise-free component to obtain at least one demodulated indirect illumination image of the target object.
  • the at least one demodulated indirect illumination image of the target object can be denoised to obtain at least one denoised indirect illumination image of the target object.
  • the at least one denoised indirect illumination image of the target object can be multiplied by the noise-free component to obtain at least one modulated indirect illumination image of the target object.
  • the processed indirect illumination image is the aforementioned processed first illumination image.
  • at least one direct illumination image of the target object can be divided by the noise-free component to obtain at least one demodulated direct illumination image of the target object.
  • the at least one demodulated direct illumination image of the target object can be denoised to obtain at least one denoised direct illumination image of the target object.
  • the at least one direct illumination image after denoising of the target object can be multiplied by the noise-free component to obtain at least one modulated direct illumination image of the target object, that is, At least one processed direct illumination image of the target object (the processed direct illumination image is the aforementioned processed second illumination image).
  • the at least one processed indirect illumination image of the target object and at least one processed direct illumination image of the target object can be obtained The images are superimposed to obtain the final image of the target object that can be displayed.
  • the aforementioned implementation method provides a new image noise reduction method, which can realize demodulation, noise reduction and modulation of each layer based on the noise-free classification of the material information of the target object, so that each layer can be kept as smooth as possible.
  • the details of the target object make the image of the target object obtained based on the superposition of each layer more realistic and clearly visible, which is conducive to improving the user's viewing experience and further improving the user experience.
  • the first processing also includes super-resolution processing, and the super-resolution processing is used to make the resolution of the processed first illumination image equal to the resolution of the screen.
  • the resolution of the modulated at least one indirect illumination image of the target object is also smaller than the resolution of the screen.
  • the resolution of the at least one processed indirect lighting image of the target object is equal to the resolution of the screen . It can be seen that the aforementioned implementation method can be used with super-resolution processing in the process of rendering target objects based on multi-sample pool technology, which can reduce the amount of calculation required in the process to a certain extent and is conducive to accelerating ray tracing based on multi-sample pools. The implementation of technology further improves user experience.
  • a second aspect of the embodiment of the present application provides an image rendering device.
  • the device includes: a resampling module for resampling the light path between the target object and the light source based on the original light path between the target object and the light source. Sampling is performed to obtain a new light path.
  • the original light path is obtained through ray tracing.
  • the original light path starts with the target object and ends with the light source.
  • the new light path starts with the light source and ends with the target object.
  • the first acquisition module uses Based on the new light path, the sample pool is obtained.
  • the sample pool is used to indicate the light rays directed to the target object.
  • the new light path is formed by the light; the rendering module is used to render the target object based on the sample pool to obtain an image of the target object. .
  • the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path.
  • the original light path passes through the light path. It is traced that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object.
  • a pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed.
  • the target object can be rendered based on the sample pool to obtain the image of the target object.
  • the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Ground resampling of light paths can improve the success rate of sampling to effective new light paths, that is, it can easily resample to effective new light paths between the target object and the light source. In this way, no matter the light that forms the new light path Regardless of whether the phenomenon produced by the target object is direct illumination, diffuse reflection, specular reflection, or specular reflection, a high-quality and sufficient sample pool can be successfully obtained, so that the rendering effect of the target object is high enough.
  • the new light path includes a first light path and a second light path.
  • the first light path starts with the light source, ends with the target object, and passes through other objects.
  • the second light path starts with the light source.
  • the starting point is the target object as the end point, and does not pass through other objects;
  • the sample pool includes the first sample pool and the second sample pool.
  • the first sample pool is used to indicate the first light ray directed to the target object.
  • the first light path is A first ray is formed, a second sample cell is used to direct a second ray directed to the target object, and a second ray path is formed by the second ray.
  • the phenomenon caused by the first light ray hitting the target object is specular reflection or specular reflection.
  • the number of first rays indicated by the first sample pool is less than the number of pixels displayed on the screen, and the number of second rays indicated by the second sample pool is equal to the number of pixels displayed on the screen.
  • the screen is used to display the image of the target object.
  • the rendering module is configured to: render the target object based on the first sample pool to obtain the first illumination image of the target object; render the target object based on the second sample pool to obtain the The second illumination image of the target object; fuse the first illumination image and the second illumination image to obtain an image of the target object.
  • the rendering module is also used to: obtain the noise-free component of the material information of the target object; and perform the first processing on the first illumination image based on the noise-free component to obtain the processed first illumination image.
  • the first processing includes demodulation processing, noise reduction processing and modulation processing
  • the second processing is performed on the second illumination image based on the noise-free component to obtain the processed second illumination image
  • the second processing includes demodulation processing, noise reduction Processing and modulation processing
  • a rendering module used to fuse the processed first lighting image and the processed second lighting image to obtain an image of the target object.
  • the first processing also includes super-resolution processing, and the super-resolution processing is used to make the resolution of the processed first illumination image equal to the resolution of the screen.
  • a third aspect of the embodiment of the present application provides an electronic device.
  • the electronic device includes a memory and a processor; the memory stores code, and the processor is configured to execute the code. When the code is executed, the electronic device executes the first step. The method described in any possible implementation manner of the aspect or the first aspect.
  • a fourth aspect of the embodiments of the present application provides a circuit system.
  • the circuit system includes a processing circuit configured to perform the method described in the first aspect and any possible implementation manner of the first aspect.
  • a fifth aspect of the embodiments of the present application provides a chip system.
  • the chip system includes a processor for calling a computer program or computer instructions stored in a memory, so that the processor executes the steps described in the first aspect and the first aspect. any possible implementation method.
  • the processor is coupled to the memory through an interface.
  • the chip system further includes a memory, and computer programs or computer instructions are stored in the memory.
  • a sixth aspect of the embodiments of the present application provides a computer storage medium.
  • the computer storage medium stores one or more instructions. When executed by one or more computers, the instructions cause one or more computers to implement the first aspect or the third aspect. On the one hand, any possible implementation method is described.
  • the seventh aspect of the embodiments of the present application provides a computer program product.
  • the computer program product stores instructions. When the instructions are executed by a computer, the computer implements the implementation as described in the first aspect or any possible implementation manner of the first aspect. Methods.
  • the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path.
  • the original light path is traced through ray tracing. It is obtained that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object.
  • a pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed.
  • the target object can be rendered based on the sample pool to obtain the image of the target object.
  • the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Ground resampling of light paths can improve the success rate of sampling to effective new light paths, that is, it can easily resample to effective new light paths between the target object and the light source. In this way, no matter the light that forms the new light path Regardless of whether the phenomenon produced by the target object is direct illumination, diffuse reflection, specular reflection, or specular reflection, a high-quality and sufficient sample pool can be successfully obtained, so that the rendering effect of the target object is high enough.
  • Figure 1 is a schematic diagram of the principle of ray tracing technology
  • Figure 2 is a schematic diagram of the principle of rasterization technology
  • Figure 3 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • Figure 4 is a schematic flow chart of an image rendering method provided by an embodiment of the present application.
  • Figure 5 is a schematic diagram of the BVH tree provided by the embodiment of the present application.
  • Figure 6 is a schematic diagram of light path resampling provided by an embodiment of the present application.
  • Figure 7 is a schematic diagram of an application example of the image rendering method provided by the embodiment of the present application.
  • Figure 8 is a schematic diagram of the noise reduction process provided by the embodiment of the present application.
  • Figure 9 is a schematic diagram of the comparison results provided by the embodiment of the present application.
  • Figure 10 is another schematic diagram of the comparison results provided by the embodiment of the present application.
  • Figure 11 is another schematic diagram of the comparison results provided by the embodiment of the present application.
  • Figure 12 is another schematic diagram of the comparison results provided by the embodiment of the present application.
  • Figure 13 is another schematic diagram of the comparison results provided by the embodiment of the present application.
  • Figure 14 is another schematic diagram of the comparison results provided by the embodiment of the present application.
  • Figure 15 is a schematic structural diagram of an image rendering device provided by an embodiment of the present application.
  • Embodiments of the present application provide an image rendering method and related equipment, which can render the image of the target object regardless of whether the phenomenon caused by the light hitting the target object is diffuse reflection, specular reflection or specular reflection.
  • the rendering effect is high enough.
  • rasterization processing is usually used to render 3D scenes to obtain images that can display 3D scenes.
  • the quality of images obtained by rendering using rasterization technology is average, and it is often difficult to present realistic images. For example, it is often difficult to truly reproduce the effects of light reflection, refraction, and shadows in the scene in the rendered image.
  • Ray tracing technology and rasterization technology are both methods used to achieve image rendering. Their main purpose is to project objects in 3D space into a two-dimensional screen space for display by calculating shading.
  • Figure 1 is a schematic diagram of the principle of ray tracing technology.
  • the principle of ray tracing is: from the position of the camera, through the pixel position on the image plane, emit a beam of ray into the three-dimensional scene, find the nearest intersection point between the ray and the geometric figure, and then find the coloring of the intersection point . If the material of the intersection is reflective, you can continue tracing in the reflection direction of the intersection and continue to obtain the coloring of the reflected intersection.
  • the ray tracing method calculates projection and global illumination by tracing the propagation process of light in a three-dimensional scene, thereby rendering a two-dimensional image.
  • Figure 2 is a schematic diagram of the principle of rasterization technology. As shown in Figure 2, the principle of rasterization is: segment the objects in the three-dimensional scene using triangles, transform the three-dimensional coordinates of the triangle vertices into two-dimensional coordinates on the image through coordinate change calculation, and finally within the triangle on the image Fill texture to achieve image rendering.
  • rasterization technology directly projects the content visible on the screen space onto the screen space to obtain the corresponding image, its processing difficulty is relatively low and the light and shadow effects provided are also poor.
  • Ray tracing technology achieves real-life effects such as reflection, refraction, shadows, and ambient light occlusion by tracking each ray of light emitted from the camera. Therefore, the ray tracing method can provide realistic light and shadow effects. Therefore, in order to render more realistic images, current electronic devices usually give priority to ray tracing technology to render three-dimensional scenes to improve the user's viewing experience.
  • a ray tracing algorithm based on path resampling.
  • the light path can be resampled based on the original light path, thereby collecting A new ray path formed by a new ray that intersects the object for the first time.
  • a corresponding sample pool can be obtained based on the new light path, and the sample pool is used to indicate the new rays forming the new light path (that is, the sample pool can store light samples).
  • An image of the object can then be rendered based on this pool of samples.
  • the effect of light on an object is diffuse reflection
  • the light re-emitted for the object will often have a large reflection range after the light hits the object. Even if the light continues to hit other objects, it has a higher probability of reaching the light source, so it can be easily resampled to a valid new light path. Then, the rendering effect displayed on the object is better (that is, the rendered image of the object is often better quality). If the effect of light on the object is specular reflection or specular reflection, for the light re-emitted by the object, the reflection range after the light hits the object is often small.
  • the rendering effect displayed on the object is often poor (that is, the rendered image of the object often of poorer quality).
  • the electronic device includes a CPU and a GPU, which can render images.
  • the electronic device may be a mobile phone (mobile phone), a tablet computer, a notebook computer, a PC, a mobile internet device (mobile internet device, MID), a wearable device, a virtual reality (virtual reality, VR) device, an enhanced Augmented reality (AR) equipment, wireless electronic equipment in industrial control (industrial control), wireless electronic equipment in self-driving (self driving), wireless electronic equipment in remote medical surgery, smart grid ( Wireless electronic devices in smart grid, wireless electronic devices in transportation safety, wireless electronic devices in smart city, wireless electronic devices in smart home, etc.
  • the electronic device can be a device running Android system, IOS system, Windows system and other systems.
  • Applications that need to render 3D scenes to obtain two-dimensional images can be run in the electronic device, such as game applications, lock screen applications, map applications, or monitoring applications.
  • FIG. 3 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device 3000 may include: a central processing unit 3001; Graphics processor 3002, display device 3003 and memory 3004.
  • the electronic device 3000 may also include at least one communication bus (not shown in FIG. 3) for realizing connection communication between various components.
  • various components in the electronic device 3000 can also be coupled through other connectors, and other connectors can include various types of interfaces, transmission lines or buses, etc.
  • Each component in the electronic device 3000 may also be radially connected with the central processor 3001 as the center.
  • coupling refers to electrical connection or communication with each other, including direct connection or indirect connection through other devices.
  • the central processing unit 3001 and the graphics processor 3002 in the electronic device 3000 may be located on the same chip, or they may be separate chips.
  • the Central processing unit 3001 used to run operating system 3005 and application programs 3006.
  • the application 3006 may be a graphics application, such as a game, a video player, etc.
  • the operating system 3005 provides a system graphics library interface
  • the application program 3006 uses the system graphics library interface and the driver provided by the operating system 3005, such as the graphics library user mode driver and/or the graphics library kernel mode driver to generate graphics or graphics for rendering.
  • system graphics libraries include but are not limited to: open graphics library for embedded system (OpenGL ES), the khronos platform graphics interface (the khronos platform graphics interface) or Vulkan (a cross-platform graphics application Program interface) and other system graphics libraries.
  • the instruction stream contains a series of instructions, which are usually instructions for calling the system graphics library interface.
  • the central processor 3001 may include at least one of the following types of processors: an application processor, one or more microprocessors, a digital signal processor (DSP), a microcontroller unit, MCU) or artificial intelligence processor, etc.
  • processors an application processor, one or more microprocessors, a digital signal processor (DSP), a microcontroller unit, MCU) or artificial intelligence processor, etc.
  • DSP digital signal processor
  • MCU microcontroller unit
  • artificial intelligence processor etc.
  • the central processing unit 3001 may further include necessary hardware accelerators, such as application specific integrated circuits (ASICs), field programmable gate arrays (field programmable gate arrays, FPGAs), or integrated circuits used to implement logic operations.
  • ASICs application specific integrated circuits
  • FPGAs field programmable gate arrays
  • Processor 3001 may be coupled to one or more data buses for transmitting data and instructions between various components of electronic device 3000 .
  • Graphics processor 3002 used to receive the graphics instruction stream sent by the processor 3001, generate a rendering target through a rendering pipeline (pipeline), and display the rendering target to the display device 3003 through the layer synthesis display module of the operating system.
  • the rendering pipeline may also be called a rendering pipeline, a pixel pipeline or a pixel pipeline, and is a parallel processing unit inside the graphics processor 3002 for processing graphics signals.
  • the graphics processor 3002 may include multiple rendering pipelines, and the multiple rendering pipelines may process graphics signals in parallel independently of each other.
  • the rendering pipeline can perform a series of operations in the process of rendering graphics or image frames. Typical operations can include: vertex processing (vertex processing), primitive processing (primitive processing), rasterization (rasterization), fragment processing (fragment) processing) and so on.
  • the graphics processor 3002 may include a general-purpose graphics processor that executes software, such as a GPU or other types of dedicated graphics processing units.
  • Display device 3003 used to display various images generated by the electronic device 3000, which can be a graphical user interface (GUI) of the operating system or image data (including still images and videos) processed by the graphics processor 3002 data).
  • GUI graphical user interface
  • display device 3003 may include any suitable type of display screen.
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • the memory 3004 is a transmission channel between the central processor 3001 and the graphics processor 3002, and can be double data rate synchronous dynamic random access memory (DDR SDRAM) or other types of cache.
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • Figure 4 is a schematic flow chart of an image rendering method provided by an embodiment of the present application. As shown in Figure 4, the method includes:
  • the original light path is obtained through ray tracing.
  • the original light path starts from the target object and ends with the light source.
  • the rendering information of each object in the three-dimensional scene, the spatial information of the camera, the spatial information of the light source, etc. can be parsed from it. These information are briefly introduced below. :
  • the rendering information of each object includes the spatial information of the object and the material information of the object.
  • the spatial information of the object includes the vertex coordinates of the object, the vertex normal of the object, and the triangle index.
  • the material information of the object includes The color of the object, the gold of the object Attributes and roughness of objects and other information.
  • hierarchical bounding box (bounding volume hierarchies, BVH) trees can be constructed based on the spatial information of each object, and the BVH tree can be used to implement subsequent ray tracing operations.
  • a BVH tree can be constructed based on the object's vertex coordinates, vertex normals, and triangle indexes.
  • the BVH tree contains spatial information of multiple bounding boxes, and the spatial information of each bounding box contains the bounding box (cuboid).
  • the coordinates of the 8 vertices and the vertical height of the 8 vertices, each bounding box is used to surround at least one object.
  • Figure 5 is a schematic diagram of the BVH tree provided by the embodiment of the present application.
  • the bounding box A (surrounding these 6 objects) can be determined based on the spatial information of these 6 objects. )
  • the spatial information of bounding box B (surrounding these 4 objects) can be determined based on the spatial information of 4 of the objects
  • the spatial information of bounding box C (surrounding these 2 objects) can be determined based on the spatial information of the remaining 2 objects.
  • the spatial information of bounding box A, the spatial information of bounding box B, and the spatial information of bounding box C are managed in a binary tree structure to obtain a BVH tree.
  • the BVH tree can centrally manage the spatial information of bounding box A, bounding box B and bounding box C, which is equivalent to centralized management of bounding box A, bounding box B and bounding box C.
  • bounding box A is the largest bounding box among all bounding boxes.
  • calculations can also be performed based on the material information of each object to obtain the noise-free component of the material information of each object, and the noise-free component of the material information of each object is processed into a table that can be queried to achieve subsequent targeting.
  • the demodulation processing, noise reduction processing and modulation processing of the image of the object will not be discussed here.
  • the spatial information of the camera may include the vertical height of the camera, the coordinates of the camera, etc.
  • the camera is used to capture images that simulate a three-dimensional scene. It should be noted that when implementing ray tracing, the spatial position of the camera in the three-dimensional scene can be determined based on the spatial information of the camera. Then, the emission point of the light can be determined based on the spatial position of the camera, that is, the camera is used to emit rays to each object in the three-dimensional scene to implement route calculation and intersection calculation to determine the light path formed by these light rays in the three-dimensional scene. , thereby realizing subsequent rendering operations for each object in the three-dimensional scene.
  • the spatial information of the light source is usually used to determine the direct light source and indirect light source in the three-dimensional scene.
  • the direct light source refers to the light source that emits its own light in the three-dimensional scene.
  • the indirect light source refers to the light source that does not emit its own light in the three-dimensional scene and relies on other light sources to achieve emitting light. , for example, each of the aforementioned objects can be used as an indirect light source. It should be noted that when implementing ray tracing, if the light emitted by the camera intersects with at least one object in the three-dimensional scene, is reflected on the surface of the object, and is finally received by the direct light source, such light will form The ray path is a valid ray path.
  • the original light path between each object and the direct light source (hereinafter referred to as the light source) can be obtained based on this information.
  • the target object Since the operations performed on various objects in this embodiment are similar, for convenience of explanation, one of the objects is used as a schematic introduction below, and this object is called the target object. Then, according to the aforementioned introduction, based on the rendering information of each object in the three-dimensional scene, the spatial information of the camera, and the spatial information of the light source, the initial sampling of the light path between the target object and the direct light source can be completed, thereby obtaining the target object and the light source. The original light path between the target object and the light source starts with the target object and ends with the light source. It may or may not pass through other objects in the middle.
  • the original light path between the target object and the light source involved in this embodiment can also be understood as a set of original light paths between the target object and the light source, because the light emitted by the camera first intersects with the target object.
  • the set of original rays formed between the target object and the light source The light path is a set of original light paths between the target object and the light source.
  • the two endpoints of the target object and the light source can be determined, and the two endpoints can be determined.
  • the properties of the two are exchanged to reconstruct the light path between the two in some way, that is, the light path between the two is first resampled to obtain the first light between the target object and the light source.
  • Path can also be called indirect light path
  • the first light path starts from the light source, ends at the target object, and passes through other objects in the middle.
  • the first light path between the light path between the target object and the light source can be obtained in a variety of ways:
  • the set of original light paths includes multiple original light paths.
  • the light path corresponds one-to-one to a plurality of first light paths included in the group of first light paths.
  • the original light path starts from a certain surface point of the target object, passes through a certain surface point of other objects in the middle, and ends with a certain surface of the light source. point is the end point.
  • a certain surface point of the target object passed by the original light path is called a first surface point
  • a certain surface point of the other objects passed by the original light path is called a second surface point
  • a certain surface point of the light source that the original light path passes through is called a third surface point.
  • the original light path can be divided into two paths.
  • the first path is the light path between the first surface point and the second surface point
  • the second path is the light path between the second surface point and the third surface point. Light path.
  • a surface area can be drawn centered on the second surface point of the remaining object, and selected in the surface area (for example, it can be selected randomly or according to a certain preset Select according to the rules, no restrictions are made here)
  • a surface point is called the fourth surface point (the fourth surface point can be the same surface point as the second surface point, or it can be a certain point around the second surface point. surface point (not limited here), and connect the fourth surface point with the first surface point to form a first new path from the fourth surface point to the first surface point.
  • a surface area can be drawn centered on the third surface point of the light source, and a surface point is selected in the surface area, called the fifth surface point (the fifth surface point).
  • the fifth surface point can be the same surface point as the third surface point, or it can be a surface point around the third surface point, there is no restriction here), and connect the fifth surface point with the fourth surface point,
  • a second new path is formed from the fifth surface point to the fourth surface point.
  • the first new path and the second new path constitute the first light path corresponding to the original light path.
  • the first light path starts from the fifth surface point and passes through the fourth surface point in the middle. Surface points, with the first surface point as the end point.
  • a plurality of first light paths that is, a set of first light paths between the target object and the light source.
  • the camera 100 when performing ray tracing in a certain room, assume that the camera 100 emits a set of original light rays to the table 200, and select one of the original light rays.
  • Light is introduced schematically. Assume that after starting from the camera 100, the original light first hits the surface point A of the table 200, then hits the surface point B of the wall 300 after reflection, hits the surface point C of the lampshade 400 after reflection again, and hits the light source 500 after reflection again.
  • Surface point D so the original light path of the original light between the table 200 and the light source 500 includes three paths.
  • the first path 601 points from surface point A to surface point B, and the second path 602 points from surface point B.
  • Surface point C, the third path 603 is directed from surface point C to surface point D.
  • the light path between the two is reconstructed in another way based on the original light path between the two, that is, the light path between the two is reconstructed.
  • the second light path starts from the light source and ends with the target object, and does not pass through other objects in the middle. .
  • the second light path between the light path between the target object and the light source can be obtained in a variety of ways:
  • the second resampling is performed based on a set of original light paths between the target object and the light source, and a set of second light paths between the target object and the light source can be obtained accordingly.
  • the set of original light paths contains multiple original light paths.
  • the light path has a one-to-one correspondence with the plurality of second light paths included in the set of second light paths. Among the multiple original light paths, for any original light path, let the original light path take a certain surface point of the target object as the starting point and a certain surface point of the light source as the end point.
  • the certain surface point of the target object that the original light path passes through is called a first surface point
  • the certain surface point of the light source that the original light path passes through is called a second surface point.
  • a surface area can be drawn centered on the second surface point of the light source, and selected in the surface area (for example, it can be randomly selected, or it can be selected according to some predetermined The selection is based on the placement rules, and there are no restrictions here.)
  • a surface point is called the third surface point (the third surface point can be the same surface point as the second surface point, or it can be a certain point around the second surface point.
  • a plurality of second light paths that is, a set of second light paths between the target object and the light source.
  • the sample pool is used to indicate the light rays directed to the target object, and the new light path is formed by these light rays.
  • the first light path between the target object and the light source is equivalent to obtaining the first light (also called indirect light) between the target object and the light source.
  • the first light is the light that forms the first light path. It can be regarded as light that is emitted from the light source, hits other objects in the middle, hits the target object after reflection, and is received by the camera after reflection.
  • the information related to the first ray can be obtained, and the information can be used to construct the first sample pool.
  • the light intensity value (such as the brightness and color of the first light, etc.) of the first light after hitting other objects and before hitting the target object can be obtained, and the first light after hitting other objects and before hitting the target object can be obtained.
  • the light intensity value before hitting the target object is stored in the first sample pool. In this way, the first sample cell can be used to indicate the first light ray directed to the target object.
  • the first sample pool can be obtained in various ways:
  • the set of first light paths is formed by a set of first light rays. Since the group of first ray shapes includes a plurality of first rays, information related to the plurality of first rays can be used to construct a first sample pool (for example, the plurality of first rays are used to hit other first rays). The light intensity value after the object and before hitting the target object is stored in a first sample pool), so the first sample pool can be used to indicate the group of first rays that hit the target object.
  • the first new path 604, the second new path 605, and the third new path 606 constitute the first new path.
  • the light intensity value of the first light that forms the first light path after hitting the lampshade and the wall and before hitting the table can be obtained and stored in the first sample pool.
  • the group between the table and the light source In the first light path in addition to the first light path, the light intensity values of the other first light rays that form the other first light paths after hitting other objects and before hitting the table can be obtained and stored in the first light path. in this pool. In this way, a complete first sample cell is obtained, which is used to indicate a set of first rays hitting the table.
  • the phenomenon produced by the group of first rays after hitting the target object can be controlled to be one of the following: diffuse reflection, specular reflection or specular reflection.
  • the first sample pool corresponds to a certain kind of rendering. Effect, the rendering effect can appear as one of the following: diffuse reflection, specular reflection, or specular reflection. For example, if the phenomenon produced by the first set of rays after hitting the target object is diffuse reflection, the rendering effect corresponding to the first sample pool will appear as diffuse reflection, and so on.
  • first sample pools can finally be obtained, and one first sample pool is used to indicate the target object. of a set of first rays.
  • the phenomenon produced by the group of first rays after hitting the target object can be controlled to be one of the following: diffuse reflection, specular reflection, or specular reflection.
  • the phenomena produced by the multiple sets of first light rays after hitting the target object may be the same or different, and are not limited here.
  • the first sample pool corresponds to a certain rendering effect, and the rendering effect can be presented as one of the following: diffuse reflection, specular reflection Reflection or specular reflection.
  • the rendering effects corresponding to the multiple first sample pools may be the same or different, and are not limited here.
  • a conventional sample pool configuration can be: construct two first sample pools, the rendering effect corresponding to the first first sample pool is presented as specular reflection, and the rendering effect corresponding to the second first sample pool is For high light reflection.
  • the first sample pool may include a The light intensity values of the group of first rays after hitting other objects and before hitting the target object, then the size of the first sample pool (the resolution of the first sample image) is the number of these light intensity values, That is, the number of the first rays of the group (that is, the size of the first sample pool (the resolution of the first sample image) is the number of the first rays indicated by the first sample pool). It is worth noting that the size of the first sample pool is smaller than the resolution of the screen (that is, the number of pixels displayed on the screen), and the screen is used to display the final image of the target object.
  • obtaining the second light path between the target object and the light source is equivalent to obtaining the second light ray (also called direct light) between the target object and the light source.
  • the second light ray forms the second light ray path.
  • Light can be regarded as light emitted from the light source, without hitting other objects in the middle, but directly hitting the target object, and then reflected by the light received by the camera.
  • information related to the second ray can be obtained and used to construct the second sample pool.
  • the light intensity value of the second light ray before it hits the target object (such as the brightness and color of the second light ray, etc.) can be obtained, and the light intensity value of the second light ray before it hits the target object can be stored in the second in the sample pool.
  • the second sample cell can be used to indicate the second light ray directed to the target object.
  • the second sample pool can be obtained in various ways:
  • the set of second ray paths is formed by a set of second rays. Since the set of second ray shapes includes a plurality of second rays, information related to the plurality of second rays can be used to construct a second sample pool (for example, the plurality of second rays are used to hit the target object The previous light intensity value is stored in a second sample cell), so the second sample cell can be used to indicate the set of second light rays emitted to the target object.
  • the same operations as for the set of second rays can also be performed, so that multiple second sample pools can finally be obtained, and one second sample pool is used to indicate a beam emitted to the target object.
  • Set the second ray the same operations as for the set of second rays can also be performed, so that multiple second sample pools can finally be obtained, and one second sample pool is used to indicate a beam emitted to the target object.
  • the second sample pool may contain a set of second rays
  • the size of the second sample pool is the number of these light intensity values, that is, the number of the second ray group (that is, Say, second
  • the size of the sample pool is the number of second rays indicated by the second sample pool). It is worth noting that the size of the second sample pool is equal to the resolution of the screen (that is, the number of pixels displayed on the screen), and the screen is used to display the final image of the target object.
  • the first sample pool can be used to render the target object, thereby obtaining an image of the target object. Then, the image of the target object is the displayed image, which can be displayed on the screen for the user to view and use.
  • the image of the target object can be obtained in the following ways:
  • the at least one first sample pool can be obtained (for example, in the aforementioned case (1), only one first sample pool is obtained, and for example, in the aforementioned case (2), multiple first sample pools are obtained ), the at least one first sample pool can be colored (for example, lighting operation, etc.) respectively, and at least one indirect lighting image of the target object can be obtained (for example, corresponding to the aforementioned situation (1), an indirect lighting image of the target object can be obtained Illumination image, for another example, corresponding to the aforementioned situation (2), multiple indirect illumination images of the target object can be obtained).
  • the noise-free component of the material information of the target object can be obtained from the aforementioned table.
  • the first processing includes demodulation processing, noise reduction processing, and modulation processing. It should be noted that after obtaining the noise-free component of the material information of the target object, at least one indirect illumination image of the target object can be divided by the noise-free component to obtain at least one demodulated indirect illumination image of the target object. After obtaining at least one demodulated indirect illumination image of the target object, the at least one demodulated indirect illumination image of the target object can be denoised to obtain at least one denoised indirect illumination image of the target object. After obtaining at least one denoised indirect illumination image of the target object, the at least one denoised indirect illumination image of the target object can be multiplied by the noise-free component to obtain at least one modulated indirect illumination image of the target object.
  • the resolution of the modulated at least one indirect illumination image of the target object is also smaller than the resolution of the screen.
  • super-resolution processing can also be performed on at least one modulated indirect illumination image of the target object, thereby obtaining the processed image of the target object.
  • the resolution of the at least one indirect illumination image after processing of the target object is equal to the resolution of the screen.
  • the second processing includes demodulation processing, noise reduction processing, and modulation processing. It should be noted that after obtaining the noise-free component of the material information of the target object, at least one direct illumination image of the target object can be divided by the noise-free component to obtain at least one demodulated direct illumination image of the target object. After obtaining at least one demodulated direct illumination image of the target object, the at least one demodulated direct illumination image of the target object can be denoised to obtain at least one denoised direct illumination image of the target object.
  • the at least one direct illumination image after denoising of the target object can be multiplied by the noise-free component to obtain at least one modulated direct illumination image of the target object, that is, At least one processed direct illumination image of the target object.
  • the indirect illumination image is the aforementioned first illumination image
  • the direct illumination image is the aforementioned second illumination image
  • the processed indirect illumination image is the aforementioned processed first illumination image.
  • Image the processed direct illumination image is the aforementioned processed second illumination image.
  • Figure 7 is a schematic diagram of an application example of the image rendering method provided by the embodiment of the present application. As shown in Figure 7, this application example is mainly used to display a virtual auto show for users.
  • the application example includes:
  • the first type of sample pool contains 1 sample pool.
  • the corresponding rendering effect of this sample pool is direct lighting, and the size of the sample pool is consistent with the size (resolution) of the screen. For example, if the resolution of the screen is 1920*1080, the size of the sample pool is 1920*1080, and the screen is used to display images of the virtual auto show.
  • the second type of sample pool is constructed based on the indirect light path.
  • the second type of sample pool contains n sample pools.
  • the rendering effect corresponding to the first sample pool is specular reflection
  • the rendering effect corresponding to the second sample pool is specular reflection
  • the rendering effect corresponding to the third sample pool is specular reflection.
  • the rendering effect corresponding to the sample pools is diffuse reflection,..., and the rendering effect corresponding to the nth sample pool is specular reflection.
  • the size of each sample pool is 1/4 of the screen size. That is, the size of each sample pool is 480*270.
  • the image obtained in step (3) is noisy and requires noise reduction processing.
  • the noise reduction process mainly includes three steps, as shown in Figure 8 ( Figure 8 is a schematic diagram of the noise reduction process provided by the embodiment of the present application): a. Calculate the noise-free component of the material information of the objects in the auto show; b. Divide the image obtained in step (3) by the noise-free component; c. Then perform noise reduction on the divided result, and then multiply the noise-reduced result by the noise-free component to obtain the direct illumination after removing the noise. image.
  • step (4) The image obtained in step (4) is also noisy and can be processed according to the noise reduction process in step (5) to obtain the indirect illumination image after removing the noise.
  • the resolution of the direct illumination image after removing noise obtained in step (5) is consistent with the resolution of the screen.
  • the resolution of the indirect illumination image after removing noise obtained in step (6) is the resolution of the screen. 1/4, so the indirect illumination image after noise removal can be super-resolved.
  • the super-resolution indirect illumination image and the direct illumination image after noise removal can be superimposed to obtain the image of the virtual car show and displayed on the screen. .
  • the image rendering method provided by the embodiment of the present application can also be compared with the image rendering method provided by the related technology.
  • the comparison results are shown in Figures 9 to 14 (Figure 9 is a schematic diagram of the comparison results provided by the embodiment of the present application.
  • Figure 10 is another schematic diagram of the comparison results provided by the embodiment of the present application
  • Figure 11 is another schematic diagram of the comparison results provided by the embodiment of the present application
  • Figure 12 is another schematic diagram of the comparison results provided by the embodiment of the present application
  • Figure 13 is another schematic diagram of the comparison results provided by the embodiment of the present application
  • Figure 14 is another schematic diagram of the comparison results provided by the embodiment of the present application).
  • the test scene includes a vehicle, a ground and light sources in the environment.
  • the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path.
  • the original light path is traced through ray tracing. It is obtained that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object.
  • a pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed.
  • the target object can be rendered based on the sample pool to obtain the image of the target object.
  • the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Consistently resampling the light path can improve the success rate of sampling an effective new light path, that is, it can easily resample an effective new light path between the target object and the light source.
  • Consistently resampling the light path can improve the success rate of sampling an effective new light path, that is, it can easily resample an effective new light path between the target object and the light source.
  • the rendering effect of the target object is high enough. (That is, the rendered image of the target object is of sufficiently high quality).
  • embodiments of the present application provide a ray tracing technology based on multiple sample pools.
  • the multiple sample pools refer to at least one first sample pool and at least one second sample pool.
  • two first sample pools and one second sample pool can be constructed.
  • the rendering effects corresponding to the two first sample pools are specular reflection and specular reflection respectively.
  • the rendering effects corresponding to the second sample pool The effect is direct lighting.
  • the image of the target object rendered based on multiple sample pools can present not only direct lighting effects, but also indirect lighting effects such as specular reflection effects and highlight reflection effects. , the resulting image is more realistic and beautiful, which is conducive to improving user experience.
  • the size of the first sample pool is smaller than the resolution of the screen, so the efficiency of obtaining the first sample pool can be improved, and in the process of rendering the target object based on the multi-sample pool technology , can be used with super-resolution processing to reduce the amount of calculation required in the process to a certain extent, which is conducive to accelerating the implementation of ray tracing technology based on multi-sample pools and further improving user experience.
  • the embodiments of this application provide a new image noise reduction method, which can realize demodulation, noise reduction and modulation of each layer based on the noise-free classification of the material information of the target object, so that each layer can be
  • the layers try to maintain the details of the target object, so that the image of the target object obtained based on the superposition of each layer is more realistic and clearly visible, which is conducive to improving the user's viewing experience and further improving the user experience.
  • Figure 15 is a schematic structural diagram of an image rendering device provided by an embodiment of the present application. As shown in Figure 15, the device includes:
  • the resampling module 1501 is used to resample the light path between the target object and the light source based on the original light path between the target object and the light source to obtain a new light path.
  • the original light path is obtained through ray tracing.
  • the original light path Taking the target object as the starting point and the light source as the end point, the new light path takes the light source as the starting point and the target object as the end point;
  • the first acquisition module 1502 is used to acquire a sample pool based on the new light path.
  • the sample pool is used to indicate the light rays directed to the target object.
  • the new light path is formed by the light rays;
  • the rendering module 1503 is used to render the target object based on the sample pool to obtain an image of the target object.
  • the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path.
  • the original light path is traced through ray tracing. It is obtained that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object.
  • a pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed.
  • the target object can be rendered based on the sample pool to obtain the image of the target object.
  • the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Ground resampling of light paths can improve the success rate of sampling to effective new light paths, that is, it can easily resample to effective new light paths between the target object and the light source. In this way, no matter the light that forms the new light path Regardless of whether the phenomenon produced by the target object is direct illumination, diffuse reflection, specular reflection, or specular reflection, a high-quality and sufficient sample pool can be successfully obtained, so that the rendering effect of the target object is high enough.
  • the new light path includes a first light path and a second light path.
  • the first light path starts with the light source, ends with the target object, and passes through other objects.
  • the second light path starts with the light source.
  • the starting point is the target object as the end point, and does not pass through other objects;
  • the sample pool includes the first sample pool and the second sample pool.
  • the first sample pool is used to indicate the first light ray directed to the target object.
  • the first light path is A first ray is formed, a second sample cell is used to direct a second ray directed to the target object, and a second ray path is formed by the second ray.
  • the phenomenon caused by the first light ray hitting the target object is specular reflection or specular reflection.
  • the number of first rays indicated by the first sample pool is less than the number of pixels displayed on the screen, and the number of second rays indicated by the second sample pool is equal to the number of pixels displayed on the screen.
  • the screen is used to display the image of the target object.
  • the rendering module 1503 is configured to: render the target object based on the first sample pool to obtain the first lighting image of the target object; render the target object based on the second sample pool to obtain the first illumination image of the target object; Obtain a second illumination image of the target object; fuse the first illumination image and the second illumination image to obtain an image of the target object.
  • the rendering module 1503 is also used to: obtain the noise-free component of the material information of the target object; and perform the first processing on the first illumination image based on the noise-free component to obtain the processed first illumination.
  • the first processing includes demodulation processing, noise reduction processing processing and modulation processing; perform a second processing on the second illumination image based on the noise-free component to obtain a processed second illumination image.
  • the second processing includes demodulation processing, noise reduction processing and modulation processing; rendering module 1503, for The processed first illumination image and the processed second illumination image are fused to obtain an image of the target object.
  • the first processing also includes super-resolution processing, and the super-resolution processing is used to make the resolution of the processed first illumination image equal to the resolution of the screen.
  • Embodiments of the present application also relate to a circuit system, which circuit system includes a processing circuit configured to perform various steps in the embodiment shown in FIG. 4 .
  • Embodiments of the present application also relate to a chip system, which includes a processor for calling a computer program or computer instructions stored in a memory, so that the processor executes various steps in the embodiment shown in FIG. 4 .
  • the processor is coupled to the memory through an interface.
  • the chip system further includes a memory, and computer programs or computer instructions are stored in the memory.
  • Embodiments of the present application also relate to a computer storage medium.
  • the computer-readable storage medium stores a program for performing signal processing.
  • the program When the program is run on a computer, it causes the computer to execute each of the steps in the embodiment shown in Figure 4. step.
  • Embodiments of the present application also relate to a computer program product that stores instructions that, when executed by a computer, cause the computer to perform various steps in the embodiment shown in FIG. 4 .
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)

Abstract

Disclosed in the present application are an image rendering method and a related device thereof, capable of achieving a high rendering effect on a target object regardless of whether the phenomenon generated by forming light rays emitted onto the target object is diffuse reflection, mirror reflection, or highlight reflection. The method of the present application comprises: on the basis of an original light ray path between a target object and a light source, resampling a light ray path between the target object and the light source to obtain a new light ray path, wherein the original light ray path is obtained by means of light ray tracing, the original light ray path uses the target object as a start point and the light source as an end point, and the new light ray path uses the light source as a start point and the target object as an end point; obtaining a sample pool on the basis of the new light ray path, wherein the sample pool is used for indicating light rays emitted to the target object, and the new light ray path is formed by these light rays; and rendering the target object on the basis of the sample pool to obtain an image of the target object.

Description

一种图像渲染方法及其相关设备An image rendering method and related equipment
本申请要求于2022年6月29日提交中国专利局、申请号为202210752953.8、发明名称为“一种图像渲染方法及其相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on June 29, 2022, with the application number 202210752953.8 and the invention title "An image rendering method and related equipment", the entire content of which is incorporated herein by reference. Applying.
技术领域Technical field
本申请实施例涉及计算机图形学技术领域,尤其涉及一种图像渲染方法及其相关设备。The embodiments of the present application relate to the technical field of computer graphics, and in particular, to an image rendering method and related equipment.
背景技术Background technique
随着计算机行业的迅速发展,用户对图像的要求日益增高。当前,电子设备通常采用光线追踪技术对三维场景进行渲染,从而得到较为逼真的三维场景的图像,以提供给用户观看和使用,从而提高用户体验。With the rapid development of the computer industry, users' requirements for images are increasing day by day. Currently, electronic devices usually use ray tracing technology to render three-dimensional scenes to obtain more realistic images of three-dimensional scenes for users to view and use, thereby improving user experience.
目前,相关技术提出了一种基于路径重采样的光线追踪算法。在该算法中,对于三维场景中某个待渲染的物体而言,在确定首次相交于该物体的光线所形成的原始光线路径后,可基于该原始光线路径进行光线路径的重采样,从而采集到首次相交于该物体的新光线所形成的新光线路径。接着,可基于该新光线路径获取相应的样本池,该样本池用于指示形成该新光线路径的新光线。然后,可基于该样本池来渲染该物体的图像。Currently, related technologies propose a ray tracing algorithm based on path resampling. In this algorithm, for an object to be rendered in a three-dimensional scene, after determining the original light path formed by the light that intersects the object for the first time, the light path can be resampled based on the original light path, thereby collecting A new ray path formed by a new ray that intersects the object for the first time. Then, a corresponding sample pool can be obtained based on the new ray path, and the sample pool is used to indicate the new rays forming the new ray path. An image of the object can then be rendered based on this pool of samples.
在该算法中,受限于物体的材质,若光线在某个物体上的作用表现为漫反射时,针对该物体重新发射的光线,光线击中该物体后的反射范围往往很大,反射后的光线即使继续击中其余物体,也有较大几率到达光源,故可轻易重采样到有效的新光线路径,那么,在该物体所展现的渲染效果较优。若光线在该物体上的作用表现为镜面反射或高光反射时,针对该物体重新发射的光线,光线击中物体后的反射范围往往较小,反射后的光线在继续击中其余物体后,仅有较小几率达光源,故难以重采样到有效的新光线路径,导致获取不到优质的样本池,因而在该物体所展现的渲染效果往往较差。In this algorithm, limited by the material of the object, if the effect of light on an object is diffuse reflection, the light re-emitted for the object will often have a large reflection range after the light hits the object. Even if the light continues to hit other objects, it has a higher probability of reaching the light source, so it can be easily resampled to a valid new light path. Then, the rendering effect displayed on the object will be better. If the effect of light on the object is specular reflection or specular reflection, for the light re-emitted by the object, the reflection range after the light hits the object is often small. After the reflected light continues to hit other objects, it will only There is a small chance of reaching the light source, so it is difficult to resample an effective new light path. As a result, a high-quality sample pool cannot be obtained, so the rendering effect displayed on the object is often poor.
发明内容Contents of the invention
本申请实施例提供了一种图像渲染方法及其相关设备,无论形成光线射在目标物体上所产生的现象为漫反射、镜面反射和高光反射中的哪一种,均可令针对目标物体的渲染效果足够优质。Embodiments of the present application provide an image rendering method and related equipment, which can render the image of the target object regardless of whether the phenomenon caused by the light hitting the target object is diffuse reflection, specular reflection or specular reflection. The rendering effect is high enough.
本申请实施例的第一方面提供了一种图像渲染方法,该方法包括:A first aspect of the embodiments of the present application provides an image rendering method, which method includes:
当需要对三维场景中的目标物体进行渲染时,可先获取目标物体与光源之间的原始光线路径。由于目标物体与光源之间的原始光线路径以目标物体为起点,以光源为终点,故可确定目标物体和光源这两个端点,并将目标物体和光源的性质进行调换,以对目标物体和光源之间的光线路径进行重新构建,即对二者之间的光线路径进行重采样,从而得到目标物体与光源之间的新光线路径,新光线路径以光源为起点,以目标物体为终点。When you need to render a target object in a three-dimensional scene, you can first obtain the original light path between the target object and the light source. Since the original light path between the target object and the light source has the target object as the starting point and the light source as the end point, the two endpoints of the target object and the light source can be determined, and the properties of the target object and the light source can be exchanged to match the target object and the light source. The light path between the light sources is reconstructed, that is, the light path between the two is resampled to obtain a new light path between the target object and the light source. The new light path starts with the light source and ends with the target object.
得到目标物体与光源之间的新光线路径,也就相当于得到了形成新光线路径的光线。那么,可获取与这些光线相关的信息,从而利用这些信息来构建样本池。例如,可获取这些光线在击中目标物体之前的光强值,并将这些光线在击中目标物体之前的光强值存储在样本池中。如此一来,样本池可用于指示射向目标物体的这些光线。Obtaining the new light path between the target object and the light source is equivalent to obtaining the light rays that form the new light path. Information related to these rays can then be obtained and used to construct a sample pool. For example, the intensity value of these rays before hitting the target object can be obtained, and the intensity value of these rays before hitting the target object can be stored in the sample pool. In this way, the sample cell can be used to indicate these rays hitting the target object.
得到样本池后,可利用样本池,对目标物体进行渲染,从而得到目标物体的图像。那么,目标物体的图像即为送显的图像,可在屏幕上进行显示,以供用户观看和使用。After obtaining the sample pool, the sample pool can be used to render the target object, thereby obtaining an image of the target object. Then, the image of the target object is the displayed image, which can be displayed on the screen for the user to view and use.
从上述方法可以看出:在获取目标物体与光源之间的原始光线路径后,可基于原始光线路径对目标物体与光源之间的光线路径进行重采样,得到新光线路径,原始光线路径通过光线追踪得到,原始光线路径以目标物体为起点,以光源为终点,新光线路径以光源为起点,以目标物体为终点。然后,可基于新光线路径获取样本池,样本池用于指示射向目标物体的光线,新光线路径由这些光线形成。最后,可基于样本池对目标物体进行渲染,得到目标物体的图像。基于前述过程可知,本申请实施例提供了一种新的光线路径重采样方式,该方式逆着光线追踪中有效的光线路径的指向(以光源为起点,以目标物体为终点),有针对性地去重采样光线路径,可提高采样到有效的新光线路径的成功率,即能够轻易地重采样到目标物体与光源之间有效的新光线路径,如此一来,无论形成新光线路径的光线射在目标物体上所产生的现象为直接光照、漫反射、镜面反射和高光反射中的哪一种,均可成功获取到优质且足够的样本池,从而令针对目 标物体的渲染效果足够优质。It can be seen from the above method: after obtaining the original light path between the target object and the light source, the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path. The original light path passes through the light path. It is traced that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object. A pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed. Finally, the target object can be rendered based on the sample pool to obtain the image of the target object. Based on the foregoing process, it can be seen that the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Ground resampling of light paths can improve the success rate of sampling to effective new light paths, that is, it can easily resample to effective new light paths between the target object and the light source. In this way, no matter the light that forms the new light path Regardless of whether the phenomenon produced by the target object is direct illumination, diffuse reflection, specular reflection or specular reflection, a high-quality and sufficient sample pool can be successfully obtained to target the target object. The rendering effect of the target object is high enough.
在一种可能的实现方式中,新光线路径包括第一光线路径以及第二光线路径,第一光线路径以光源为起点,以目标物体为终点,且经过其余物体,第二光线路径以光源为起点,以目标物体为终点,且未经过其余物体;样本池包含第一样本池和第二样本池,第一样本池用于指示射向目标物体的第一光线,第一光线路径由第一光线形成,第二样本池用于指示射向目标物体的第二光线,第二光线路径由第二光线形成。前述实现方式中,得到目标物体与光源之间的原始光线路径后,基于二者的原始光线路径,可对目标物体和光源之间的光线路径进行某种方式的重新构建,即对二者之间的光线路径进行第一重采样,从而得到目标物体与光源之间的第一光线路径(也可以称为间接光线路径),第一光线路径以光源为起点,以目标物体为终点,且中间经过其余物体(即第一光线路径以光源和目标物体为两个端点,且中间经过了至少一个中间节点,这些中间节点即为目标物体所在的空间中,除目标物体之外的其余物体),还可基于二者的原始光线路径,对二者之间的光线路径进行另外一种方式的重新构建,即对二者之间的光线路径进行第一重采样,从而得到目标物体与光源之间的第二光线路径(也可以称为直接光线路径),第二光线路径以光源为起点,以目标物体为终点,且中间不经过其余物体(即第二光线路径以光源和目标物体为两个端点,且中间未经过了任意中间节点,即未经过目标物体所在的空间中,除目标物体之外的其余物体)。得到目标物体与光源之间的第一光线路径以及第二光线路径,也就相当于得到了目标物体与光源之间的第一光线(也可以称为间接光线,这些光线从光源出发,击中其余物体后,间接射向目标物体)以及目标物体与光源之间的第二光线(也可以称为直接光线,这些光线从光源出发,直接射向目标物体)。那么,可获取与第一光线相关的信息,从而利用这些信息来构建第一样本池。例如,可获取第一光线在击中其余物体之后且击中目标物体之前的光强值,并将第一光线在击中其余物体之后且击中目标物体之前的光强值存储在第一样本池中。如此一来,第一样本池可用于指示射向目标物体的第一光线。还可获取与第二光线相关的信息,从而利用这些信息来构建第二样本池。例如,可获取第二光线在击中目标物体之前的光强值,并将第二光线在击中目标物体之前的光强值存储在第二样本池中。如此一来,第二样本池可用于指示射向目标物体的第二光线。基于此,可基于第一样本池和第二样本池共同对目标物体进行渲染,从而得到目标物体的图像。可见,前述实现方式提供了一种基于多样本池的光线追踪技术,多样本池指至少一个第一样本池和至少一个第二样本池。在一种常见的配置中,可构建两个第一样本池以及一个第二样本池,两个第一样本池对应的渲染效果分别为镜面反射和高光反射,第二样本池对应的渲染效果为直接光照,那么,即使目标物体为特殊材质的物体,基于多个样本池渲染得到的目标物体的图像,既可以呈现直接光照效果,也可以呈现镜面反射效果和高光反射效果等间接光照效果,所得到图像更加真实和精美,有利于提高用户体验。In a possible implementation, the new light path includes a first light path and a second light path. The first light path starts with the light source, ends with the target object, and passes through other objects. The second light path starts with the light source. The starting point is the target object as the end point, and does not pass through other objects; the sample pool includes the first sample pool and the second sample pool. The first sample pool is used to indicate the first light ray directed to the target object. The first light path is A first ray is formed, a second sample cell is used to direct a second ray directed to the target object, and a second ray path is formed by the second ray. In the aforementioned implementation method, after obtaining the original light path between the target object and the light source, based on the original light paths of the two, the light path between the target object and the light source can be reconstructed in some way, that is, the light path between the two can be reconstructed. Perform the first resampling of the light path between the target object and the light source to obtain the first light path between the target object and the light source (which can also be called the indirect light path). The first light path starts from the light source and ends with the target object, and in the middle Passing through other objects (that is, the first light path has the light source and the target object as two endpoints, and passes through at least one intermediate node in the middle. These intermediate nodes are the remaining objects in the space where the target object is located, except the target object), The light path between the two can also be reconstructed in another way based on the original light path of the two, that is, the light path between the two can be first resampled to obtain the relationship between the target object and the light source. The second light path (can also be called the direct light path), the second light path starts with the light source and ends with the target object, and does not pass through other objects in the middle (that is, the second light path starts with the light source and the target object as two endpoints, and does not pass through any intermediate nodes, that is, it does not pass through other objects in the space where the target object is located, except the target object). Obtaining the first ray path and the second ray path between the target object and the light source is equivalent to obtaining the first ray between the target object and the light source (which can also be called indirect rays. These rays start from the light source and hit After other objects, it shoots indirectly to the target object) and the second ray between the target object and the light source (also called direct rays, these rays start from the light source and shoot directly to the target object). Then, information related to the first ray can be obtained, and the information can be used to construct the first sample pool. For example, the light intensity value of the first ray after hitting other objects and before hitting the target object can be obtained, and the light intensity value of the first ray after hitting other objects and before hitting the target object can be stored in the first in this pool. In this way, the first sample cell can be used to indicate the first light ray directed to the target object. Information related to the second ray can also be obtained and used to construct a second sample pool. For example, the light intensity value of the second light ray before hitting the target object may be obtained, and the light intensity value of the second light ray before hitting the target object may be stored in the second sample pool. In this way, the second sample cell can be used to indicate the second light ray directed to the target object. Based on this, the target object can be rendered based on the first sample pool and the second sample pool together, thereby obtaining an image of the target object. It can be seen that the foregoing implementation provides a ray tracing technology based on multiple sample pools, where the multiple sample pools refer to at least one first sample pool and at least one second sample pool. In a common configuration, two first sample pools and one second sample pool can be constructed. The rendering effects corresponding to the two first sample pools are specular reflection and specular reflection respectively. The rendering effects corresponding to the second sample pool The effect is direct lighting. Then, even if the target object is an object of special material, the image of the target object rendered based on multiple sample pools can present not only direct lighting effects, but also indirect lighting effects such as specular reflection effects and highlight reflection effects. , the resulting image is more realistic and beautiful, which is conducive to improving user experience.
在一种可能的实现方式中,第一光线射在目标物体上所产生的现象包含以下至少一种:漫反射、镜面反射或者高光反射。前述实现方式中,可能存在两种情况:(1)若仅进行了单轮次的第一重采样,可得到目标物体与光源之间的一组第一光线路径,也就得到了形成该组第一光线路径的一组第一光线,故可控制该组第一光线在击中目标物体后所产生的现象为以下其中一种:漫反射、镜面反射或者高光反射,相应地,用于指示该组第一光线的第一样本池对应于某一种渲染效果,该渲染效果可呈现为以下其中一种:漫反射、镜面反射或者高光反射。例如,若该组第一光线在击中目标物体后所产生的现象为漫反射,该第一样本池对应的渲染效果呈现为漫反射等等。(2)若仅进行了多轮次的第一重采样,可得到目标物体与光源之间的多组第一光线路径,也就得到了形成这多组第一光线路径的多组第一光线。对于多组第一光线中的任意一组第一光线,可控制该组第一光线在击中目标物体后所产生的现象为以下其中一种:漫反射、镜面反射或者高光反射。需要说明的是,多组第一光线在击中目标物体后所产生的现象既可以相同,也可以不同,此处不做限定。相应地,对于用于指示这多组第一光线的多个第一样本池中的任意一个第一样本池,该第一样本池对应于某一种渲染效果,该渲染效果可呈现为以下其中一种:漫反射、镜面反射或者高光反射。需要说明的是,多个第一样本池所对应的渲染效果既可以相同,也可以不同。例如,一种常规的样本池配置可以为:构建两个第一样本池,第一个第一样本池对应的渲染效果呈现为镜面反射,第二个第一样本池对应的渲染效果为高光反射。可见,前述实现方式提供的多样本池技术,既可以令不同的第一样本池对应不同的渲染效果,也可以令不同的第一样本池对应相同的渲染效果,可因目标物体的材质进行选择,提高了方案的灵活度和全面性。In a possible implementation, the phenomenon caused by the first light ray hitting the target object includes at least one of the following: diffuse reflection, specular reflection or specular reflection. In the aforementioned implementation, there may be two situations: (1) If only a single round of the first resampling is performed, a set of first light paths between the target object and the light source can be obtained, and thus the set of A group of first rays in the first ray path, so the phenomenon produced by the group of first rays after hitting the target object can be controlled to be one of the following: diffuse reflection, specular reflection or specular reflection, correspondingly, used for indication The first sample pool of the group of first rays corresponds to a certain rendering effect, and the rendering effect can be one of the following: diffuse reflection, specular reflection, or specular reflection. For example, if the phenomenon produced by the first set of rays after hitting the target object is diffuse reflection, the rendering effect corresponding to the first sample pool will appear as diffuse reflection, and so on. (2) If only multiple rounds of first resampling are performed, multiple sets of first light paths between the target object and the light source can be obtained, and multiple sets of first light paths forming these multiple sets of first light paths can be obtained. . For any group of first rays among multiple groups of first rays, the phenomenon produced by the group of first rays after hitting the target object can be controlled to be one of the following: diffuse reflection, specular reflection, or specular reflection. It should be noted that the phenomena produced by the multiple sets of first light rays after hitting the target object may be the same or different, and are not limited here. Correspondingly, for any first sample pool among the plurality of first sample pools used to indicate the plurality of sets of first rays, the first sample pool corresponds to a certain rendering effect, and the rendering effect can present Is one of the following: diffuse, specular, or specular. It should be noted that the rendering effects corresponding to the multiple first sample pools may be the same or different. For example, a conventional sample pool configuration can be: construct two first sample pools, the rendering effect corresponding to the first first sample pool is presented as specular reflection, and the rendering effect corresponding to the second first sample pool is For high light reflection. It can be seen that the multi-sample pool technology provided by the aforementioned implementation can not only make different first sample pools correspond to different rendering effects, but also make different first sample pools correspond to the same rendering effect. Depending on the material of the target object, Making choices increases the flexibility and comprehensiveness of the plan.
在一种可能的实现方式中,第一样本池所指示的第一光线的数量小于屏幕所显示的像素的数量,第二 样本池所指示的第二光线的数量等于屏幕所显示的像素的数量,屏幕用于显示目标物体的图像。前述实现方式中,对于任意一个第一样本池,该第一样本池可包含一组第一光线在击中其余物体之后且击中目标物体之前的光强值,那么,该第一样本池的尺寸则为这些光强值的数量,也就是该组第一光线的数量(也就是说,第一样本池的尺寸,即为第一样本池所指示的第一光线的数量)。值得注意的是,该第一样本池的尺寸小于屏幕的分辨率(即屏幕所显示的像素的数量),该屏幕用于显示最终的目标物体的图像。对于任意一个第二样本池,该第二样本池可包含一组第二光线在击中目标物体之前的光强值,那么,该第二样本池的尺寸则为这些光强值的数量,也就是该组第二光线的数量(也就是说,第二样本池的尺寸,即为第二样本池所指示的第二光线的数量)。值得注意的是,该第二样本池的尺寸等于屏幕的分辨率(即屏幕所显示的像素的数量)。由此可见,前述实现方式可以令第一样本池的尺寸小于屏幕的分辨率,可提高获取第一样本池的效率。In a possible implementation, the number of first rays indicated by the first sample pool is less than the number of pixels displayed on the screen, and the second The number of second rays indicated by the sample pool is equal to the number of pixels displayed on the screen used to display the image of the target object. In the foregoing implementation, for any first sample pool, the first sample pool may contain a set of light intensity values of the first light after hitting other objects and before hitting the target object. Then, the first sample pool The size of this cell is the number of these light intensity values, that is, the number of first rays in the group (that is, the size of the first sample cell is the number of first rays indicated by the first sample cell ). It is worth noting that the size of the first sample pool is smaller than the resolution of the screen (that is, the number of pixels displayed on the screen), and the screen is used to display the final image of the target object. For any second sample pool, the second sample pool may contain a set of light intensity values before the second light hits the target object. Then, the size of the second sample pool is the number of these light intensity values, also It is the number of the second rays of the group (that is, the size of the second sample cell is the number of the second rays indicated by the second sample cell). It is worth noting that the size of the second sample pool is equal to the resolution of the screen (ie, the number of pixels displayed on the screen). It can be seen that the foregoing implementation method can make the size of the first sample pool smaller than the resolution of the screen, which can improve the efficiency of acquiring the first sample pool.
在一种可能的实现方式中,基于第一样本池和第二样本池,对目标物体进行渲染,以得到目标物体的图像包括:基于第一样本池对目标物体进行渲染,以得到目标物体的第一光照图像;基于第二样本池对目标物体进行渲染,以得到目标物体的第二光照图像;对第一光照图像以及第二光照图像进行融合,以得到目标物体的图像。前述实现方式中,由于可以得到至少一个第一样本池,可对至少一个第一样本池分别进行着色,得到目标物体的至少一个间接光照图像(即前述的第一光照图像)。由于可以得到至少一个第二样本池,可对至少一个第二样本池分别进行着色,得到目标物体的至少一个直接光照图像(即前述的第二光照图像)。得到目标物体的至少一个间接光照图像以及目标物体的至少一个直接光照图像后,可将这多个图像视为多个图层,故可对目标物体的至少一个间接光照图像以及目标物体的至少一个直接光照图像进行叠加,得到最终可送显的目标物体的图像。In a possible implementation, rendering the target object based on the first sample pool and the second sample pool to obtain an image of the target object includes: rendering the target object based on the first sample pool to obtain the target object The first illumination image of the object; rendering the target object based on the second sample pool to obtain the second illumination image of the target object; fusing the first illumination image and the second illumination image to obtain the image of the target object. In the aforementioned implementation manner, since at least one first sample pool can be obtained, the at least one first sample pool can be colored respectively to obtain at least one indirect illumination image of the target object (ie, the aforementioned first illumination image). Since at least one second sample pool can be obtained, the at least one second sample pool can be colored respectively to obtain at least one direct illumination image of the target object (ie, the aforementioned second illumination image). After obtaining at least one indirect illumination image of the target object and at least one direct illumination image of the target object, these multiple images can be regarded as multiple layers. Therefore, at least one indirect illumination image of the target object and at least one direct illumination image of the target object can be obtained. The direct illumination images are superimposed to obtain the final image of the target object that can be displayed.
在一种可能的实现方式中,对第一光照图像以及第二光照图像进行融合,以得到目标物体的图像之前,该方法还包括:获取目标物体的材质信息的无噪声分量;基于无噪声分量对第一光照图像进行第一处理,以得到处理后的第一光照图像,第一处理包含解调处理、降噪处理以及调制处理;基于无噪声分量对第二光照图像进行第二处理,以得到处理后的第二光照图像,第二处理包含解调处理、降噪处理以及调制处理;对第一光照图像以及第二光照图像进行融合,以得到目标物体的图像包括:对处理后的第一光照图像以及处理后的第二光照图像进行融合,以得到目标物体的图像。前述实现方式中,在获取目标物体的材质信息的无噪声分量后,可将目标物体的至少一个间接光照图像除以该无噪声分量,得到目标物体的解调后的至少一个间接光照图像。得到目标物体的解调后的至少一个间接光照图像后,可对目标物体的解调后的至少一个间接光照图像进行降噪,得到目标物体的降噪后的至少一个间接光照图像。得到目标物体的降噪后的至少一个间接光照图像后,可将目标物体的降噪后的至少一个间接光照图像乘以该无噪声分量,得到目标物体的调制后的至少一个间接光照图像,可作为目标物体的处理后的至少一个间接光照图像(处理后的间接光照图像即为前述处理后的第一光照图像)。与此同时,得到目标物体的材质信息的无噪声分量后,还可将目标物体的至少一个直接光照图像除以该无噪声分量,得到目标物体的解调后的至少一个直接光照图像。得到目标物体的解调后的至少一个直接光照图像后,可对目标物体的解调后的至少一个直接光照图像进行降噪,得到目标物体的降噪后的至少一个直接光照图像。得到目标物体的降噪后的至少一个直接光照图像后,可将目标物体的降噪后的至少一个直接光照图像乘以该无噪声分量,得到目标物体的调制后的至少一个直接光照图像,即目标物体的处理后的至少一个直接光照图像(处理后的直接光照图像即为前述处理后的第二光照图像)。得到目标物体的处理后的至少一个间接光照图像以及目标物体的处理后的至少一个直接光照图像后,可将目标物体的处理后的至少一个间接光照图像以及目标物体的处理后的至少一个直接光照图像进行叠加,从而得到最终可送显的目标物体的图像。可见,前述实现方式提供了一种新的图像降噪方式,可基于目标物体的材质信息的无噪声分类来实现对各个图层的解调、降噪以及调制,这样可以使得各个图层尽量保持目标物体的细节,使得基于各个图层叠加得到的目标物体的图像,更加真实且清晰可见,有利于提高用户的观看,进一步提高用户体验。In a possible implementation, before fusing the first illumination image and the second illumination image to obtain the image of the target object, the method further includes: obtaining a noise-free component of the material information of the target object; based on the noise-free component Perform first processing on the first illumination image to obtain the processed first illumination image. The first processing includes demodulation processing, noise reduction processing and modulation processing; perform second processing on the second illumination image based on the noise-free component to obtain Obtaining the processed second illumination image, the second processing includes demodulation processing, noise reduction processing and modulation processing; fusing the first illumination image and the second illumination image to obtain the image of the target object includes: The first illumination image and the processed second illumination image are fused to obtain an image of the target object. In the aforementioned implementation manner, after obtaining the noise-free component of the material information of the target object, at least one indirect illumination image of the target object can be divided by the noise-free component to obtain at least one demodulated indirect illumination image of the target object. After obtaining at least one demodulated indirect illumination image of the target object, the at least one demodulated indirect illumination image of the target object can be denoised to obtain at least one denoised indirect illumination image of the target object. After obtaining at least one denoised indirect illumination image of the target object, the at least one denoised indirect illumination image of the target object can be multiplied by the noise-free component to obtain at least one modulated indirect illumination image of the target object. As at least one processed indirect illumination image of the target object (the processed indirect illumination image is the aforementioned processed first illumination image). At the same time, after obtaining the noise-free component of the material information of the target object, at least one direct illumination image of the target object can be divided by the noise-free component to obtain at least one demodulated direct illumination image of the target object. After obtaining at least one demodulated direct illumination image of the target object, the at least one demodulated direct illumination image of the target object can be denoised to obtain at least one denoised direct illumination image of the target object. After obtaining at least one direct illumination image of the target object after denoising, the at least one direct illumination image after denoising of the target object can be multiplied by the noise-free component to obtain at least one modulated direct illumination image of the target object, that is, At least one processed direct illumination image of the target object (the processed direct illumination image is the aforementioned processed second illumination image). After obtaining at least one processed indirect illumination image of the target object and at least one processed direct illumination image of the target object, the at least one processed indirect illumination image of the target object and at least one processed direct illumination image of the target object can be obtained The images are superimposed to obtain the final image of the target object that can be displayed. It can be seen that the aforementioned implementation method provides a new image noise reduction method, which can realize demodulation, noise reduction and modulation of each layer based on the noise-free classification of the material information of the target object, so that each layer can be kept as smooth as possible. The details of the target object make the image of the target object obtained based on the superposition of each layer more realistic and clearly visible, which is conducive to improving the user's viewing experience and further improving the user experience.
在一种可能的实现方式中,第一处理还包含超分处理,超分处理用于令处理后的第一光照图像的分辨率等于屏幕的分辨率。前述实现方式中,由于至少一个第一样本池的尺寸小于屏幕的分辨率,故目标物体的调制后的至少一个间接光照图像的分辨率也小于屏幕的分辨率。为了各个图层实现更好的融合,得到目标物体的调制后的至少一个间接光照图像后,还可对目标物体的调制后的至少一个间接光照图像进行超分 处理,将目标物体的超分后的至少一个间接光照图像作为目标物体的处理后的至少一个间接光照图像,此时,目标物体的处理后的至少一个间接光照图像的分辨率等于屏幕的分辨率。可见,前述实现方式在基于多样本池技术对目标物体进行渲染的过程中,可配合超分处理,在一定程度上减少该过程所需付出的计算量,有利于加快基于多样本池的光线追踪技术的实现,进一步提高用户体验。In a possible implementation, the first processing also includes super-resolution processing, and the super-resolution processing is used to make the resolution of the processed first illumination image equal to the resolution of the screen. In the aforementioned implementation manner, since the size of the at least one first sample pool is smaller than the resolution of the screen, the resolution of the modulated at least one indirect illumination image of the target object is also smaller than the resolution of the screen. In order to achieve better integration of each layer, after obtaining at least one modulated indirect illumination image of the target object, you can also perform super-resolution on at least one modulated indirect illumination image of the target object. Processing, using at least one super-resolved indirect lighting image of the target object as at least one processed indirect lighting image of the target object, at this time, the resolution of the at least one processed indirect lighting image of the target object is equal to the resolution of the screen . It can be seen that the aforementioned implementation method can be used with super-resolution processing in the process of rendering target objects based on multi-sample pool technology, which can reduce the amount of calculation required in the process to a certain extent and is conducive to accelerating ray tracing based on multi-sample pools. The implementation of technology further improves user experience.
本申请实施例的第二方面提供了一种图像渲染装置,该装置包括:重采样模块,用于基于目标物体与光源之间的原始光线路径,对目标物体与光源之间的光线路径进行重采样,以得到新光线路径,原始光线路径通过光线追踪得到,原始光线路径以目标物体为起点,以光源为终点,新光线路径以光源为起点,以目标物体为终点;第一获取模块,用于基于新光线路径,获取样本池,样本池用于指示射向目标物体的光线,新光线路径由光线形成;渲染模块,用于基于样本池,对目标物体进行渲染,以得到目标物体的图像。A second aspect of the embodiment of the present application provides an image rendering device. The device includes: a resampling module for resampling the light path between the target object and the light source based on the original light path between the target object and the light source. Sampling is performed to obtain a new light path. The original light path is obtained through ray tracing. The original light path starts with the target object and ends with the light source. The new light path starts with the light source and ends with the target object. The first acquisition module uses Based on the new light path, the sample pool is obtained. The sample pool is used to indicate the light rays directed to the target object. The new light path is formed by the light; the rendering module is used to render the target object based on the sample pool to obtain an image of the target object. .
从上述装置可以看出:在获取目标物体与光源之间的原始光线路径后,可基于原始光线路径对目标物体与光源之间的光线路径进行重采样,得到新光线路径,原始光线路径通过光线追踪得到,原始光线路径以目标物体为起点,以光源为终点,新光线路径以光源为起点,以目标物体为终点。然后,可基于新光线路径获取样本池,样本池用于指示射向目标物体的光线,新光线路径由这些光线形成。最后,可基于样本池对目标物体进行渲染,得到目标物体的图像。基于前述过程可知,本申请实施例提供了一种新的光线路径重采样方式,该方式逆着光线追踪中有效的光线路径的指向(以光源为起点,以目标物体为终点),有针对性地去重采样光线路径,可提高采样到有效的新光线路径的成功率,即能够轻易地重采样到目标物体与光源之间有效的新光线路径,如此一来,无论形成新光线路径的光线射在目标物体上所产生的现象为直接光照、漫反射、镜面反射和高光反射中的哪一种,均可成功获取到优质且足够的样本池,从而令针对目标物体的渲染效果足够优质。It can be seen from the above device that after obtaining the original light path between the target object and the light source, the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path. The original light path passes through the light path. It is traced that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object. A pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed. Finally, the target object can be rendered based on the sample pool to obtain the image of the target object. Based on the foregoing process, it can be seen that the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Ground resampling of light paths can improve the success rate of sampling to effective new light paths, that is, it can easily resample to effective new light paths between the target object and the light source. In this way, no matter the light that forms the new light path Regardless of whether the phenomenon produced by the target object is direct illumination, diffuse reflection, specular reflection, or specular reflection, a high-quality and sufficient sample pool can be successfully obtained, so that the rendering effect of the target object is high enough.
在一种可能的实现方式中,新光线路径包括第一光线路径以及第二光线路径,第一光线路径以光源为起点,以目标物体为终点,且经过其余物体,第二光线路径以光源为起点,以目标物体为终点,且未经过其余物体;样本池包含第一样本池和第二样本池,第一样本池用于指示射向目标物体的第一光线,第一光线路径由第一光线形成,第二样本池用于指示射向目标物体的第二光线,第二光线路径由第二光线形成。In a possible implementation, the new light path includes a first light path and a second light path. The first light path starts with the light source, ends with the target object, and passes through other objects. The second light path starts with the light source. The starting point is the target object as the end point, and does not pass through other objects; the sample pool includes the first sample pool and the second sample pool. The first sample pool is used to indicate the first light ray directed to the target object. The first light path is A first ray is formed, a second sample cell is used to direct a second ray directed to the target object, and a second ray path is formed by the second ray.
在一种可能的实现方式中,第一光线射在目标物体上所产生的现象为镜面反射或者高光反射。In a possible implementation, the phenomenon caused by the first light ray hitting the target object is specular reflection or specular reflection.
在一种可能的实现方式中,第一样本池所指示的第一光线的数量小于屏幕所显示的像素的数量,第二样本池所指示的第二光线的数量等于屏幕所显示的像素的数量,屏幕用于显示目标物体的图像。In a possible implementation, the number of first rays indicated by the first sample pool is less than the number of pixels displayed on the screen, and the number of second rays indicated by the second sample pool is equal to the number of pixels displayed on the screen. Quantity, the screen is used to display the image of the target object.
在一种可能的实现方式中,渲染模块,用于:基于第一样本池对目标物体进行渲染,以得到目标物体的第一光照图像;基于第二样本池对目标物体进行渲染,以得到目标物体的第二光照图像;对第一光照图像以及第二光照图像进行融合,以得到目标物体的图像。In a possible implementation, the rendering module is configured to: render the target object based on the first sample pool to obtain the first illumination image of the target object; render the target object based on the second sample pool to obtain the The second illumination image of the target object; fuse the first illumination image and the second illumination image to obtain an image of the target object.
在一种可能的实现方式中,渲染模块,还用于:获取目标物体的材质信息的无噪声分量;基于无噪声分量对第一光照图像进行第一处理,以得到处理后的第一光照图像,第一处理包含解调处理、降噪处理以及调制处理;基于无噪声分量对第二光照图像进行第二处理,以得到处理后的第二光照图像,第二处理包含解调处理、降噪处理以及调制处理;渲染模块,用于对处理后的第一光照图像以及处理后的第二光照图像进行融合,以得到目标物体的图像。In a possible implementation, the rendering module is also used to: obtain the noise-free component of the material information of the target object; and perform the first processing on the first illumination image based on the noise-free component to obtain the processed first illumination image. , the first processing includes demodulation processing, noise reduction processing and modulation processing; the second processing is performed on the second illumination image based on the noise-free component to obtain the processed second illumination image, and the second processing includes demodulation processing, noise reduction Processing and modulation processing; a rendering module, used to fuse the processed first lighting image and the processed second lighting image to obtain an image of the target object.
在一种可能的实现方式中,第一处理还包含超分处理,超分处理用于令处理后的第一光照图像的分辨率等于屏幕的分辨率。In a possible implementation, the first processing also includes super-resolution processing, and the super-resolution processing is used to make the resolution of the processed first illumination image equal to the resolution of the screen.
本申请实施例的第三方面提供了一种电子设备,该电子设备包括存储器和处理器;存储器存储有代码,处理器被配置为执行代码,当代码被执行时,该电子设备执行如第一方面或第一方面任意一种可能的实现方式所述的方法。A third aspect of the embodiment of the present application provides an electronic device. The electronic device includes a memory and a processor; the memory stores code, and the processor is configured to execute the code. When the code is executed, the electronic device executes the first step. The method described in any possible implementation manner of the aspect or the first aspect.
本申请实施例的第四方面提供了一种电路系统,该电路系统包括处理电路,该处理电路配置为执行如第一方面、第一方面中的任意一种可能的实现方式所述的方法。A fourth aspect of the embodiments of the present application provides a circuit system. The circuit system includes a processing circuit configured to perform the method described in the first aspect and any possible implementation manner of the first aspect.
本申请实施例的第五方面提供了一种芯片系统,该芯片系统包括处理器,用于调用存储器中存储的计算机程序或计算机指令,以使得该处理器执行如第一方面、第一方面中的任意一种可能的实现方式所述的方法。A fifth aspect of the embodiments of the present application provides a chip system. The chip system includes a processor for calling a computer program or computer instructions stored in a memory, so that the processor executes the steps described in the first aspect and the first aspect. any possible implementation method.
在一种可能的实现方式中,该处理器通过接口与存储器耦合。In one possible implementation, the processor is coupled to the memory through an interface.
在一种可能的实现方式中,该芯片系统还包括存储器,该存储器中存储有计算机程序或计算机指令。 In a possible implementation, the chip system further includes a memory, and computer programs or computer instructions are stored in the memory.
本申请实施例的第六方面提供了一种计算机存储介质,计算机存储介质存储有一个或多个指令,指令在由一个或多个计算机执行时使得一个或多个计算机实施如第一方面或第一方面任意一种可能的实现方式所述的方法。A sixth aspect of the embodiments of the present application provides a computer storage medium. The computer storage medium stores one or more instructions. When executed by one or more computers, the instructions cause one or more computers to implement the first aspect or the third aspect. On the one hand, any possible implementation method is described.
本申请实施例的第七方面提供了一种计算机程序产品,计算机程序产品存储有指令,指令在由计算机执行时,使得计算机实施如第一方面或第一方面任意一种可能的实现方式所述的方法。The seventh aspect of the embodiments of the present application provides a computer program product. The computer program product stores instructions. When the instructions are executed by a computer, the computer implements the implementation as described in the first aspect or any possible implementation manner of the first aspect. Methods.
本申请实施例中,在获取目标物体与光源之间的原始光线路径后,可基于原始光线路径对目标物体与光源之间的光线路径进行重采样,得到新光线路径,原始光线路径通过光线追踪得到,原始光线路径以目标物体为起点,以光源为终点,新光线路径以光源为起点,以目标物体为终点。然后,可基于新光线路径获取样本池,样本池用于指示射向目标物体的光线,新光线路径由这些光线形成。最后,可基于样本池对目标物体进行渲染,得到目标物体的图像。基于前述过程可知,本申请实施例提供了一种新的光线路径重采样方式,该方式逆着光线追踪中有效的光线路径的指向(以光源为起点,以目标物体为终点),有针对性地去重采样光线路径,可提高采样到有效的新光线路径的成功率,即能够轻易地重采样到目标物体与光源之间有效的新光线路径,如此一来,无论形成新光线路径的光线射在目标物体上所产生的现象为直接光照、漫反射、镜面反射和高光反射中的哪一种,均可成功获取到优质且足够的样本池,从而令针对目标物体的渲染效果足够优质。In the embodiment of the present application, after obtaining the original light path between the target object and the light source, the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path. The original light path is traced through ray tracing. It is obtained that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object. A pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed. Finally, the target object can be rendered based on the sample pool to obtain the image of the target object. Based on the foregoing process, it can be seen that the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Ground resampling of light paths can improve the success rate of sampling to effective new light paths, that is, it can easily resample to effective new light paths between the target object and the light source. In this way, no matter the light that forms the new light path Regardless of whether the phenomenon produced by the target object is direct illumination, diffuse reflection, specular reflection, or specular reflection, a high-quality and sufficient sample pool can be successfully obtained, so that the rendering effect of the target object is high enough.
附图说明Description of drawings
图1为光线追踪技术的原理示意图;Figure 1 is a schematic diagram of the principle of ray tracing technology;
图2为光栅化技术的原理示意图;Figure 2 is a schematic diagram of the principle of rasterization technology;
图3为本申请实施例提供的电子设备的一个结构示意图;Figure 3 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
图4为本申请实施例提供的图像渲染方法的一个流程示意图;Figure 4 is a schematic flow chart of an image rendering method provided by an embodiment of the present application;
图5为本申请实施例提供的BVH树的一种示意图;Figure 5 is a schematic diagram of the BVH tree provided by the embodiment of the present application;
图6为本申请实施例提供的光线路径重采样的一个示意图;Figure 6 is a schematic diagram of light path resampling provided by an embodiment of the present application;
图7为本申请实施例提供的图像渲染方法的一个应用例示意图;Figure 7 is a schematic diagram of an application example of the image rendering method provided by the embodiment of the present application;
图8为本申请实施例提供的降噪过程的一个示意图;Figure 8 is a schematic diagram of the noise reduction process provided by the embodiment of the present application;
图9为本申请实施例提供的比较结果的一个示意图;Figure 9 is a schematic diagram of the comparison results provided by the embodiment of the present application;
图10为本申请实施例提供的比较结果的另一示意图;Figure 10 is another schematic diagram of the comparison results provided by the embodiment of the present application;
图11为本申请实施例提供的比较结果的另一示意图;Figure 11 is another schematic diagram of the comparison results provided by the embodiment of the present application;
图12为本申请实施例提供的比较结果的另一示意图;Figure 12 is another schematic diagram of the comparison results provided by the embodiment of the present application;
图13为本申请实施例提供的比较结果的另一示意图;Figure 13 is another schematic diagram of the comparison results provided by the embodiment of the present application;
图14为本申请实施例提供的比较结果的另一示意图;Figure 14 is another schematic diagram of the comparison results provided by the embodiment of the present application;
图15为本申请实施例提供的图像渲染装置的一个结构示意图。Figure 15 is a schematic structural diagram of an image rendering device provided by an embodiment of the present application.
具体实施方式Detailed ways
本申请实施例提供了一种图像渲染方法及其相关设备,无论形成光线射在目标物体上所产生的现象为漫反射、镜面反射和高光反射中的哪一种,均可令针对目标物体的渲染效果足够优质。Embodiments of the present application provide an image rendering method and related equipment, which can render the image of the target object regardless of whether the phenomenon caused by the light hitting the target object is diffuse reflection, specular reflection or specular reflection. The rendering effect is high enough.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。The terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the terms so used are interchangeable under appropriate circumstances, and are merely a way of distinguishing objects with the same attributes in describing the embodiments of the present application. Furthermore, the terms "include" and "having" and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, product or apparatus comprising a series of elements need not be limited to those elements, but may include not explicitly other elements specifically listed or inherent to such processes, methods, products or equipment.
随着计算机技术的发展,越来越多的应用程序,例如游戏应用或者视频应用等应用程序,要求在电子设备上显示画质精美的图像。这些图像通常是由电子设备基于三维(three dimensional,3D)场景中的模型进行渲染得到的。With the development of computer technology, more and more applications, such as game applications or video applications, require the display of fine-quality images on electronic devices. These images are usually rendered by electronic devices based on models in a three-dimensional (3D) scene.
在传统的图像处理方法中,通常采用光栅化处理对3D场景进行渲染,以得到能够显示3D场景的图像。 然而,采用光栅化技术进行渲染所得到的图像的品质一般,往往难以呈现逼真的画面。例如,渲染得到的图像中通常难以真实还原场景中的光线反射、折射以及阴影等效果。有鉴于此,一种新的渲染技术--光线追踪技术应运而生。光线追踪技术与光栅化技术都是用于实现图像渲染的方法,其主要目的是通过计算着色,将3D空间的物体,投影到二维的屏幕空间进行显示。In traditional image processing methods, rasterization processing is usually used to render 3D scenes to obtain images that can display 3D scenes. However, the quality of images obtained by rendering using rasterization technology is average, and it is often difficult to present realistic images. For example, it is often difficult to truly reproduce the effects of light reflection, refraction, and shadows in the scene in the rendered image. In view of this, a new rendering technology - ray tracing technology came into being. Ray tracing technology and rasterization technology are both methods used to achieve image rendering. Their main purpose is to project objects in 3D space into a two-dimensional screen space for display by calculating shading.
图1为光线追踪技术的原理示意图。如图1所示,光线追踪的原理为:从相机的位置,通过图像平面上的像素位置,发射一束光线到三维场景中,求光线和几何图形间最近的交点,再求该交点的着色。如果该交点的材质是反射性的,可以在该交点向的反射方向继续追踪,并且继续求取反射后的交点的着色。也就是说,光线追踪方法是通过追踪光线在三维场景中的传播过程,来计算投影与全局光照,从而渲染得到二维图像。Figure 1 is a schematic diagram of the principle of ray tracing technology. As shown in Figure 1, the principle of ray tracing is: from the position of the camera, through the pixel position on the image plane, emit a beam of ray into the three-dimensional scene, find the nearest intersection point between the ray and the geometric figure, and then find the coloring of the intersection point . If the material of the intersection is reflective, you can continue tracing in the reflection direction of the intersection and continue to obtain the coloring of the reflected intersection. In other words, the ray tracing method calculates projection and global illumination by tracing the propagation process of light in a three-dimensional scene, thereby rendering a two-dimensional image.
图2为光栅化技术的原理示意图。如图2所示,光栅化处理的原理为:将三维场景中的物体采用三角形进行分割,通过坐标变化计算将三角形顶点的三维坐标变换为图像上的二维坐标,最后在图像上的三角形内填充纹理,以实现图像的渲染。Figure 2 is a schematic diagram of the principle of rasterization technology. As shown in Figure 2, the principle of rasterization is: segment the objects in the three-dimensional scene using triangles, transform the three-dimensional coordinates of the triangle vertices into two-dimensional coordinates on the image through coordinate change calculation, and finally within the triangle on the image Fill texture to achieve image rendering.
由于光栅化技术是将屏幕空间上可见的内容直接投影至屏幕空间上,而得到相应的图像,其处理难度较低,所提供的光影效果也较差。光线追踪技术则是通过追踪从相机发出的每条光线来实现如反射、折射、阴影以及环境光遮蔽等真实效果,因此光线追踪方法能够提供真实逼真的光影效果。因此,为了渲染出较为逼真的图像,当前电子设备通常优先光线追踪技术对三维场景进行渲染,以提高用户的观看体验。Since rasterization technology directly projects the content visible on the screen space onto the screen space to obtain the corresponding image, its processing difficulty is relatively low and the light and shadow effects provided are also poor. Ray tracing technology achieves real-life effects such as reflection, refraction, shadows, and ambient light occlusion by tracking each ray of light emitted from the camera. Therefore, the ray tracing method can provide realistic light and shadow effects. Therefore, in order to render more realistic images, current electronic devices usually give priority to ray tracing technology to render three-dimensional scenes to improve the user's viewing experience.
目前,相关技术提出了一种基于路径重采样的光线追踪算法。在该算法中,对于三维场景中某个待渲染的物体而言,在确定首次相交于该物体的光线所形成的原始光线路径后,可基于该原始光线路径进行光线路径的重采样,从而采集到首次相交于该物体的新光线所形成的新光线路径。接着,可基于该新光线路径获取相应的样本池,该样本池用于指示形成该新光线路径的新光线(即该样本池可存储着光线样本)。然后,可基于该样本池来渲染该物体的图像。Currently, related technologies propose a ray tracing algorithm based on path resampling. In this algorithm, for an object to be rendered in a three-dimensional scene, after determining the original light path formed by the light that intersects the object for the first time, the light path can be resampled based on the original light path, thereby collecting A new ray path formed by a new ray that intersects the object for the first time. Then, a corresponding sample pool can be obtained based on the new light path, and the sample pool is used to indicate the new rays forming the new light path (that is, the sample pool can store light samples). An image of the object can then be rendered based on this pool of samples.
在该算法中,受限于物体的材质,若光线在某个物体上的作用表现为漫反射时,针对该物体重新发射的光线,光线击中该物体后的反射范围往往很大,反射后的光线即使继续击中其余物体,也有较大几率到达光源,故可轻易重采样到有效的新光线路径,那么,在该物体所展现的渲染效果较优(即渲染得到的该物体的图像往往质量较佳)。若光线在该物体上的作用表现为镜面反射或高光反射时,针对该物体重新发射的光线,光线击中物体后的反射范围往往较小,反射后的光线在继续击中其余物体后,仅有较小几率到达光源,故难以重采样到有效的新光线路径,导致获取不到优质且足够的样本池,因而在该物体所展现的渲染效果往往较差(即渲染得到的该物体的图像往往质量较差)。In this algorithm, limited by the material of the object, if the effect of light on an object is diffuse reflection, the light re-emitted for the object will often have a large reflection range after the light hits the object. Even if the light continues to hit other objects, it has a higher probability of reaching the light source, so it can be easily resampled to a valid new light path. Then, the rendering effect displayed on the object is better (that is, the rendered image of the object is often better quality). If the effect of light on the object is specular reflection or specular reflection, for the light re-emitted by the object, the reflection range after the light hits the object is often small. After the reflected light continues to hit other objects, it will only There is a small chance of reaching the light source, so it is difficult to resample an effective new light path, resulting in the inability to obtain a high-quality and sufficient sample pool. Therefore, the rendering effect displayed on the object is often poor (that is, the rendered image of the object often of poorer quality).
进一步地,该算法中不仅获取样本池的效率不高,而且样本池的数据量往往很大,会使得基于样本池对物体进行渲染的过程,需要付出很大的计算量,导致渲染的整个过程需要花费较大的时间成本,以致于用户体验不佳。Furthermore, not only is the efficiency of obtaining the sample pool in this algorithm not high, but the amount of data in the sample pool is often very large, which makes the process of rendering objects based on the sample pool require a large amount of calculation, resulting in the entire rendering process It takes a lot of time and costs, resulting in poor user experience.
更进一步地,对物体进行渲染的过程中,往往会使用一定的图像降噪处理,以过滤图像中的噪声。然而,相关技术的降噪处理往往会对整个图像进行滤波,导致最终得到的物体的图像变得模糊,这样的图像会导致用户的观感不佳,降低了用户体验。Furthermore, in the process of rendering objects, certain image noise reduction processing is often used to filter the noise in the image. However, the noise reduction processing of related technologies often filters the entire image, causing the final image of the object to become blurred. Such an image will lead to a poor user experience and reduce the user experience.
为了解决上述问题,本申请实施例提供了一种图像渲染方法,该方法可以由电子设备来执行。该电子设备中包括CPU和GPU,能够对图像进行渲染处理。示例性地,该电子设备例如可以是手机(mobile phone)、平板电脑、笔记本电脑、PC、移动互联网设备(mobile internet device,MID)、可穿戴设备,虚拟现实(virtual reality,VR)设备、增强现实(augmented reality,AR)设备、工业控制(industrial control)中的无线电子设备、无人驾驶(self driving)中的无线电子设备、远程手术(remote medical surgery)中的无线电子设备、智能电网(smart grid)中的无线电子设备、运输安全(transportation safety)中的无线电子设备、智慧城市(smart city)中的无线电子设备、智慧家庭(smart home)中的无线电子设备等。该电子设备可以是运行安卓系统、IOS系统、windows系统以及其他系统的设备。在该电子设备中可以运行有需要对3D场景进行渲染而得到二维图像的应用程序,例如游戏应用、锁屏应用、地图应用或监控应用等应用。In order to solve the above problem, embodiments of the present application provide an image rendering method, which can be executed by an electronic device. The electronic device includes a CPU and a GPU, which can render images. Illustratively, the electronic device may be a mobile phone (mobile phone), a tablet computer, a notebook computer, a PC, a mobile internet device (mobile internet device, MID), a wearable device, a virtual reality (virtual reality, VR) device, an enhanced Augmented reality (AR) equipment, wireless electronic equipment in industrial control (industrial control), wireless electronic equipment in self-driving (self driving), wireless electronic equipment in remote medical surgery, smart grid ( Wireless electronic devices in smart grid, wireless electronic devices in transportation safety, wireless electronic devices in smart city, wireless electronic devices in smart home, etc. The electronic device can be a device running Android system, IOS system, Windows system and other systems. Applications that need to render 3D scenes to obtain two-dimensional images can be run in the electronic device, such as game applications, lock screen applications, map applications, or monitoring applications.
为了便于理解,下面结合图3对电子设备的具体结构进行详细的介绍。可以参阅图3,图3为本申请实施例提供的电子设备的一个结构示意图。如图3所示,电子设备3000可以包括:中央处理器3001、图 形处理器3002、显示设备3003和存储器3004。可选地,该电子设备3000还可以包括至少一个通信总线(图3中未示出),用于实现各个组件之间的连接通信。In order to facilitate understanding, the specific structure of the electronic device will be introduced in detail below with reference to Figure 3 . Please refer to FIG. 3 , which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As shown in Figure 3, the electronic device 3000 may include: a central processing unit 3001; Graphics processor 3002, display device 3003 and memory 3004. Optionally, the electronic device 3000 may also include at least one communication bus (not shown in FIG. 3) for realizing connection communication between various components.
应当理解,电子设备3000中的各个组件还可以通过其他连接器相耦合,其他连接器可包括各类接口、传输线或总线等。电子设备3000中的各个组件还可以是以中央处理器3001为中心的放射性连接方式。在本申请的各个实施例中,耦合是指通过相互电连接或连通,包括直接相连或通过其他设备间接相连。It should be understood that various components in the electronic device 3000 can also be coupled through other connectors, and other connectors can include various types of interfaces, transmission lines or buses, etc. Each component in the electronic device 3000 may also be radially connected with the central processor 3001 as the center. In various embodiments of the present application, coupling refers to electrical connection or communication with each other, including direct connection or indirect connection through other devices.
中央处理器3001和图形处理器3002的连接方式也有多种,并不局限于图2所示的方式。电子设备3000中的中央处理器3001和图形处理器3002可以位于同一个芯片上,也可以分别为独立的芯片。There are many ways to connect the central processing unit 3001 and the graphics processor 3002, which are not limited to the way shown in Figure 2. The central processor 3001 and the graphics processor 3002 in the electronic device 3000 may be located on the same chip, or they may be separate chips.
下面对中央处理器3001、图形处理器3002、显示设备3003和存储器3004的作用进行简单的介绍。The following briefly introduces the functions of the central processor 3001, the graphics processor 3002, the display device 3003, and the memory 3004.
中央处理器3001:用于运行操作系统3005和应用程序3006。应用程序3006可以为图形类应用程序,比如游戏、视频播放器等等。操作系统3005提供了系统图形库接口,应用程序3006通过该系统图形库接口,以及操作系统3005提供的驱动程序,比如图形库用户态驱动和/或图形库内核态驱动,生成用于渲染图形或图像帧的指令流,以及所需的相关渲染数据。其中,系统图形库包括但不限于:嵌入式开放图形库(open graphics library for embedded system,OpenGL ES)、柯罗诺斯平台图形界面(the khronos platform graphics interface)或Vulkan(一个跨平台的绘图应用程序接口)等系统图形库。指令流包含一些列的指令,这些指令通常为对系统图形库接口的调用指令。Central processing unit 3001: used to run operating system 3005 and application programs 3006. The application 3006 may be a graphics application, such as a game, a video player, etc. The operating system 3005 provides a system graphics library interface, and the application program 3006 uses the system graphics library interface and the driver provided by the operating system 3005, such as the graphics library user mode driver and/or the graphics library kernel mode driver to generate graphics or graphics for rendering. A flow of instructions for image frames, along with the required associated rendering data. Among them, system graphics libraries include but are not limited to: open graphics library for embedded system (OpenGL ES), the khronos platform graphics interface (the khronos platform graphics interface) or Vulkan (a cross-platform graphics application Program interface) and other system graphics libraries. The instruction stream contains a series of instructions, which are usually instructions for calling the system graphics library interface.
可选地,中央处理器3001可以包括以下至少一种类型的处理器:应用处理器、一个或多个微处理器、数字信号处理器(digital signal processor,DSP)、微控制器(microcontroller unit,MCU)或人工智能处理器等。Optionally, the central processor 3001 may include at least one of the following types of processors: an application processor, one or more microprocessors, a digital signal processor (DSP), a microcontroller unit, MCU) or artificial intelligence processor, etc.
中央处理器3001还可进一步包括必要的硬件加速器,如专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)、或者用于实现逻辑运算的集成电路。处理器3001可以被耦合到一个或多个数据总线,用于在电子设备3000的各个组件之间传输数据和指令。The central processing unit 3001 may further include necessary hardware accelerators, such as application specific integrated circuits (ASICs), field programmable gate arrays (field programmable gate arrays, FPGAs), or integrated circuits used to implement logic operations. Processor 3001 may be coupled to one or more data buses for transmitting data and instructions between various components of electronic device 3000 .
图形处理器3002:用于接收处理器3001发送的图形指令流,通过渲染管线(pipeline)生成渲染目标,并通过操作系统的图层合成显示模块将渲染目标显示到显示设备3003。其中,渲染管线也可以称为渲染流水线、像素流水线或像素管线,是图形处理器3002内部用于处理图形信号的并行处理单元。图形处理器3002中可以包括多个渲染管线,多个渲染管线之间可以相互独立地并行处理图形信号。例如,渲染管线可以在渲染图形或图像帧的过程中执行一些列操作,典型的操作可以包括:顶点处理(vertex processing)、图元处理(primitive processing)、光栅化(rasterization)、片段处理(fragment processing)等等。Graphics processor 3002: used to receive the graphics instruction stream sent by the processor 3001, generate a rendering target through a rendering pipeline (pipeline), and display the rendering target to the display device 3003 through the layer synthesis display module of the operating system. The rendering pipeline may also be called a rendering pipeline, a pixel pipeline or a pixel pipeline, and is a parallel processing unit inside the graphics processor 3002 for processing graphics signals. The graphics processor 3002 may include multiple rendering pipelines, and the multiple rendering pipelines may process graphics signals in parallel independently of each other. For example, the rendering pipeline can perform a series of operations in the process of rendering graphics or image frames. Typical operations can include: vertex processing (vertex processing), primitive processing (primitive processing), rasterization (rasterization), fragment processing (fragment) processing) and so on.
可选地,图形处理器3002可以包括执行软件的通用图形处理器,如GPU或其他类型的专用图形处理单元等。Optionally, the graphics processor 3002 may include a general-purpose graphics processor that executes software, such as a GPU or other types of dedicated graphics processing units.
显示设备3003:用于显示由电子设备3000生成的各种图像,该图像可以为操作系统的图形用户界面(graphical user interface,GUI)或由图形处理器3002处理的图像数据(包括静止图像和视频数据)。Display device 3003: used to display various images generated by the electronic device 3000, which can be a graphical user interface (GUI) of the operating system or image data (including still images and videos) processed by the graphics processor 3002 data).
可选地,显示设备3003可以包括任何合适类型的显示屏。例如液晶显示器(liquid crystal display,LCD)或等离子显示器或有机发光二极管(organic light-emitting diode,OLED)显示器等。Optionally, display device 3003 may include any suitable type of display screen. For example, liquid crystal display (LCD) or plasma display or organic light-emitting diode (OLED) display.
存储器3004,是中央处理器3001和图形处理器3002之间的传输通道,可以为双倍速率同步动态随机存储器(double data rate synchronous dynamic random access memory,DDR SDRAM)或者其它类型的缓存。The memory 3004 is a transmission channel between the central processor 3001 and the graphics processor 3002, and can be double data rate synchronous dynamic random access memory (DDR SDRAM) or other types of cache.
以上介绍了本申请实施例提供的图像渲染方法所应用的电子设备的具体结构,以下将详细介绍本申请实施例所提供的图像渲染方法的流程。图4为本申请实施例提供的图像渲染方法的一个流程示意图,如图4所示,该方法包括:The specific structure of the electronic device used in the image rendering method provided by the embodiment of the present application has been introduced above. The process of the image rendering method provided by the embodiment of the present application will be introduced in detail below. Figure 4 is a schematic flow chart of an image rendering method provided by an embodiment of the present application. As shown in Figure 4, the method includes:
401、获取目标物体与光源之间的原始光线路径,原始光线路径通过光线追踪得到,原始光线路径以目标物体为起点,以光源为终点。401. Obtain the original light path between the target object and the light source. The original light path is obtained through ray tracing. The original light path starts from the target object and ends with the light source.
本实施例中,在获取某个三维场景的模型文件后,可从中解析出三维场景中各个物体的渲染信息、相机的空间信息以及光源的空间信息等等,下文对这些信息分别进行简单的介绍:In this embodiment, after obtaining the model file of a certain three-dimensional scene, the rendering information of each object in the three-dimensional scene, the spatial information of the camera, the spatial information of the light source, etc. can be parsed from it. These information are briefly introduced below. :
(1)每个物体的渲染信息包含该物体的空间信息以及该物体的材质信息,其中,物体的空间信息包含物体的顶点坐标、物体的顶点法线以及三角形索引等信息,物体的材质信息包含物体的颜色、物体的金 属度以及物体的粗糙度等信息。(1) The rendering information of each object includes the spatial information of the object and the material information of the object. The spatial information of the object includes the vertex coordinates of the object, the vertex normal of the object, and the triangle index. The material information of the object includes The color of the object, the gold of the object Attributes and roughness of objects and other information.
需要说明的是,可基于各个物体的空间信息来构建层次包围盒(bounding volume hierarchies,BVH)树,BVH树可用于实现后续的光线追踪操作。具体地,可根据物体的顶点坐标、顶点法线以及三角形索引构建BVH树,可以理解的是,BVH树包含多个包围盒的空间信息,每个包围盒的空间信息包含该包围盒(长方体)的8个顶点的坐标以及8个顶点的垂直高度,每个包围盒用于包围至少一个物体。为了进一步理解前述的BVH树,下文结合图5作进一步的介绍。图5为本申请实施例提供的BVH树的一种示意图,如图5所示,设三维场景中存在6个物体,基于这6个物体的空间信息可确定包围盒A(包围这6个物体)的空间信息,基于其中4个物体的空间信息可确定包围盒B(包围这4个物体)的空间信息,基于剩余2个物体的空间信息可确定包围盒C(包围这2个物体)的空间信息,并将包围盒A的空间信息、包围盒B的空间信息和包围盒C的空间信息以二叉树的结构进行管理,得到BVH树。可见,BVH树可集中管理包围盒A、包围盒B和包围盒C的空间信息,相当于集中管理包围盒A、包围盒B和包围盒C。其中,包围盒A即为所有包围盒中的最大包围盒。It should be noted that hierarchical bounding box (bounding volume hierarchies, BVH) trees can be constructed based on the spatial information of each object, and the BVH tree can be used to implement subsequent ray tracing operations. Specifically, a BVH tree can be constructed based on the object's vertex coordinates, vertex normals, and triangle indexes. It can be understood that the BVH tree contains spatial information of multiple bounding boxes, and the spatial information of each bounding box contains the bounding box (cuboid). The coordinates of the 8 vertices and the vertical height of the 8 vertices, each bounding box is used to surround at least one object. In order to further understand the aforementioned BVH tree, further introduction will be made below in conjunction with Figure 5. Figure 5 is a schematic diagram of the BVH tree provided by the embodiment of the present application. As shown in Figure 5, assuming that there are 6 objects in the three-dimensional scene, the bounding box A (surrounding these 6 objects) can be determined based on the spatial information of these 6 objects. ), the spatial information of bounding box B (surrounding these 4 objects) can be determined based on the spatial information of 4 of the objects, and the spatial information of bounding box C (surrounding these 2 objects) can be determined based on the spatial information of the remaining 2 objects. The spatial information of bounding box A, the spatial information of bounding box B, and the spatial information of bounding box C are managed in a binary tree structure to obtain a BVH tree. It can be seen that the BVH tree can centrally manage the spatial information of bounding box A, bounding box B and bounding box C, which is equivalent to centralized management of bounding box A, bounding box B and bounding box C. Among them, bounding box A is the largest bounding box among all bounding boxes.
基于BVH树实现光线追踪的时候,需要计算光线是否和三维场景中的物体是否相交(即求交计算)。由于BVH树的存在,可基于BVH树确定包围物体的某个包围盒,然后判断光线是否和该包围盒相交,若光线没有碰到该包围盒,表明光线一定不会和该包围盒里的物体相交;如果光线碰到该包围盒,那么再计算光线是否和该包围盒中的物体相交。例如,在检测到光线与二叉树中的B包围盒不相交时,则表示该光线一定不会和B包围盒中的四个物体相交,因此,可以免去检测光线是否与B包围盒中的四个物体相交的步骤,从而仅检测光线是否与C包围盒中的两个物体相交。When implementing ray tracing based on BVH trees, it is necessary to calculate whether the light intersects with objects in the three-dimensional scene (i.e., intersection calculation). Due to the existence of the BVH tree, a bounding box surrounding the object can be determined based on the BVH tree, and then it is determined whether the light intersects the bounding box. If the light does not touch the bounding box, it means that the light will definitely not interact with the object in the bounding box. Intersect; if the light hits the bounding box, then calculate whether the light intersects with the object in the bounding box. For example, when it is detected that the light does not intersect with the B bounding box in the binary tree, it means that the light will definitely not intersect with the four objects in the B bounding box. Therefore, it is unnecessary to detect whether the light ray intersects with the four objects in the B bounding box. The step of intersecting objects, thereby only detecting whether the light intersects two objects in the C bounding box.
此外,还可基于各个物体的材质信息来进行运算,从而得到各个物体的材质信息的无噪声分量,并将各个物体的材质信息的无噪声分量处理成一个可供查询的表格,以实现后续针对物体的图像的解调处理、降噪处理以及调制处理,此处先不展开。In addition, calculations can also be performed based on the material information of each object to obtain the noise-free component of the material information of each object, and the noise-free component of the material information of each object is processed into a table that can be queried to achieve subsequent targeting. The demodulation processing, noise reduction processing and modulation processing of the image of the object will not be discussed here.
(2)相机的空间信息可包括相机的垂直高度以及相机的坐标等等,该相机用于拍摄模拟三维场景的图像。需要说明的是,在实现光线追踪的时候,基于相机的空间信息可确定相机在三维场景中的空间位置。那么,可基于相机的空间位置来确定光线的发射点,即利用相机对三维场景中的各个物体发射光线,来实现路线计算和求交计算,以确定这些光线在三维场景中所形成的光线路径,从而实现后续针对三维场景中各个物体的渲染操作。(2) The spatial information of the camera may include the vertical height of the camera, the coordinates of the camera, etc. The camera is used to capture images that simulate a three-dimensional scene. It should be noted that when implementing ray tracing, the spatial position of the camera in the three-dimensional scene can be determined based on the spatial information of the camera. Then, the emission point of the light can be determined based on the spatial position of the camera, that is, the camera is used to emit rays to each object in the three-dimensional scene to implement route calculation and intersection calculation to determine the light path formed by these light rays in the three-dimensional scene. , thereby realizing subsequent rendering operations for each object in the three-dimensional scene.
(3)光源的空间信息通常用于确定三维场景中的直接光源以及间接光源,直接光源指三维场景中自身会发光的光源,间接光源指三维场景中自身不发光,靠其他光源实现发光的光源,例如,前述的各个物体均可作为间接光源。需要说明的是,在实现光线追踪的时候,若相机所发射的光线,与三维场景中的至少一个物体相交,并在物体的表面上发生反射,最终被直接光源所接收,此类光线所形成的光线路径则为有效的光线路径。那么,对于相机所发射的某些光线,设这些光线首次相交于三维场景中的某个物体,且最终被直接光源所接收(无论中间是否相交于其余物体),则可将这些光线在该物体与直接光源之间所形成的有效的光线路径,作为该物体与直接光源之间的原始光线路径(即对该物体与直接光源之间的光线路径进行了初次采样)。对于三维场景中的其余物体,也可执行类似的操作,故可得到三维场景中各个物体与直接光源之间的原始光线路径。这些原始光线路径,可用于实现后续三维场景中各个物体与直接光源的光线路径的重采样,以及各个物体的图像的渲染。(3) The spatial information of the light source is usually used to determine the direct light source and indirect light source in the three-dimensional scene. The direct light source refers to the light source that emits its own light in the three-dimensional scene. The indirect light source refers to the light source that does not emit its own light in the three-dimensional scene and relies on other light sources to achieve emitting light. , for example, each of the aforementioned objects can be used as an indirect light source. It should be noted that when implementing ray tracing, if the light emitted by the camera intersects with at least one object in the three-dimensional scene, is reflected on the surface of the object, and is finally received by the direct light source, such light will form The ray path is a valid ray path. Then, for some light rays emitted by the camera, assuming that these light rays first intersect with an object in the three-dimensional scene and are finally received by the direct light source (regardless of whether they intersect with other objects in the middle), then these rays can be placed on the object The effective light path formed between the object and the direct light source is used as the original light path between the object and the direct light source (that is, the light path between the object and the direct light source is first sampled). Similar operations can be performed for other objects in the three-dimensional scene, so the original light path between each object in the three-dimensional scene and the direct light source can be obtained. These original light paths can be used to resample the light paths of each object and the direct light source in the subsequent three-dimensional scene, and to render the image of each object.
可见,得到三维场景中各个物体的渲染信息、相机的空间信息以及光源的空间信息后,可基于这些信息来获取各个物体与直接光源(后续简称为光源)之间的原始光线路径。It can be seen that after obtaining the rendering information of each object in the three-dimensional scene, the spatial information of the camera, and the spatial information of the light source, the original light path between each object and the direct light source (hereinafter referred to as the light source) can be obtained based on this information.
由于本实施例针对各个物体所执行的操作是类似的,为了方便说明,下文均以其中一个物体进行示意性介绍,并将该物体称为目标物体。那么,根据前述介绍可知,基于三维场景中各个物体的渲染信息、相机的空间信息以及光源的空间信息,可完成对目标物体与直接光源之间的光线路径的初次采样,从而得到目标物体与光源之间的原始光线路径,且目标物体与光源之间的原始光线路径以目标物体为起点,以光源为终点,中间既可以经过其余物体,也可以不经过其余物体。Since the operations performed on various objects in this embodiment are similar, for convenience of explanation, one of the objects is used as a schematic introduction below, and this object is called the target object. Then, according to the aforementioned introduction, based on the rendering information of each object in the three-dimensional scene, the spatial information of the camera, and the spatial information of the light source, the initial sampling of the light path between the target object and the direct light source can be completed, thereby obtaining the target object and the light source. The original light path between the target object and the light source starts with the target object and ends with the light source. It may or may not pass through other objects in the middle.
值得注意的是,本实施例中所涉及的目标物体与光源之间的原始光线路径,也可以理解为目标物体与光源之间的一组原始光线路径,因为相机所发射的首次相交于目标物体的光线通常有多个,可将这多个光线可称为多个原始光线,也就是一组原始光线。那么,该组原始光线在目标物体与光源之间所形成的一组 光线路径,即为目标物体与光源之间的一组原始光线路径。It is worth noting that the original light path between the target object and the light source involved in this embodiment can also be understood as a set of original light paths between the target object and the light source, because the light emitted by the camera first intersects with the target object. There are usually multiple rays, which can be called multiple original rays, that is, a group of original rays. Then, the set of original rays formed between the target object and the light source The light path is a set of original light paths between the target object and the light source.
402、基于目标物体与光源之间的原始光线路径,对目标物体与光源之间的光线路径进行重采样,以得到新光线路径,新光线路径以光源为起点,以目标物体为终点。402. Based on the original light path between the target object and the light source, resample the light path between the target object and the light source to obtain a new light path. The new light path starts with the light source and ends with the target object.
得到目标物体与光源之间的原始光线路径后,由于目标物体与光源之间的原始光线路径以目标物体为起点,以光源为终点,故可确定目标物体和光源这两个端点,并将二者的性质进行调换,以对二者之间的光线路径进行某种方式的重新构建,即对二者之间的光线路径进行第一重采样,从而得到目标物体与光源之间的第一光线路径(也可以称为间接光线路径),第一光线路径以光源为起点,以目标物体为终点,且中间经过其余物体。After obtaining the original light path between the target object and the light source, since the original light path between the target object and the light source starts with the target object and ends with the light source, the two endpoints of the target object and the light source can be determined, and the two endpoints can be determined. The properties of the two are exchanged to reconstruct the light path between the two in some way, that is, the light path between the two is first resampled to obtain the first light between the target object and the light source. Path (can also be called indirect light path), the first light path starts from the light source, ends at the target object, and passes through other objects in the middle.
具体地,由于第一重采样既可以仅进行一轮次,也可以反复进行多轮次,故可通过多种方式来获取目标物体与光源之间的光线路径之间的第一光线路径:Specifically, since the first resampling can be performed only once or repeatedly for multiple rounds, the first light path between the light path between the target object and the light source can be obtained in a variety of ways:
(1)基于目标物体与光源之间的一组原始光线路径进行第一重采样,可相应得到目标物体与光源之间的一组第一光线路径,该组原始光线路径所包含的多个原始光线路径与该组第一光线路径所包含的多个第一光线路径一一对应。在多个原始光线路径中,对于任意一个原始光线路径而言,设该原始光线路径以目标物体的某个表面点为起点,中间经过一个其余物体的某个表面点,以光源的某个表面点为终点。为了方便说明,下文将该原始光线路径所经过的目标物体的该某个表面点称为第一表面点,将该原始光线路径所经过的其余物体的某个表面点称为第二表面点,将该原始光线路径所经过的光源的某个表面点称为第三表面点。那么,该原始光线路径可以划分为两段路径,第一段路径为第一表面点和第二表面点之间的光线路径,第二段路径为第二表面点和第三表面点之间的光线路径。在针对第一段路径进行第一重采样时,可以其余物体的第二表面点为中心划出一个表面区域,并在该表面区域中选择(例如,可以随机选择,也可以按照某种预置的规则进行选择,此处不做限制)一个表面点,称为第四表面点(第四表面点既可以和第二表面点为同一个表面点,也可以为第二表面点周围的某个表面点,此处不做限制),并将第四表面点与第一表面点连接,构成由第四表面点指向第一表面点的第一段新的路径。同样地,在针对第二段路径进行第一重采样时,可以光源的第三表面点为中心划出一个表面区域,并在该表面区域中选择一个表面点,称为第五表面点(第五表面点既可以和第三表面点为同一个表面点,也可以为第三表面点周围的某个表面点,此处不做限制),并将第五表面点与第四表面点连接,构成由第五表面点指向第四表面点的第二段新的路径。如此一来,第一段新的路径和第二段新的路径,则构成了该原始光线路径所对应的第一光线路径,该第一光线路径以第五表面点为起点,中间经过第四表面点,以第一表面点为终点。对于多个原始光线路径中除该原始光线路径之外的其余原始光线路径,也可对其余原始路径执行如同对该原始光线路径所执行的操作,故可得到与多个原始光线路径一一对应的多个第一光线路径,即目标物体与光源之间的一组第一光线路径。(1) Perform the first resampling based on a set of original light paths between the target object and the light source, and accordingly obtain a set of first light paths between the target object and the light source. The set of original light paths includes multiple original light paths. The light path corresponds one-to-one to a plurality of first light paths included in the group of first light paths. Among multiple original light paths, for any original light path, assume that the original light path starts from a certain surface point of the target object, passes through a certain surface point of other objects in the middle, and ends with a certain surface of the light source. point is the end point. For the convenience of explanation, below, a certain surface point of the target object passed by the original light path is called a first surface point, and a certain surface point of the other objects passed by the original light path is called a second surface point. A certain surface point of the light source that the original light path passes through is called a third surface point. Then, the original light path can be divided into two paths. The first path is the light path between the first surface point and the second surface point, and the second path is the light path between the second surface point and the third surface point. Light path. When performing the first resampling for the first path, a surface area can be drawn centered on the second surface point of the remaining object, and selected in the surface area (for example, it can be selected randomly or according to a certain preset Select according to the rules, no restrictions are made here) A surface point is called the fourth surface point (the fourth surface point can be the same surface point as the second surface point, or it can be a certain point around the second surface point. surface point (not limited here), and connect the fourth surface point with the first surface point to form a first new path from the fourth surface point to the first surface point. Similarly, when performing the first resampling for the second path, a surface area can be drawn centered on the third surface point of the light source, and a surface point is selected in the surface area, called the fifth surface point (the fifth surface point). The fifth surface point can be the same surface point as the third surface point, or it can be a surface point around the third surface point, there is no restriction here), and connect the fifth surface point with the fourth surface point, A second new path is formed from the fifth surface point to the fourth surface point. In this way, the first new path and the second new path constitute the first light path corresponding to the original light path. The first light path starts from the fifth surface point and passes through the fourth surface point in the middle. Surface points, with the first surface point as the end point. For the remaining original light paths except this original light path among the multiple original light paths, the same operations as the operations performed on the original light path can also be performed on the remaining original light paths, so a one-to-one correspondence with the multiple original light paths can be obtained. A plurality of first light paths, that is, a set of first light paths between the target object and the light source.
应理解,前述例子仅以原始光线路径中间经过一个其余物体进行示意性介绍,并不对原始光线路径中间所经过的其余物体的数量构成限制,若原始光线路径中间经过多个其余物体,对原始光线路径所进行的第一重采样操作也是类似的,此处不再赘述。相应地,基于中间经过多个其余物体的原始光线路径所得到的第一光线路径,中间也就可经过多个其余物体。为了进一步理解前述第一重采样的过程,下文结合图6所示的例子做进一步的说明介绍。图6为本申请实施例提供的光线路径重采样的一个示意图,如图6所示,在对某个房间进行光线追踪时,设相机100向桌子200发射了一组原始光线,取其中一个原始光线进行示意性介绍。设该原始光线从相机100出发后,首先击中桌子200的表面点A,反射后击中墙壁300的表面点B,再次反射后击中灯罩400的表面点C,再次反射后击中光源500的表面点D,故该原始光线在桌子200和光源500之间的原始光线路径包含三段路径,第一段路径601由表面点A指向表面点B,第二段路径602由表面点B指向表面点C,第三段路径603由表面点C指向表面点D。那么,可在墙壁300上取表面点B周围的表面点E,并构建由表面点E指向表面点A的第一段新的路径604,接着保持灯罩400上的表面点C不变,并构建由表面点C指向表面点E的第二段新的路径605,然后在光源500上取表面点D周围的表面点F,并构建由表面点F指向表面点C的第三段新的路径606。如此一来,这三段新的路径则构成了一个第一光线路径。可以理解的是,对于相机100射向桌子200的其余原始光线所形成的原始光线路径,也可执行类似的操作,故可得到桌子200与光源500之间的多个第一光线路径,即桌子200与光源500之间的一组第一光线路径。 It should be understood that the foregoing example only uses one other object passing through the middle of the original light path for schematic introduction, and does not limit the number of other objects passing through the original light path. If the original light path passes through multiple other objects, the original light path will not be affected. The first resampling operation performed on the path is also similar and will not be described again here. Correspondingly, based on the first light path obtained from the original light paths passing through a plurality of other objects in the middle, a plurality of other objects can also be passed in the middle. In order to further understand the foregoing first resampling process, further explanation will be given below with reference to the example shown in FIG. 6 . Figure 6 is a schematic diagram of light path resampling provided by an embodiment of the present application. As shown in Figure 6, when performing ray tracing in a certain room, assume that the camera 100 emits a set of original light rays to the table 200, and select one of the original light rays. Light is introduced schematically. Assume that after starting from the camera 100, the original light first hits the surface point A of the table 200, then hits the surface point B of the wall 300 after reflection, hits the surface point C of the lampshade 400 after reflection again, and hits the light source 500 after reflection again. Surface point D, so the original light path of the original light between the table 200 and the light source 500 includes three paths. The first path 601 points from surface point A to surface point B, and the second path 602 points from surface point B. Surface point C, the third path 603 is directed from surface point C to surface point D. Then, you can take the surface point E around the surface point B on the wall 300, and construct the first new path 604 from the surface point E to the surface point A, and then keep the surface point C on the lampshade 400 unchanged, and construct A second new path 605 from surface point C to surface point E, then take the surface point F around surface point D on the light source 500, and construct a third new path 606 from surface point F to surface point C. . In this way, these three new paths constitute a first ray path. It can be understood that similar operations can also be performed on the original light paths formed by the remaining original light rays emitted by the camera 100 towards the table 200, so that multiple first light paths between the table 200 and the light source 500 can be obtained, that is, the table A first set of light paths between 200 and light source 500 .
(2)重复执行多轮次的(1),从而得到目标物体与光源之间的多组第一光线路径,即在基于目标物体与光源之间的一组原始光线路径进行第一重采样,相应得到目标物体与光源之间的一组第一光线路径后,可再次基于目标物体与光源之间的一组原始光线路径进行第一重采样,可相应得到目标物体与光源之间的另一组第一光线路径,以此类推,执行多轮次的第一重采样后,可得到目标物体与光源之间的多组第一光线路径。(2) Repeat (1) for multiple rounds to obtain multiple sets of first light paths between the target object and the light source, that is, perform the first resampling based on a set of original light paths between the target object and the light source, After correspondingly obtaining a set of first light paths between the target object and the light source, the first resampling can be performed again based on a set of original light paths between the target object and the light source, and another corresponding set of light paths between the target object and the light source can be obtained. A set of first light paths, and so on, after performing multiple rounds of first resampling, multiple sets of first light paths between the target object and the light source can be obtained.
此外,得到目标物体与光源之间的原始光线路径后,还基于二者的原始光线路径,对二者之间的光线路径进行另外一种方式的重新构建,即对二者之间的光线路径进行第一重采样,从而得到目标物体与光源之间的第二光线路径(也可以称为直接光线路径),第二光线路径以光源为起点,以目标物体为终点,且中间不经过其余物体。In addition, after obtaining the original light path between the target object and the light source, the light path between the two is reconstructed in another way based on the original light path between the two, that is, the light path between the two is reconstructed. Perform the first resampling to obtain the second light path between the target object and the light source (which can also be called the direct light path). The second light path starts from the light source and ends with the target object, and does not pass through other objects in the middle. .
具体地,由于第二重采样既可以仅进行一轮次,也可以反复进行多轮次,故可通过多种方式来获取目标物体与光源之间的光线路径之间的第二光线路径:Specifically, since the second resampling can be performed only once or repeatedly for multiple rounds, the second light path between the light path between the target object and the light source can be obtained in a variety of ways:
(1)基于目标物体与光源之间的一组原始光线路径进行第二重采样,可相应得到目标物体与光源之间的一组第二光线路径,该组原始光线路径所包含的多个原始光线路径与该组第二光线路径所包含的多个第二光线路径一一对应。在多个原始光线路径中,对于任意一个原始光线路径而言,设该原始光线路径以目标物体的某个表面点为起点,以光源的某个表面点为终点。为了方便说明,下文将该原始光线路径所经过的目标物体的该某个表面点称为第一表面点,将该原始光线路径所经过的光源的某个表面点称为第二表面点。那么,在针对该原始光线路径进行第二重采样时,可以光源的第二表面点为中心划出一个表面区域,并在该表面区域中选择(例如,可以随机选择,也可以按照某种预置的规则进行选择,此处不做限制)一个表面点,称为第三表面点(第三表面点既可以和第二表面点为同一个表面点,也可以为第二表面点周围的某个表面点,此处不做限制),并将第三表面点与第一表面点连接,构成由第三表面点指向第一表面点的第二光线路径。该第二光线路径以第三表面点为起点,中间不经过其余物体的表面点,以第一表面点为终点。对于多个原始光线路径中除该原始光线路径之外的其余原始光线路径,也可对其余原始路径执行如同对该原始光线路径所执行的操作,故可得到与多个原始光线路径一一对应的多个第二光线路径,即目标物体与光源之间的一组第二光线路径。(1) The second resampling is performed based on a set of original light paths between the target object and the light source, and a set of second light paths between the target object and the light source can be obtained accordingly. The set of original light paths contains multiple original light paths. The light path has a one-to-one correspondence with the plurality of second light paths included in the set of second light paths. Among the multiple original light paths, for any original light path, let the original light path take a certain surface point of the target object as the starting point and a certain surface point of the light source as the end point. For convenience of explanation, below, the certain surface point of the target object that the original light path passes through is called a first surface point, and the certain surface point of the light source that the original light path passes through is called a second surface point. Then, when performing the second resampling for the original light path, a surface area can be drawn centered on the second surface point of the light source, and selected in the surface area (for example, it can be randomly selected, or it can be selected according to some predetermined The selection is based on the placement rules, and there are no restrictions here.) A surface point is called the third surface point (the third surface point can be the same surface point as the second surface point, or it can be a certain point around the second surface point. surface points (not limited here), and connect the third surface point with the first surface point to form a second light path from the third surface point to the first surface point. The second light path starts from the third surface point, does not pass through the surface points of other objects in the middle, and ends at the first surface point. For the remaining original light paths except this original light path among the multiple original light paths, the same operations as the operations performed on the original light path can also be performed on the remaining original light paths, so a one-to-one correspondence with the multiple original light paths can be obtained. A plurality of second light paths, that is, a set of second light paths between the target object and the light source.
(2)重复执行多轮次的(1),从而得到目标物体与光源之间的多组第二光线路径,即在基于目标物体与光源之间的一组原始光线路径进行第二重采样,相应得到目标物体与光源之间的一组第二光线路径后,可再次基于目标物体与光源之间的一组原始光线路径进行第二重采样,可相应得到目标物体与光源之间的另一组第二光线路径,以此类推,执行多轮次的第二重采样后,可得到目标物体与光源之间的多组第二光线路径。(2) Repeat (1) for multiple rounds to obtain multiple sets of second light paths between the target object and the light source, that is, perform a second resampling based on a set of original light paths between the target object and the light source, After a set of second light paths between the target object and the light source is obtained, a second resampling can be performed based on a set of original light paths between the target object and the light source, and another set of light paths between the target object and the light source can be obtained accordingly. A set of second light paths, and by analogy, after performing multiple rounds of second resampling, multiple sets of second light paths between the target object and the light source can be obtained.
403、基于目标物体与光源之间的新光线路径,获取样本池,样本池用于指示射向目标物体的光线,新光线路径由这些光线形成。403. Based on the new light path between the target object and the light source, obtain a sample pool. The sample pool is used to indicate the light rays directed to the target object, and the new light path is formed by these light rays.
得到目标物体与光源之间的第一光线路径,也就相当于得到了目标物体与光源之间的第一光线(也可以称为间接光线),第一光线为形成第一光线路径的光线,可视为从光源射出,中间击中其余物体,发生反射后击中目标物体,再反射后被相机所接收的光线。Obtaining the first light path between the target object and the light source is equivalent to obtaining the first light (also called indirect light) between the target object and the light source. The first light is the light that forms the first light path. It can be regarded as light that is emitted from the light source, hits other objects in the middle, hits the target object after reflection, and is received by the camera after reflection.
那么,可获取与第一光线相关的信息,从而利用这些信息来构建第一样本池。例如,可获取第一光线在击中其余物体之后且击中目标物体之前的光强值(如,第一光线的亮度和颜色等等),并将第一光线在击中其余物体之后且击中目标物体之前的光强值存储在第一样本池中。如此一来,第一样本池可用于指示射向目标物体的第一光线。Then, information related to the first ray can be obtained, and the information can be used to construct the first sample pool. For example, the light intensity value (such as the brightness and color of the first light, etc.) of the first light after hitting other objects and before hitting the target object can be obtained, and the first light after hitting other objects and before hitting the target object can be obtained. The light intensity value before hitting the target object is stored in the first sample pool. In this way, the first sample cell can be used to indicate the first light ray directed to the target object.
具体地,可通过多种方式来获取第一样本池:Specifically, the first sample pool can be obtained in various ways:
(1)若仅得到目标物体与光源之间的一组第一光线路径,由于一个第一光线路径由一个第一光线形成,故该组第一光线路径由一组第一光线形成。由于该组第一光线形包含多个第一光线,故可利用与这多个第一光线相关的信息,来构建一个第一样本池(例如,将这多个第一光线在击中其余物体之后且击中目标物体之前的光强值存储在一个第一样本池中),故该第一样本池可用于指示射向目标物体的该组第一光线。依旧如上述例子,得到目标物体与光源之间的一组第一光线路径后,对于第一段新的路径604、第二段新的路径605以及第三段新的路径606所构成的第一光线路径,可获取形成该第一光线路径的第一光线在击中灯罩和墙壁后且击中桌子前的光强值,并存储在第一样本池中。同样地,在桌子与光源之间的该组 第一光线路径中,除该第一光线路径之外,可获取形成其余第一光线路径的其余第一光线在击中其余物体后且击中桌子前的光强值,并存储在第一样本池中。如此一来,可得到一个完整的第一样本池,该第一样本池用于指示射向桌子的一组第一光线。(1) If only a set of first light paths between the target object and the light source are obtained, since one first light path is formed by one first light ray, the set of first light paths is formed by a set of first light rays. Since the group of first ray shapes includes a plurality of first rays, information related to the plurality of first rays can be used to construct a first sample pool (for example, the plurality of first rays are used to hit other first rays). The light intensity value after the object and before hitting the target object is stored in a first sample pool), so the first sample pool can be used to indicate the group of first rays that hit the target object. Still as in the above example, after obtaining a set of first light paths between the target object and the light source, the first new path 604, the second new path 605, and the third new path 606 constitute the first new path. For the light path, the light intensity value of the first light that forms the first light path after hitting the lampshade and the wall and before hitting the table can be obtained and stored in the first sample pool. Likewise, the group between the table and the light source In the first light path, in addition to the first light path, the light intensity values of the other first light rays that form the other first light paths after hitting other objects and before hitting the table can be obtained and stored in the first light path. in this pool. In this way, a complete first sample cell is obtained, which is used to indicate a set of first rays hitting the table.
进一步地,可控制该组第一光线在击中目标物体后所产生的现象为以下其中一种:漫反射、镜面反射或者高光反射,相应地,该第一样本池对应于某一种渲染效果,该渲染效果可呈现为以下其中一种:漫反射、镜面反射或者高光反射。例如,若该组第一光线在击中目标物体后所产生的现象为漫反射,该第一样本池对应的渲染效果呈现为漫反射等等。Further, the phenomenon produced by the group of first rays after hitting the target object can be controlled to be one of the following: diffuse reflection, specular reflection or specular reflection. Correspondingly, the first sample pool corresponds to a certain kind of rendering. Effect, the rendering effect can appear as one of the following: diffuse reflection, specular reflection, or specular reflection. For example, if the phenomenon produced by the first set of rays after hitting the target object is diffuse reflection, the rendering effect corresponding to the first sample pool will appear as diffuse reflection, and so on.
(2)若得到目标物体与光源之间的多组第一光线路径,这多组第一光线路径由多组第一光线形成(二者一一对应)。对于多组第一光线中的任意一组第一光线而言,由于该组第一光线形包含多个第一光线,故可利用与这多个第一光线相关的信息,来构建一个第一样本池(例如,将这多个第一光线在击中其余物体之后且击中目标物体之前的光强值存储在一个第一样本池中)。同样地,对于其余组第一光线,也可执行如同对该组第一光线所执行的操作,故最终可得到多个第一样本池,一个第一样本池用于指示射向目标物体的一组第一光线。(2) If multiple sets of first light paths between the target object and the light source are obtained, these multiple sets of first light paths are formed by multiple sets of first light rays (one-to-one correspondence between the two). For any group of first rays among multiple groups of first rays, since the group of first ray shapes includes multiple first rays, information related to the multiple first rays can be used to construct a first ray shape. Sample pool (for example, the light intensity values of the plurality of first rays after hitting other objects and before hitting the target object are stored in a first sample pool). Similarly, for the remaining groups of first rays, the same operations as for the group of first rays can also be performed, so that multiple first sample pools can finally be obtained, and one first sample pool is used to indicate the target object. of a set of first rays.
进一步地,对于多组第一光线中的任意一组第一光线,可控制该组第一光线在击中目标物体后所产生的现象为以下其中一种:漫反射、镜面反射或者高光反射。需要说明的是,多组第一光线在击中目标物体后所产生的现象既可以相同,也可以不同,此处不做限定。相应地,对于多个第一样本池中的任意一个第一样本池,该第一样本池对应于某一种渲染效果,该渲染效果可呈现为以下其中一种:漫反射、镜面反射或者高光反射。需要说明的是,多个第一样本池所对应的渲染效果既可以相同,也可以不同,此处不做限定。例如,一种常规的样本池配置可以为:构建两个第一样本池,第一个第一样本池对应的渲染效果呈现为镜面反射,第二个第一样本池对应的渲染效果为高光反射。Further, for any group of first rays among the plurality of groups of first rays, the phenomenon produced by the group of first rays after hitting the target object can be controlled to be one of the following: diffuse reflection, specular reflection, or specular reflection. It should be noted that the phenomena produced by the multiple sets of first light rays after hitting the target object may be the same or different, and are not limited here. Correspondingly, for any first sample pool among the plurality of first sample pools, the first sample pool corresponds to a certain rendering effect, and the rendering effect can be presented as one of the following: diffuse reflection, specular reflection Reflection or specular reflection. It should be noted that the rendering effects corresponding to the multiple first sample pools may be the same or different, and are not limited here. For example, a conventional sample pool configuration can be: construct two first sample pools, the rendering effect corresponding to the first first sample pool is presented as specular reflection, and the rendering effect corresponding to the second first sample pool is For high light reflection.
更进一步地,无论是在情况(1)中还是在情况(2)中,对于任意一个第一样本池(也可以理解为一个第一样本图像),该第一样本池可包含一组第一光线在击中其余物体之后且击中目标物体之前的光强值,那么,该第一样本池的尺寸(第一样本图像的分辨率)则为这些光强值的数量,也就是该组第一光线的数量(也就是说,第一样本池的尺寸(第一样本图像的分辨率),即为第一样本池所指示的第一光线的数量)。值得注意的是,该第一样本池的尺寸小于屏幕的分辨率(即屏幕所显示的像素的数量),该屏幕用于显示最终的目标物体的图像。Furthermore, whether in case (1) or case (2), for any first sample pool (which can also be understood as a first sample image), the first sample pool may include a The light intensity values of the group of first rays after hitting other objects and before hitting the target object, then the size of the first sample pool (the resolution of the first sample image) is the number of these light intensity values, That is, the number of the first rays of the group (that is, the size of the first sample pool (the resolution of the first sample image) is the number of the first rays indicated by the first sample pool). It is worth noting that the size of the first sample pool is smaller than the resolution of the screen (that is, the number of pixels displayed on the screen), and the screen is used to display the final image of the target object.
此外,得到目标物体与光源之间的第二光线路径,也就相当于得到了目标物体与光源之间的第二光线(也可以称为直接光线),第二光线为形成第二光线路径的光线,可视为从光源射出,中间未击中其余物体,直接击中目标物体,再反射后被相机所接收的光线。In addition, obtaining the second light path between the target object and the light source is equivalent to obtaining the second light ray (also called direct light) between the target object and the light source. The second light ray forms the second light ray path. Light can be regarded as light emitted from the light source, without hitting other objects in the middle, but directly hitting the target object, and then reflected by the light received by the camera.
那么,可获取与第二光线相关的信息,从而利用这些信息来构建第二样本池。例如,可获取第二光线在击中目标物体之前的光强值(如,第二光线的亮度和颜色等等),并将第二光线在击中目标物体之前的光强值存储在第二样本池中。如此一来,第二样本池可用于指示射向目标物体的第二光线。Then, information related to the second ray can be obtained and used to construct the second sample pool. For example, the light intensity value of the second light ray before it hits the target object (such as the brightness and color of the second light ray, etc.) can be obtained, and the light intensity value of the second light ray before it hits the target object can be stored in the second in the sample pool. In this way, the second sample cell can be used to indicate the second light ray directed to the target object.
具体地,可通过多种方式来获取第二样本池:Specifically, the second sample pool can be obtained in various ways:
(1)若仅得到目标物体与光源之间的一组第二光线路径,由于一个第二光线路径由一个第二光线形成,故该组第二光线路径由一组第二光线形成。由于该组第二光线形包含多个第二光线,故可利用与这多个第二光线相关的信息,来构建一个第二样本池(例如,将这多个第二光线在击中目标物体之前的光强值存储在一个第二样本池中),故该第二样本池可用于指示射向目标物体的该组第二光线。(1) If only a set of second ray paths between the target object and the light source are obtained, since one second ray path is formed by one second ray, the set of second ray paths is formed by a set of second rays. Since the set of second ray shapes includes a plurality of second rays, information related to the plurality of second rays can be used to construct a second sample pool (for example, the plurality of second rays are used to hit the target object The previous light intensity value is stored in a second sample cell), so the second sample cell can be used to indicate the set of second light rays emitted to the target object.
(2)若得到目标物体与光源之间的多组第二光线路径,这多组第二光线路径由多组第二光线形成(二者一一对应)。对于多组第二光线中的任意一组第二光线而言,由于该组第二光线形包含多个第二光线,故可利用与这多个第二光线相关的信息,来构建一个第二样本池(例如,将这多个第二光线在击中目标物体之前的光强值存储在一个第二样本池中)。同样地,对于其余组第二光线,也可执行如同对该组第二光线所执行的操作,故最终可得到多个第二样本池,一个第二样本池用于指示射向目标物体的一组第二光线。(2) If multiple sets of second light paths between the target object and the light source are obtained, these multiple sets of second light paths are formed by multiple sets of second light rays (one-to-one correspondence between the two). For any group of second rays among the plurality of groups of second rays, since the group of second ray shapes includes a plurality of second rays, information related to the plurality of second rays can be used to construct a second ray shape. Sample pool (for example, store the light intensity values of the plurality of second rays before hitting the target object in a second sample pool). Similarly, for the remaining sets of second rays, the same operations as for the set of second rays can also be performed, so that multiple second sample pools can finally be obtained, and one second sample pool is used to indicate a beam emitted to the target object. Set the second ray.
进一步地,无论是在情况(1)中还是在情况(2)中,对于任意一个第二样本池(也可以理解为一个第二样本图像),该第二样本池可包含一组第二光线在击中目标物体之前的光强值,那么,该第二样本池的尺寸(第二样本图像的分辨率)则为这些光强值的数量,也就是该组第二光线的数量(也就是说,第二 样本池的尺寸(第二样本图像的分辨率),即为第二样本池所指示的第二光线的数量)。值得注意的是,该第二样本池的尺寸等于屏幕的分辨率(即屏幕所显示的像素的数量),该屏幕用于显示最终的目标物体的图像。Further, whether in case (1) or case (2), for any second sample pool (which can also be understood as a second sample image), the second sample pool may contain a set of second rays The light intensity value before hitting the target object, then the size of the second sample pool (the resolution of the second sample image) is the number of these light intensity values, that is, the number of the second ray group (that is, Say, second The size of the sample pool (the resolution of the second sample image) is the number of second rays indicated by the second sample pool). It is worth noting that the size of the second sample pool is equal to the resolution of the screen (that is, the number of pixels displayed on the screen), and the screen is used to display the final image of the target object.
404、基于样本池,对目标物体进行渲染,以得到目标物体的图像。404. Based on the sample pool, render the target object to obtain an image of the target object.
得到第一样本池后,可利用第一样本池,对目标物体进行渲染,从而得到目标物体的图像。那么,目标物体的图像即为送显的图像,可在屏幕上进行显示,以供用户观看和使用。After obtaining the first sample pool, the first sample pool can be used to render the target object, thereby obtaining an image of the target object. Then, the image of the target object is the displayed image, which can be displayed on the screen for the user to view and use.
具体地,可通过以下方式来获取目标物体的图像:Specifically, the image of the target object can be obtained in the following ways:
(1)基于第一样本池对目标物体进行渲染,得到目标物体的间接光照图像。需要说明的是,由于可以得到至少一个第一样本池(例如,前述情况(1)中仅得到一个第一样本池,又如,前述情况(2)中得到多个第一样本池),可对至少一个第一样本池分别进行着色(例如,光照运算等等),得到目标物体的至少一个间接光照图像(例如,对应于情况前述(1),可得到目标物体的一个间接光照图像,又如,对应于前述情况(2),可得到目标物体的多个间接光照图像)。(1) Render the target object based on the first sample pool to obtain the indirect lighting image of the target object. It should be noted that since at least one first sample pool can be obtained (for example, in the aforementioned case (1), only one first sample pool is obtained, and for example, in the aforementioned case (2), multiple first sample pools are obtained ), the at least one first sample pool can be colored (for example, lighting operation, etc.) respectively, and at least one indirect lighting image of the target object can be obtained (for example, corresponding to the aforementioned situation (1), an indirect lighting image of the target object can be obtained Illumination image, for another example, corresponding to the aforementioned situation (2), multiple indirect illumination images of the target object can be obtained).
(2)基于第二样本池对目标物体进行渲染,得到目标物体的直接光照图像。需要说明的是,由于可以得到至少一个第二样本池(例如,前述情况(1)中仅得到一个第二样本池,又如,前述情况(2)中得到多个第二样本池),可对至少一个第二样本池分别进行着色(例如,光照运算等等),得到目标物体的至少一个直接光照图像(例如,对应于情况前述(1),可得到目标物体的一个直接光照图像,又如,对应于前述情况(2),可得到目标物体的多个直接光照图像)。(2) Render the target object based on the second sample pool to obtain the direct illumination image of the target object. It should be noted that since at least one second sample pool can be obtained (for example, in the aforementioned case (1), only one second sample pool is obtained, and for example, in the aforementioned case (2), multiple second sample pools are obtained), it can be Perform coloring (for example, lighting operation, etc.) on at least one second sample pool respectively to obtain at least one direct lighting image of the target object (for example, corresponding to the aforementioned situation (1), a direct lighting image of the target object can be obtained, and For example, corresponding to the aforementioned situation (2), multiple direct illumination images of the target object can be obtained).
(3)对间接光照图像以及直接光照图像进行融合,得到目标物体的图像。需要说明的是,得到目标物体的至少一个间接光照图像以及目标物体的至少一个直接光照图像后,可将这多个图像视为多个图层,故可对目标物体的至少一个间接光照图像以及目标物体的至少一个直接光照图像进行叠加,得到最终可送显的目标物体的图像。(3) Fusion of the indirect illumination image and the direct illumination image to obtain the image of the target object. It should be noted that after obtaining at least one indirect illumination image of the target object and at least one direct illumination image of the target object, these multiple images can be regarded as multiple layers, so at least one indirect illumination image of the target object and the At least one direct illumination image of the target object is superimposed to obtain the final image of the target object that can be displayed.
进一步地,为了获取更优质的目标物体的图像,可提前对用于合成目标物体的图像的各个图层进行一定的处理:Furthermore, in order to obtain a higher-quality image of the target object, certain processing can be performed on each layer used to synthesize the image of the target object in advance:
(1)获取目标物体的材质信息的无噪声分量。需要说明的是,在对各个图层进行处理前,可先从前述的表格中获取目标物体的材质信息的无噪声分分量。(1) Obtain the noise-free component of the material information of the target object. It should be noted that before processing each layer, the noise-free component of the material information of the target object can be obtained from the aforementioned table.
(2)基于目标物体的材质信息的无噪声分量对目标物体的间接光照图像进行第一处理,得到处理后的间接光照图像,第一处理包含解调处理、降噪处理以及调制处理。需要说明的是,得到目标物体的材质信息的无噪声分量后,可将目标物体的至少一个间接光照图像除以该无噪声分量,得到目标物体的解调后的至少一个间接光照图像。得到目标物体的解调后的至少一个间接光照图像后,可对目标物体的解调后的至少一个间接光照图像进行降噪,得到目标物体的降噪后的至少一个间接光照图像。得到目标物体的降噪后的至少一个间接光照图像后,可将目标物体的降噪后的至少一个间接光照图像乘以该无噪声分量,得到目标物体的调制后的至少一个间接光照图像。(2) Perform first processing on the indirect illumination image of the target object based on the noise-free component of the material information of the target object to obtain a processed indirect illumination image. The first processing includes demodulation processing, noise reduction processing, and modulation processing. It should be noted that after obtaining the noise-free component of the material information of the target object, at least one indirect illumination image of the target object can be divided by the noise-free component to obtain at least one demodulated indirect illumination image of the target object. After obtaining at least one demodulated indirect illumination image of the target object, the at least one demodulated indirect illumination image of the target object can be denoised to obtain at least one denoised indirect illumination image of the target object. After obtaining at least one denoised indirect illumination image of the target object, the at least one denoised indirect illumination image of the target object can be multiplied by the noise-free component to obtain at least one modulated indirect illumination image of the target object.
由于至少一个第一样本池的尺寸小于屏幕的分辨率,故目标物体的调制后的至少一个间接光照图像的分辨率也小于屏幕的分辨率。为了各个图层实现更好的融合,得到目标物体的调制后的至少一个间接光照图像后,还可对目标物体的调制后的至少一个间接光照图像进行超分处理,从而得到目标物体的处理后的至少一个间接光照图像,此时,目标物体的处理后的至少一个间接光照图像的分辨率等于屏幕的分辨率。Since the size of the at least one first sample pool is smaller than the resolution of the screen, the resolution of the modulated at least one indirect illumination image of the target object is also smaller than the resolution of the screen. In order to achieve better integration of each layer, after obtaining at least one modulated indirect illumination image of the target object, super-resolution processing can also be performed on at least one modulated indirect illumination image of the target object, thereby obtaining the processed image of the target object. At least one indirect illumination image, at this time, the resolution of the at least one indirect illumination image after processing of the target object is equal to the resolution of the screen.
(3)基于目标物体的材质信息的无噪声分量对目标物体的直接光照图像进行第二处理,得到处理后的直接光照图像,第二处理包含解调处理、降噪处理以及调制处理。需要说明的是,得到目标物体的材质信息的无噪声分量后,可将目标物体的至少一个直接光照图像除以该无噪声分量,得到目标物体的解调后的至少一个直接光照图像。得到目标物体的解调后的至少一个直接光照图像后,可对目标物体的解调后的至少一个直接光照图像进行降噪,得到目标物体的降噪后的至少一个直接光照图像。得到目标物体的降噪后的至少一个直接光照图像后,可将目标物体的降噪后的至少一个直接光照图像乘以该无噪声分量,得到目标物体的调制后的至少一个直接光照图像,即目标物体的处理后的至少一个直接光照图像。(3) Perform second processing on the direct illumination image of the target object based on the noise-free component of the material information of the target object to obtain a processed direct illumination image. The second processing includes demodulation processing, noise reduction processing, and modulation processing. It should be noted that after obtaining the noise-free component of the material information of the target object, at least one direct illumination image of the target object can be divided by the noise-free component to obtain at least one demodulated direct illumination image of the target object. After obtaining at least one demodulated direct illumination image of the target object, the at least one demodulated direct illumination image of the target object can be denoised to obtain at least one denoised direct illumination image of the target object. After obtaining at least one direct illumination image of the target object after denoising, the at least one direct illumination image after denoising of the target object can be multiplied by the noise-free component to obtain at least one modulated direct illumination image of the target object, that is, At least one processed direct illumination image of the target object.
(4)对处理后的间接光照图像以及处理后的直接光照图像进行融合,得到目标物体的图像。需要说明的是,得到目标物体的处理后的至少一个间接光照图像以及目标物体的处理后的至少一个直接光照图像后,可将目标物体的处理后的至少一个间接光照图像以及目标物体的处理后的至少一个直接光照图像进行 叠加,从而得到最终可送显的目标物体的图像。(4) Fusion of the processed indirect illumination image and the processed direct illumination image to obtain the image of the target object. It should be noted that, after obtaining at least one processed indirect illumination image of the target object and at least one processed direct illumination image of the target object, the at least one processed indirect illumination image of the target object and the processed at least one direct illumination image of the target object can be obtained. of at least one directly illuminated image Overlay to obtain the final image of the target object that can be displayed.
需要说明的是,本实施例中,间接光照图像即为前述的第一光照图像,直接光照图像即为前述的第二光照图像,处理后的间接光照图像即为前述的处理后的第一光照图像,处理后的直接光照图像即为前述的处理后的第二光照图像。It should be noted that in this embodiment, the indirect illumination image is the aforementioned first illumination image, the direct illumination image is the aforementioned second illumination image, and the processed indirect illumination image is the aforementioned processed first illumination image. Image, the processed direct illumination image is the aforementioned processed second illumination image.
为了进一步理解本申请实施例提供的图像渲染方法,下文提供一个具体应用例对该方法做进一步的介绍。图7为本申请实施例提供的图像渲染方法的一个应用例示意图,如图7所示,该应用例主要用于为用户展示虚拟车展,该应用例包括:In order to further understand the image rendering method provided by the embodiment of the present application, a specific application example is provided below to further introduce the method. Figure 7 is a schematic diagram of an application example of the image rendering method provided by the embodiment of the present application. As shown in Figure 7, this application example is mainly used to display a virtual auto show for users. The application example includes:
(1)对车展内的物体(例如,车辆、地板等等)与光源之间的光线路径进行重采样,得到间接光线路径和直接光线路径。(1) Resample the light path between the objects in the auto show (for example, vehicles, floors, etc.) and the light source to obtain indirect light paths and direct light paths.
(2)基于直接光线路径构建第一类样本池,第一类样本池包含1个样本池,该样本池对应的渲染效果为直接光照,且该样本池的尺寸与屏幕的尺寸(分辨率)一样大,例如,屏幕的分辨率为1920*1080,则该样本池的尺寸为1920*1080,该屏幕用于显示虚拟车展的图像。基于间接光线路径构建第二类样本池,第二类样本池包含n个样本池,第1个样本池对应的渲染效果为镜面反射,第2个样本池对应的渲染效果为高光反射,第3个样本池对应的渲染效果为漫反射,...,第n个样本池对应的渲染效果为镜面反射,这n个样本池中,每个样本池的尺寸为屏幕的尺寸的1/4,即每个样本池的尺寸为480*270。(2) Construct the first type of sample pool based on the direct light path. The first type of sample pool contains 1 sample pool. The corresponding rendering effect of this sample pool is direct lighting, and the size of the sample pool is consistent with the size (resolution) of the screen. For example, if the resolution of the screen is 1920*1080, the size of the sample pool is 1920*1080, and the screen is used to display images of the virtual auto show. The second type of sample pool is constructed based on the indirect light path. The second type of sample pool contains n sample pools. The rendering effect corresponding to the first sample pool is specular reflection, the rendering effect corresponding to the second sample pool is specular reflection, and the rendering effect corresponding to the third sample pool is specular reflection. The rendering effect corresponding to the sample pools is diffuse reflection,..., and the rendering effect corresponding to the nth sample pool is specular reflection. Among these n sample pools, the size of each sample pool is 1/4 of the screen size. That is, the size of each sample pool is 480*270.
(3)基于第一类样本池进行渲染,得到直接光照图像,该图像用于呈现相机直接可见的物体。(3) Render based on the first type of sample pool to obtain a direct illumination image, which is used to present objects directly visible to the camera.
(4)基于第二类样本进行渲染,得到间接光照图像,该图像用于在可见物体的基础上,进一步呈现镜面反射、高光反射等效果。(4) Render based on the second type of sample to obtain an indirect lighting image. This image is used to further present effects such as specular reflection and highlight reflection on the basis of visible objects.
(5)步骤(3)所得到的图像是带有噪声的,需要进行降噪处理。降噪的过程主要包含3个步骤,如图8所示(图8为本申请实施例提供的降噪过程的一个示意图):a、计算车展内的物体的材质信息的无噪声分量;b、将骤(3)所得到的图像除以该无噪声分量;c、再对相除后的结果进行降噪,然后对降噪后的结果乘以该无噪声分量,得到去除噪声后的直接光照图像。(5) The image obtained in step (3) is noisy and requires noise reduction processing. The noise reduction process mainly includes three steps, as shown in Figure 8 (Figure 8 is a schematic diagram of the noise reduction process provided by the embodiment of the present application): a. Calculate the noise-free component of the material information of the objects in the auto show; b. Divide the image obtained in step (3) by the noise-free component; c. Then perform noise reduction on the divided result, and then multiply the noise-reduced result by the noise-free component to obtain the direct illumination after removing the noise. image.
(6)步骤(4)所得到的图像也是带有噪声的,可按照步骤(5)的降噪过程进行处理,得到去除噪声后的间接光照图像。(6) The image obtained in step (4) is also noisy and can be processed according to the noise reduction process in step (5) to obtain the indirect illumination image after removing the noise.
(7)步骤(5)得到的去除噪声后的直接光照图像,其分辨率与屏幕的分辨率一致,步骤(6)得到的去除噪声后的间接光照图像,其分辨率为屏幕的分辨率的1/4,故可对去除噪声后的间接光照图像进行超分处理,最后将超分后的间接光照图像与去除噪声后的直接光照图像进行叠加,得到虚拟车展的图像,并在屏幕上显示。(7) The resolution of the direct illumination image after removing noise obtained in step (5) is consistent with the resolution of the screen. The resolution of the indirect illumination image after removing noise obtained in step (6) is the resolution of the screen. 1/4, so the indirect illumination image after noise removal can be super-resolved. Finally, the super-resolution indirect illumination image and the direct illumination image after noise removal can be superimposed to obtain the image of the virtual car show and displayed on the screen. .
此外,还可将本申请实施例提供的图像渲染方法与相关技术提供的图像渲染方式进行比较,比较结果如图9至图14所示(图9为本申请实施例提供的比较结果的一个示意图,图10为本申请实施例提供的比较结果的另一示意图,图11为本申请实施例提供的比较结果的另一示意图,图12为本申请实施例提供的比较结果的另一示意图,图13为本申请实施例提供的比较结果的另一示意图,图14为本申请实施例提供的比较结果的另一示意图).测试场景包含一辆车,一个地面以及环境中的光源。In addition, the image rendering method provided by the embodiment of the present application can also be compared with the image rendering method provided by the related technology. The comparison results are shown in Figures 9 to 14 (Figure 9 is a schematic diagram of the comparison results provided by the embodiment of the present application. , Figure 10 is another schematic diagram of the comparison results provided by the embodiment of the present application, Figure 11 is another schematic diagram of the comparison results provided by the embodiment of the present application, Figure 12 is another schematic diagram of the comparison results provided by the embodiment of the present application, Figure 13 is another schematic diagram of the comparison results provided by the embodiment of the present application, and Figure 14 is another schematic diagram of the comparison results provided by the embodiment of the present application). The test scene includes a vehicle, a ground and light sources in the environment.
基于图9可知,相关技术渲染得到的图像中,车体不存在地面的倒影,基于图10可知,本申请实施例基于多样池技术渲染得到的图像中,车体呈现出清晰的地面倒影。Based on Figure 9, it can be seen that in the image rendered by the related technology, there is no reflection of the ground on the car body. Based on Figure 10, it can be seen that in the image rendered based on the multi-pool technology according to the embodiment of the present application, the car body shows a clear reflection on the ground.
基于图11可知,相关技术渲染对图像进行降噪后,车座细节丢失,基于图12可知,本申请实施例对图像进行降噪后,车座细节可实现较好的保留。Based on Figure 11, it can be seen that after the relevant technology rendering denoises the image, the details of the car seat are lost. Based on Figure 12, it can be seen that after the embodiment of the present application denoises the image, the details of the car seat can be better preserved.
基于图13可知,相关技术对图像进行超分处理后,所得到的图像带有明显的走样,基于图14可知,本申请实施例通过对不同光照(直接光照和间接光照)效果进行差异化炒粉,可显著减少走样,所得到的图像平滑清晰。Based on Figure 13, it can be seen that after the related technology performs super-resolution processing on the image, the resulting image has obvious aliasing. Based on Figure 14, it can be seen that the embodiment of the present application performs differentiated speculation on the effects of different lighting (direct lighting and indirect lighting). Pink, which can significantly reduce aliasing and the resulting image is smooth and clear.
本申请实施例中,在获取目标物体与光源之间的原始光线路径后,可基于原始光线路径对目标物体与光源之间的光线路径进行重采样,得到新光线路径,原始光线路径通过光线追踪得到,原始光线路径以目标物体为起点,以光源为终点,新光线路径以光源为起点,以目标物体为终点。然后,可基于新光线路径获取样本池,样本池用于指示射向目标物体的光线,新光线路径由这些光线形成。最后,可基于样本池对目标物体进行渲染,得到目标物体的图像。基于前述过程可知,本申请实施例提供了一种新的光线路径重采样方式,该方式逆着光线追踪中有效的光线路径的指向(以光源为起点,以目标物体为终点),有针对 性地去重采样光线路径,可提高采样到有效的新光线路径的成功率,即能够轻易地重采样到目标物体与光源之间有效的新光线路径,如此一来,无论形成新光线路径的光线射在目标物体上所产生的现象为直接光照、漫反射、镜面反射和高光反射中的哪一种,均可成功获取到优质且足够的样本池,从而令针对目标物体的渲染效果足够优质(即渲染得到的目标物体的图像具备足够高的质量)。In the embodiment of the present application, after obtaining the original light path between the target object and the light source, the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path. The original light path is traced through ray tracing. It is obtained that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object. A pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed. Finally, the target object can be rendered based on the sample pool to obtain the image of the target object. Based on the foregoing process, it can be seen that the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Consistently resampling the light path can improve the success rate of sampling an effective new light path, that is, it can easily resample an effective new light path between the target object and the light source. In this way, no matter what forms the new light path, Regardless of whether the phenomenon caused by light hitting the target object is direct illumination, diffuse reflection, specular reflection, or specular reflection, a high-quality and sufficient sample pool can be successfully obtained, so that the rendering effect of the target object is high enough. (That is, the rendered image of the target object is of sufficiently high quality).
进一步地,本申请实施例提供了一种基于多样本池的光线追踪技术,多样本池指至少一个第一样本池和至少一个第二样本池。在一种常见的配置中,可构建两个第一样本池以及一个第二样本池,两个第一样本池对应的渲染效果分别为镜面反射和高光反射,第二样本池对应的渲染效果为直接光照,那么,即使目标物体为特殊材质的物体,基于多个样本池渲染得到的目标物体的图像,既可以呈现直接光照效果,也可以呈现镜面反射效果和高光反射效果等间接光照效果,所得到图像更加真实和精美,有利于提高用户体验。Furthermore, embodiments of the present application provide a ray tracing technology based on multiple sample pools. The multiple sample pools refer to at least one first sample pool and at least one second sample pool. In a common configuration, two first sample pools and one second sample pool can be constructed. The rendering effects corresponding to the two first sample pools are specular reflection and specular reflection respectively. The rendering effects corresponding to the second sample pool The effect is direct lighting. Then, even if the target object is an object of special material, the image of the target object rendered based on multiple sample pools can present not only direct lighting effects, but also indirect lighting effects such as specular reflection effects and highlight reflection effects. , the resulting image is more realistic and beautiful, which is conducive to improving user experience.
更进一步地,本申请实施例中,第一样本池的尺寸小于屏幕的分辨率,故可提高获取第一样本池的效率,且在基于多样本池技术对目标物体进行渲染的过程中,可配合超分处理,在一定程度上减少该过程所需付出的计算量,有利于加快基于多样本池的光线追踪技术的实现,进一步提高用户体验。Furthermore, in the embodiment of the present application, the size of the first sample pool is smaller than the resolution of the screen, so the efficiency of obtaining the first sample pool can be improved, and in the process of rendering the target object based on the multi-sample pool technology , can be used with super-resolution processing to reduce the amount of calculation required in the process to a certain extent, which is conducive to accelerating the implementation of ray tracing technology based on multi-sample pools and further improving user experience.
更进一步地,本申请实施例中提供了一种新的图像降噪方式,可基于目标物体的材质信息的无噪声分类来实现对各个图层的解调、降噪以及调制,这样可以使得各个图层尽量保持目标物体的细节,使得基于各个图层叠加得到的目标物体的图像,更加真实且清晰可见,有利于提高用户的观看,进一步提高用户体验。Furthermore, the embodiments of this application provide a new image noise reduction method, which can realize demodulation, noise reduction and modulation of each layer based on the noise-free classification of the material information of the target object, so that each layer can be The layers try to maintain the details of the target object, so that the image of the target object obtained based on the superposition of each layer is more realistic and clearly visible, which is conducive to improving the user's viewing experience and further improving the user experience.
以上是对本申请实施例提供的图像渲染方法所进行的详细说明,下文将对本申请实施例提供图像渲染装置进行介绍。图15为本申请实施例提供的图像渲染装置的一个结构示意图,如图15所示,该装置包括:The above is a detailed description of the image rendering method provided by the embodiment of the present application. The image rendering device provided by the embodiment of the present application will be introduced below. Figure 15 is a schematic structural diagram of an image rendering device provided by an embodiment of the present application. As shown in Figure 15, the device includes:
重采样模块1501,用于基于目标物体与光源之间的原始光线路径,对目标物体与光源之间的光线路径进行重采样,以得到新光线路径,原始光线路径通过光线追踪得到,原始光线路径以目标物体为起点,以光源为终点,新光线路径以光源为起点,以目标物体为终点;The resampling module 1501 is used to resample the light path between the target object and the light source based on the original light path between the target object and the light source to obtain a new light path. The original light path is obtained through ray tracing. The original light path Taking the target object as the starting point and the light source as the end point, the new light path takes the light source as the starting point and the target object as the end point;
第一获取模块1502,用于基于新光线路径,获取样本池,样本池用于指示射向目标物体的光线,新光线路径由光线形成;The first acquisition module 1502 is used to acquire a sample pool based on the new light path. The sample pool is used to indicate the light rays directed to the target object. The new light path is formed by the light rays;
渲染模块1503,用于基于样本池,对目标物体进行渲染,以得到目标物体的图像。The rendering module 1503 is used to render the target object based on the sample pool to obtain an image of the target object.
本申请实施例中,在获取目标物体与光源之间的原始光线路径后,可基于原始光线路径对目标物体与光源之间的光线路径进行重采样,得到新光线路径,原始光线路径通过光线追踪得到,原始光线路径以目标物体为起点,以光源为终点,新光线路径以光源为起点,以目标物体为终点。然后,可基于新光线路径获取样本池,样本池用于指示射向目标物体的光线,新光线路径由这些光线形成。最后,可基于样本池对目标物体进行渲染,得到目标物体的图像。基于前述过程可知,本申请实施例提供了一种新的光线路径重采样方式,该方式逆着光线追踪中有效的光线路径的指向(以光源为起点,以目标物体为终点),有针对性地去重采样光线路径,可提高采样到有效的新光线路径的成功率,即能够轻易地重采样到目标物体与光源之间有效的新光线路径,如此一来,无论形成新光线路径的光线射在目标物体上所产生的现象为直接光照、漫反射、镜面反射和高光反射中的哪一种,均可成功获取到优质且足够的样本池,从而令针对目标物体的渲染效果足够优质。In the embodiment of the present application, after obtaining the original light path between the target object and the light source, the light path between the target object and the light source can be resampled based on the original light path to obtain a new light path. The original light path is traced through ray tracing. It is obtained that the original light path starts from the target object and ends with the light source, and the new light path starts from the light source and ends with the target object. A pool of samples can then be obtained based on the new ray path, indicating the rays hitting the target object from which the new ray path is formed. Finally, the target object can be rendered based on the sample pool to obtain the image of the target object. Based on the foregoing process, it can be seen that the embodiment of the present application provides a new light path resampling method, which is contrary to the direction of the effective light path in ray tracing (with the light source as the starting point and the target object as the end point), and is targeted Ground resampling of light paths can improve the success rate of sampling to effective new light paths, that is, it can easily resample to effective new light paths between the target object and the light source. In this way, no matter the light that forms the new light path Regardless of whether the phenomenon produced by the target object is direct illumination, diffuse reflection, specular reflection, or specular reflection, a high-quality and sufficient sample pool can be successfully obtained, so that the rendering effect of the target object is high enough.
在一种可能的实现方式中,新光线路径包括第一光线路径以及第二光线路径,第一光线路径以光源为起点,以目标物体为终点,且经过其余物体,第二光线路径以光源为起点,以目标物体为终点,且未经过其余物体;样本池包含第一样本池和第二样本池,第一样本池用于指示射向目标物体的第一光线,第一光线路径由第一光线形成,第二样本池用于指示射向目标物体的第二光线,第二光线路径由第二光线形成。In a possible implementation, the new light path includes a first light path and a second light path. The first light path starts with the light source, ends with the target object, and passes through other objects. The second light path starts with the light source. The starting point is the target object as the end point, and does not pass through other objects; the sample pool includes the first sample pool and the second sample pool. The first sample pool is used to indicate the first light ray directed to the target object. The first light path is A first ray is formed, a second sample cell is used to direct a second ray directed to the target object, and a second ray path is formed by the second ray.
在一种可能的实现方式中,第一光线射在目标物体上所产生的现象为镜面反射或者高光反射。In a possible implementation, the phenomenon caused by the first light ray hitting the target object is specular reflection or specular reflection.
在一种可能的实现方式中,第一样本池所指示的第一光线的数量小于屏幕所显示的像素的数量,第二样本池所指示的第二光线的数量等于屏幕所显示的像素的数量,屏幕用于显示目标物体的图像。In a possible implementation, the number of first rays indicated by the first sample pool is less than the number of pixels displayed on the screen, and the number of second rays indicated by the second sample pool is equal to the number of pixels displayed on the screen. Quantity, the screen is used to display the image of the target object.
在一种可能的实现方式中,渲染模块1503,用于:基于第一样本池对目标物体进行渲染,以得到目标物体的第一光照图像;基于第二样本池对目标物体进行渲染,以得到目标物体的第二光照图像;对第一光照图像以及第二光照图像进行融合,以得到目标物体的图像。In a possible implementation, the rendering module 1503 is configured to: render the target object based on the first sample pool to obtain the first lighting image of the target object; render the target object based on the second sample pool to obtain the first illumination image of the target object; Obtain a second illumination image of the target object; fuse the first illumination image and the second illumination image to obtain an image of the target object.
在一种可能的实现方式中,渲染模块1503,还用于:获取目标物体的材质信息的无噪声分量;基于无噪声分量对第一光照图像进行第一处理,以得到处理后的第一光照图像,第一处理包含解调处理、降噪处 理以及调制处理;基于无噪声分量对第二光照图像进行第二处理,以得到处理后的第二光照图像,第二处理包含解调处理、降噪处理以及调制处理;渲染模块1503,用于对处理后的第一光照图像以及处理后的第二光照图像进行融合,以得到目标物体的图像。In a possible implementation, the rendering module 1503 is also used to: obtain the noise-free component of the material information of the target object; and perform the first processing on the first illumination image based on the noise-free component to obtain the processed first illumination. Image, the first processing includes demodulation processing, noise reduction processing processing and modulation processing; perform a second processing on the second illumination image based on the noise-free component to obtain a processed second illumination image. The second processing includes demodulation processing, noise reduction processing and modulation processing; rendering module 1503, for The processed first illumination image and the processed second illumination image are fused to obtain an image of the target object.
在一种可能的实现方式中,第一处理还包含超分处理,超分处理用于令处理后的第一光照图像的分辨率等于屏幕的分辨率。In a possible implementation, the first processing also includes super-resolution processing, and the super-resolution processing is used to make the resolution of the processed first illumination image equal to the resolution of the screen.
需要说明的是,上述装置各模块/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其带来的技术效果与本申请方法实施例相同,具体内容可参考本申请实施例前述所示的方法实施例中的叙述,此处不再赘述。It should be noted that the information interaction, execution process, etc. between the modules/units of the above-mentioned device are based on the same concept as the method embodiments of the present application, and the technical effects they bring are the same as those of the method embodiments of the present application. The specific content can be Refer to the description in the method embodiments shown above in the embodiments of the present application, which will not be described again here.
本申请实施例还涉及一种电路系统,该电路系统包括处理电路,该处理电路配置为执行如前述图4所示实施例中的各个步骤。Embodiments of the present application also relate to a circuit system, which circuit system includes a processing circuit configured to perform various steps in the embodiment shown in FIG. 4 .
本申请实施例还涉及一种芯片系统,该芯片系统包括处理器,用于调用存储器中存储的计算机程序或计算机指令,以使得该处理器执行如前述图4所示实施例中的各个步骤。Embodiments of the present application also relate to a chip system, which includes a processor for calling a computer program or computer instructions stored in a memory, so that the processor executes various steps in the embodiment shown in FIG. 4 .
在一种可能的实现方式中,该处理器通过接口与存储器耦合。In one possible implementation, the processor is coupled to the memory through an interface.
在一种可能的实现方式中,该芯片系统还包括存储器,该存储器中存储有计算机程序或计算机指令。In a possible implementation, the chip system further includes a memory, and computer programs or computer instructions are stored in the memory.
本申请实施例还涉及一种计算机存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述图4所示实施例中的各个步骤。Embodiments of the present application also relate to a computer storage medium. The computer-readable storage medium stores a program for performing signal processing. When the program is run on a computer, it causes the computer to execute each of the steps in the embodiment shown in Figure 4. step.
本申请实施例还涉及一种计算机程序产品,该计算机程序产品存储有指令,该指令在由计算机执行时使得计算机执行如前述图4所示实施例中的各个步骤。Embodiments of the present application also relate to a computer program product that stores instructions that, when executed by a computer, cause the computer to perform various steps in the embodiment shown in FIG. 4 .
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be described again here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。 If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code. .

Claims (19)

  1. 一种图像渲染方法,其特征在于,所述方法包括:An image rendering method, characterized in that the method includes:
    基于目标物体与光源之间的原始光线路径,对所述目标物体与所述光源之间的光线路径进行重采样,以得到新光线路径,所述原始光线路径通过光线追踪得到,所述原始光线路径以所述目标物体为起点,以所述光源为终点,所述新光线路径以所述光源为起点,以所述目标物体为终点;Based on the original light path between the target object and the light source, the light path between the target object and the light source is resampled to obtain a new light path. The original light path is obtained through ray tracing. The original light path The path takes the target object as the starting point and the light source as the end point, and the new light path takes the light source as the starting point and the target object as the end point;
    基于所述新光线路径,获取样本池,所述样本池用于指示射向所述目标物体的光线,所述新光线路径由所述光线形成;Based on the new light path, obtain a sample pool, the sample pool is used to indicate the light rays directed to the target object, and the new light path is formed by the light rays;
    基于所述样本池,对所述目标物体进行渲染,以得到所述目标物体的图像。Based on the sample pool, the target object is rendered to obtain an image of the target object.
  2. 根据权利要求1所述的方法,其特征在于,所述新光线路径包括第一光线路径以及第二光线路径,所述第一光线路径以所述光源为起点,以所述目标物体为终点,且经过其余物体,所述第二光线路径以所述光源为起点,以所述目标物体为终点,且未经过其余物体;The method according to claim 1, characterized in that the new light path includes a first light path and a second light path, the first light path starts from the light source and ends with the target object, And passing through other objects, the second light path takes the light source as the starting point and the target object as the ending point, and does not pass through other objects;
    所述样本池包含第一样本池和第二样本池,第一样本池用于指示射向所述目标物体的第一光线,所述第一光线路径由所述第一光线形成,第二样本池用于指示射向所述目标物体的第二光线,所述第二光线路径由所述第二光线形成。The sample pool includes a first sample pool and a second sample pool. The first sample pool is used to indicate the first light ray directed to the target object. The first light ray path is formed by the first light ray. The two sample cells are used to indicate the second light rays emitted to the target object, and the second light ray path is formed by the second light rays.
  3. 根据权利要求2所述的方法,其特征在于,第一光线射在所述目标物体上所产生的现象包含以下至少一种:镜面反射或者高光反射。The method of claim 2, wherein the phenomenon caused by the first light ray hitting the target object includes at least one of the following: specular reflection or specular reflection.
  4. 根据权利要求2或3所述的方法,其特征在于,所述第一样本池所指示的第一光线的数量小于屏幕所显示的像素的数量,所述第二样本池所指示的第二光线的数量等于所述屏幕所显示的像素的数量,所述屏幕用于显示所述目标物体的图像。The method according to claim 2 or 3, characterized in that the number of first rays indicated by the first sample pool is less than the number of pixels displayed on the screen, and the number of second rays indicated by the second sample pool is smaller than the number of pixels displayed on the screen. The number of rays is equal to the number of pixels displayed on the screen, which is used to display the image of the target object.
  5. 根据权利要求2至4任意一项所述的方法,其特征在于,所述基于所述样本池,对所述目标物体进行渲染,以得到所述目标物体的图像包括:The method according to any one of claims 2 to 4, wherein rendering the target object based on the sample pool to obtain an image of the target object includes:
    基于所述第一样本池对所述目标物体进行渲染,以得到所述目标物体的第一光照图像;Render the target object based on the first sample pool to obtain a first illumination image of the target object;
    基于所述第二样本池对所述目标物体进行渲染,以得到所述目标物体的第二光照图像;Render the target object based on the second sample pool to obtain a second illumination image of the target object;
    对所述第一光照图像以及所述第二光照图像进行融合,以得到所述目标物体的图像。The first illumination image and the second illumination image are fused to obtain an image of the target object.
  6. 根据权利要求5所述的方法,其特征在于,所述对所述第一光照图像以及所述第二光照图像进行融合,以得到所述目标物体的图像之前,所述方法还包括:The method according to claim 5, characterized in that before fusing the first illumination image and the second illumination image to obtain the image of the target object, the method further includes:
    获取目标物体的材质信息的无噪声分量;Obtain the noise-free component of the material information of the target object;
    基于所述无噪声分量对所述第一光照图像进行第一处理,以得到处理后的第一光照图像,所述第一处理包含解调处理、降噪处理以及调制处理;Perform first processing on the first illumination image based on the noise-free component to obtain a processed first illumination image, where the first processing includes demodulation processing, noise reduction processing and modulation processing;
    基于所述无噪声分量对所述第二光照图像进行所述第二处理,以得到处理后的第二光照图像,所述第二处理包含解调处理、降噪处理以及调制处理;Perform the second processing on the second illumination image based on the noise-free component to obtain a processed second illumination image, where the second processing includes demodulation processing, noise reduction processing and modulation processing;
    所述对所述第一光照图像以及所述第二光照图像进行融合,以得到所述目标物体的图像包括:The fusion of the first illumination image and the second illumination image to obtain the image of the target object includes:
    对所述处理后的第一光照图像以及所述处理后的第二光照图像进行融合,以得到所述目标物体的图像。The processed first illumination image and the processed second illumination image are fused to obtain an image of the target object.
  7. 根据据权利要求6所述的方法,其特征在于,所述第一处理还包含超分处理,所述超分处理用于令所述处理后的第一光照图像的分辨率等于屏幕的分辨率。The method according to claim 6, wherein the first processing further includes super-resolution processing, and the super-resolution processing is used to make the resolution of the processed first illumination image equal to the resolution of the screen. .
  8. 一种图像渲染装置,其特征在于,所述装置包括:An image rendering device, characterized in that the device includes:
    重采样模块,用于基于目标物体与光源之间的原始光线路径,对所述目标物体与所述光源之间的光线路径进行重采样,以得到新光线路径,所述原始光线路径通过光线追踪得到,所述原始光线路径以所述目标物体为起点,以所述光源为终点,所述新光线路径以所述光源为起点,以所述目标物体为终点;A resampling module, configured to resample the light path between the target object and the light source based on the original light path between the target object and the light source to obtain a new light path. The original light path is traced through ray tracing. It is obtained that the original light path takes the target object as the starting point and the light source as the end point, and the new light path takes the light source as the starting point and the target object as the end point;
    第一获取模块,用于基于所述新光线路径,获取样本池,所述样本池用于指示射向所述目标物体的光线,所述新光线路径由所述光线形成;A first acquisition module, configured to acquire a sample pool based on the new light path, where the sample pool is used to indicate the light rays directed to the target object, and the new light path is formed by the light rays;
    渲染模块,用于基于所述样本池,对所述目标物体进行渲染,以得到所述目标物体的图像。A rendering module, configured to render the target object based on the sample pool to obtain an image of the target object.
  9. 根据权利要求8所述的装置,其特征在于,所述新光线路径包括第一光线路径以及第二光线路径,所述第一光线路径以所述光源为起点,以所述目标物体为终点,且经过其余物体,所述第二光线路径以所述光源为起点,以所述目标物体为终点,且未经过其余物体;The device according to claim 8, wherein the new light path includes a first light path and a second light path, the first light path starting from the light source and ending with the target object, And passing through other objects, the second light path takes the light source as the starting point and the target object as the ending point, and does not pass through other objects;
    所述样本池包含第一样本池和第二样本池,第一样本池用于指示射向所述目标物体的第一光线,所述 第一光线路径由所述第一光线形成,第二样本池用于指示射向所述目标物体的第二光线,所述第二光线路径由所述第二光线形成。The sample pool includes a first sample pool and a second sample pool. The first sample pool is used to indicate the first light ray directed to the target object. A first light path is formed by the first light ray, a second sample cell is used to indicate a second light ray directed to the target object, and the second light ray path is formed by the second light ray.
  10. 根据权利要求9所述的装置,其特征在于,第一光线射在所述目标物体上所产生的现象为镜面反射或者高光反射。The device according to claim 9, characterized in that the phenomenon produced by the first light ray striking the target object is specular reflection or specular reflection.
  11. 根据权利要求9或10所述的装置,其特征在于,所述第一样本池所指示的第一光线的数量小于屏幕所显示的像素的数量,所述第二样本池所指示的第二光线的数量等于所述屏幕所显示的像素的数量,所述屏幕用于显示所述目标物体的图像。The device according to claim 9 or 10, characterized in that the number of first rays indicated by the first sample pool is less than the number of pixels displayed on the screen, and the number of second rays indicated by the second sample pool is smaller than the number of pixels displayed on the screen. The number of rays is equal to the number of pixels displayed on the screen, which is used to display the image of the target object.
  12. 根据权利要求9至11任意一项所述的装置,其特征在于,所述渲染模块,用于:The device according to any one of claims 9 to 11, characterized in that the rendering module is used for:
    基于所述第一样本池对所述目标物体进行渲染,以得到所述目标物体的第一光照图像;Render the target object based on the first sample pool to obtain a first illumination image of the target object;
    基于所述第二样本池对所述目标物体进行渲染,以得到所述目标物体的第二光照图像;Render the target object based on the second sample pool to obtain a second illumination image of the target object;
    对所述第一光照图像以及所述第二光照图像进行融合,以得到所述目标物体的图像。The first illumination image and the second illumination image are fused to obtain an image of the target object.
  13. 根据权利要求12所述的装置,其特征在于,所述渲染模块,还用于:The device according to claim 12, characterized in that the rendering module is also used to:
    获取目标物体的材质信息的无噪声分量;Obtain the noise-free component of the material information of the target object;
    基于所述无噪声分量对所述第一光照图像进行第一处理,以得到处理后的第一光照图像,所述第一处理包含解调处理、降噪处理以及调制处理;Perform first processing on the first illumination image based on the noise-free component to obtain a processed first illumination image, where the first processing includes demodulation processing, noise reduction processing and modulation processing;
    基于所述无噪声分量对所述第二光照图像进行所述第二处理,以得到处理后的第二光照图像,所述第二处理包含解调处理、降噪处理以及调制处理;Perform the second processing on the second illumination image based on the noise-free component to obtain a processed second illumination image, where the second processing includes demodulation processing, noise reduction processing and modulation processing;
    所述渲染模块,用于对所述处理后的第一光照图像以及所述处理后的第二光照图像进行融合,以得到所述目标物体的图像。The rendering module is used to fuse the processed first illumination image and the processed second illumination image to obtain an image of the target object.
  14. 根据权利要求13所述的装置,其特征在于,所述第一处理还包含超分处理,所述超分处理用于令所述处理后的第一光照图像的分辨率等于屏幕的分辨率。The device according to claim 13, wherein the first processing further includes super-resolution processing, and the super-resolution processing is used to make the resolution of the processed first illumination image equal to the resolution of the screen.
  15. 一种电子设备,其特征在于,所述设备包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为执行所述代码,当所述代码被执行时,所述电子设备执行如权利要求1至7任意一项所述的方法。An electronic device, characterized in that the device includes a memory and a processor; the memory stores code, the processor is configured to execute the code, and when the code is executed, the electronic device executes The method according to any one of claims 1 to 7.
  16. 一种电路系统,其特征在于,所述电路系统包括处理电路,所述处理电路配置为执行如权利要求1至7任一所述的方法。A circuit system, characterized in that the circuit system includes a processing circuit configured to perform the method according to any one of claims 1 to 7.
  17. 一种芯片系统,其特征在于,所述芯片系统包括处理器,用于调用存储器中存储的计算机程序或计算机指令,以使得所述处理器执行如权利要求1至7任一所述的方法。A chip system, characterized in that the chip system includes a processor for calling a computer program or computer instructions stored in a memory, so that the processor executes the method according to any one of claims 1 to 7.
  18. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有一个或多个指令,所述指令在由一个或多个计算机执行时使得所述一个或多个计算机实施权利要求1至7任一所述的方法。A computer storage medium, characterized in that the computer storage medium stores one or more instructions, which when executed by one or more computers cause the one or more computers to implement any of claims 1 to 7. The method described in 1.
  19. 一种计算机程序产品,其特征在于,所述计算机程序产品存储有指令,所述指令在由计算机执行时,使得所述计算机实施权利要求1至7任意一项所述的方法。 A computer program product, characterized in that the computer program product stores instructions, which when executed by a computer, cause the computer to implement the method described in any one of claims 1 to 7.
PCT/CN2023/103064 2022-06-29 2023-06-28 Image rendering method and related device thereof WO2024002130A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210752953.8A CN117351134A (en) 2022-06-29 2022-06-29 Image rendering method and related equipment thereof
CN202210752953.8 2022-06-29

Publications (1)

Publication Number Publication Date
WO2024002130A1 true WO2024002130A1 (en) 2024-01-04

Family

ID=89367832

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/103064 WO2024002130A1 (en) 2022-06-29 2023-06-28 Image rendering method and related device thereof

Country Status (2)

Country Link
CN (1) CN117351134A (en)
WO (1) WO2024002130A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8243070B1 (en) * 2008-04-18 2012-08-14 Adobe Systems Incorporated Triangulation for accelerated rendering of polygons
CN107067455A (en) * 2017-04-18 2017-08-18 腾讯科技(深圳)有限公司 A kind of method and apparatus of real-time rendering
CN110599579A (en) * 2019-09-20 2019-12-20 山东师范大学 Photon resampling-based random asymptotic photon mapping image rendering method and system
CN112396684A (en) * 2020-11-13 2021-02-23 贝壳技术有限公司 Ray tracing method, ray tracing device and machine-readable storage medium
CN113298925A (en) * 2021-04-14 2021-08-24 江苏理工学院 Dynamic scene rendering acceleration method based on ray path multiplexing
CN114549730A (en) * 2020-11-27 2022-05-27 华为技术有限公司 Light source sampling weight determination method for multi-light source scene rendering and related equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8243070B1 (en) * 2008-04-18 2012-08-14 Adobe Systems Incorporated Triangulation for accelerated rendering of polygons
CN107067455A (en) * 2017-04-18 2017-08-18 腾讯科技(深圳)有限公司 A kind of method and apparatus of real-time rendering
CN110599579A (en) * 2019-09-20 2019-12-20 山东师范大学 Photon resampling-based random asymptotic photon mapping image rendering method and system
CN112396684A (en) * 2020-11-13 2021-02-23 贝壳技术有限公司 Ray tracing method, ray tracing device and machine-readable storage medium
CN114549730A (en) * 2020-11-27 2022-05-27 华为技术有限公司 Light source sampling weight determination method for multi-light source scene rendering and related equipment
CN113298925A (en) * 2021-04-14 2021-08-24 江苏理工学院 Dynamic scene rendering acceleration method based on ray path multiplexing

Also Published As

Publication number Publication date
CN117351134A (en) 2024-01-05

Similar Documents

Publication Publication Date Title
WO2022111619A1 (en) Image processing method and related apparatus
US11200725B2 (en) Method for continued bounding volume hierarchy traversal on intersection without shader intervention
US11816782B2 (en) Rendering of soft shadows
US11024077B2 (en) Global illumination calculation method and apparatus
US7212207B2 (en) Method and apparatus for real-time global illumination incorporating stream processor based hybrid ray tracing
EP1982310B1 (en) Method for synthesizing a virtual image by beam launching
US20080143720A1 (en) Method for rendering global illumination on a graphics processing unit
Li et al. [Retracted] Multivisual Animation Character 3D Model Design Method Based on VR Technology
US20210390760A1 (en) Ray tracing hardware acceleration for supporting motion blur and moving/deforming geometry
WO2022143367A1 (en) Image rendering method and related device therefor
CN113674389A (en) Scene rendering method and device, electronic equipment and storage medium
CN116485984B (en) Global illumination simulation method, device, equipment and medium for panoramic image vehicle model
US9483873B2 (en) Easy selection threshold
Regenbrecht et al. Preaching voxels: An alternative approach to mixed reality
WO2024002130A1 (en) Image rendering method and related device thereof
JP2007512603A (en) Image drawing
KR20230013099A (en) Geometry-aware augmented reality effects using real-time depth maps
WO2023051662A1 (en) Image rendering method and related device thereof
CN110832549A (en) Method for the rapid generation of ray traced reflections of virtual objects in a real world environment
CN110827385B (en) Query-specific behavior modification for tree traversal
Shihan et al. Adaptive volumetric light and atmospheric scattering
Karlsson et al. Rendering Realistic Augmented Objects Using a Image Based Lighting Approach
TW202414342A (en) Accelerated bounding volume hierarchy (bvh) traversal for shadow rays
TW202336701A (en) Ray tracing processor
Simmons Tapestry: An efficient mesh-based display representation for interactive rendering

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23830305

Country of ref document: EP

Kind code of ref document: A1