WO2023051662A1 - 一种图像渲染方法及其相关设备 - Google Patents
一种图像渲染方法及其相关设备 Download PDFInfo
- Publication number
- WO2023051662A1 WO2023051662A1 PCT/CN2022/122427 CN2022122427W WO2023051662A1 WO 2023051662 A1 WO2023051662 A1 WO 2023051662A1 CN 2022122427 W CN2022122427 W CN 2022122427W WO 2023051662 A1 WO2023051662 A1 WO 2023051662A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- material information
- reflected
- information
- reflector
- image
- Prior art date
- Legal status (The legal status 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 status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—Three-dimensional [3D] image rendering
- G06T15/06—Ray-tracing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—Three-dimensional [3D] image rendering
- G06T15/50—Lighting effects
- G06T15/80—Shading
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- the present application relates to the technical field of computer graphics, in particular to an image rendering method and related equipment.
- a rasterization technology combined with a ray tracing technology is usually used to render a 3D scene, so as to obtain a more realistic image and improve user experience.
- a three-dimensional scene usually includes reflectors (for example, the ground) and multiple reflected objects (people on the ground, chairs, etc.).
- the graphics processing unit (GPU) receives the spatial information of the reflector sent by the central processing unit (CPU), the material information of the reflector, the spatial information of multiple reflected objects, and the spatial information of multiple reflected objects.
- the spatial information of the reflector and the spatial information of multiple reflected objects can be used for intersection calculation, so as to determine multiple intersection points on multiple reflected objects.
- the GPU can perform coloring based on the spatial information of the intersection point and the material information of the reflected object where the intersection point is located. In this way, after completing the coloring operations corresponding to all intersection points, the reflection in the reflector ( For example, an image of a human figure on the ground). So far, the image rendering based on ray tracing is completed.
- the cache memory (cache) of the GPU can usually only cache one material information.
- some of the reflected objects may correspond to the same material information, so the GPU completes the processing of multiple reflected objects in sequence.
- the same material information is frequently swapped in and out between the memory and the cache, resulting in too much memory bandwidth and unbearable for electronic devices.
- Embodiments of the present application provide an image rendering method and related equipment, which can effectively reduce the number of times any material information is swapped in and out between the memory and cache, thereby reducing memory bandwidth and optimizing the performance of electronic devices.
- the first aspect of the embodiments of the present application provides an image rendering method, the method including:
- the CPU can obtain the rendering information of the 3D scene. Since the 3D scene usually includes reflectors (such as the ground, etc.) and N reflected objects (such as people, tables, chairs, etc.), the CPU can render the 3D scene The information is divided into rendering information of reflectors and rendering information of N reflected objects. Then, the CPU sends the rendering information of the reflector (including the spatial information and material information of the reflector) and the rendering information of the N reflected objects (including the spatial information and material information of the N reflected objects) to the GPU, so that the GPU
- the ray-tracing stage of image rendering that is, the following steps are performed:
- the GPU performs intersection calculation based on ray tracing based on the spatial information of the reflector and the spatial information of the N reflected objects, and obtains M intersection points on the N reflected objects.
- the N reflected objects are objects that intersect light rays (from the camera) passing through the reflected objects.
- the N reflected objects there is at least one intersection point on each reflected object, so M ⁇ N ⁇ 1.
- the 3D scene contains reflected objects such as people, chairs, and tables, and the chairs and tables are made of the same material. Then, the material information of the person is material information 1, and the material information of the chair and the table is material information 2.
- the image of the reflection of the reflected object in the reflector includes the image of the shadow of the person on the ground, the image of the shadow of the table, the image of the shadow of the chair, etc.).
- M intersection points on the N reflected objects and N reflected objects can be obtained.
- Object corresponds to P pieces of material information.
- the GPU determines all intersection points corresponding to the target material information, and performs coloring according to the spatial information of all intersection points corresponding to the target material information and the target material information, to obtain an image of the reflection of the reflected object in the reflector.
- the GPU separates and executes the intersection calculation and coloring in ray tracing, that is, after uniformly determining the M intersection points, for a certain material information among the P material information, the GPU can determine the corresponding All the intersection points, and the shading operations corresponding to these intersection points are completed, so the GPU does not need to use the material information in the subsequent shading operations corresponding to the remaining intersection points among the M intersection points. In this way, the number of times any material information is swapped in and out between the memory and the cache can be effectively reduced, thereby reducing memory bandwidth and optimizing the performance of electronic devices.
- the target material information is the i-th material information
- the initial value of i is 1
- the GPU can determine the intersection point corresponding to the first material information in the P material information among the M intersection points, and according to the spatial information of the intersection point corresponding to the first material information and the first material information Information is colored.
- the GPU can perform the same operation on the second material information as on the first material information, until the operation on the P-th material information is completed as on the first material information, so the GPU can successfully render Images reflected in reflective objects.
- M intersection points on the N reflected objects can be obtained, and the N reflected objects correspond to P pieces of material information.
- the GPU determines the intersection point corresponding to the first material information, and performs coloring according to the spatial information of the intersection point corresponding to the first material information and the first material information.
- the GPU can perform the same operation on the second material information as on the first material information, until the operation on the P-th material information is completed as on the first material information, then the GPU can successfully render The image of the reflection of the reflected object in the reflector.
- the GPU separates and executes the intersection calculation and coloring in ray tracing, that is, after uniformly determining the M intersection points, for any one of the P material information, the GPU can determine the corresponding All the intersection points, and the shading operations corresponding to these intersection points are completed, so the GPU does not need to use the material information in the subsequent shading operations corresponding to the remaining intersection points among the M intersection points. In this way, the number of times any material information is swapped in and out between the memory and the cache can be effectively reduced, thereby reducing memory bandwidth and optimizing the performance of electronic devices.
- the GPU can process the material information and the spatial information of the M intersection points.
- the GPU can determine whether the object to be reflected at the first intersection among the M intersection points corresponds to the material information, and if the object to be reflected at the first intersection corresponds to the material information, then according to the first intersection The spatial information and the material information are colored to obtain the first pixel of the reflected image in the reflector. If the reflected object where the first intersection point is located does not correspond to the material information, the process ends. Thereafter, the GPU can perform the same operation on the second intersection point as on the first intersection point until the operation on the Mth intersection point is completed as on the first intersection point. For the rest of the material information in the P pieces of material information, the GPU can also perform the aforementioned process, so as to successfully obtain the reflected image of the reflective object.
- S1 includes: according to the spatial information of the camera, the spatial information of the reflector, and the hierarchical bounding box BVH tree, it is determined that the light from the camera passes through the reflector and acts on the N reflected objects.
- the obtained M intersections, the BVH tree is constructed according to the spatial information of N reflected objects.
- the GPU completely separates the intersection calculation and coloring of ray tracing, and first performs the intersection calculation in a unified manner, so as to obtain M intersection points obtained on N reflected objects, which is conducive to optimizing the entire ray tracing process. .
- each reflected object has a unique number in the BVH tree
- S211 includes: if the number of the reflected object where the j-th intersection point is located is located at the first In the number of at least one reflected object corresponding to the i material information, the coloring is performed according to the spatial information of the j intersection point and the i material information.
- the GPU can determine whether the number of the reflected object where the intersection is located is located in all the reflected objects corresponding to the material information If yes, coloring is performed according to the spatial information of the intersection point and the material information, and if not, the process ends. In this way, it can be accurately judged whether a certain intersection point corresponds to a certain material information.
- the method further includes: S4: performing rasterization according to the spatial information of the reflector and the material information of the reflector to obtain an image of the reflector; S5: according to the spatial information of N reflected objects Rasterize the material information of the N reflected objects to obtain the images of the N reflected objects; S6: Fusion the image of the reflector, the images of the N reflected objects and the image of the reflection in the reflector to obtain the target image .
- the rendering information of the reflector including the spatial information of the reflector and the material information of the reflector
- the rendering information of all reflected objects including the spatial information of all the reflected objects and the material information of all the reflected objects
- the GPU can also perform rasterization based on these information, so as to obtain the image of the reflector and the images of N reflected objects. Then, the GPU fuses the image of the reflector, the images of the N reflected objects, and the reflection image of the reflector to obtain the target image of the simulated 3D scene. So far, the image rendering of the 3D scene is completed. Thereafter, the CPU can obtain the target image from the buffer, and send the target image to the screen for display by the user.
- the spatial information includes at least one of a vertex coordinate, a vertex normal, and a triangle index.
- the material information includes at least one of color, metallicity and roughness.
- the second aspect of the embodiment of the present application provides an image rendering device, which includes: an intersection module, configured to perform intersection calculation based on ray tracing according to the spatial information of the reflector and the spatial information of the reflected object, to obtain the M intersections on the reflector, the reflected object corresponds to P pieces of material information, M ⁇ 1; the coloring module is used to determine multiple intersections corresponding to the target material information among the M intersections, and according to the number of intersections corresponding to the target material information The spatial information of each intersection point and the target material information are colored to obtain an image of the reflection of the reflected object in the reflector, and the target material information is one of multiple material information.
- the GPU performs intersection calculation based on ray tracing based on the spatial information of the reflector and the spatial information of the N reflected objects, it can obtain M intersection points on the N reflected objects, and N reflected objects Object corresponds to P pieces of material information.
- the GPU determines all intersection points corresponding to the target material information, and performs coloring according to the spatial information of all intersection points corresponding to the target material information and the target material information, to obtain an image of the reflection of the reflected object in the reflector.
- the GPU separates and executes the intersection calculation and coloring in ray tracing, that is, after uniformly determining the M intersection points, for a certain material information among the P material information, the GPU can determine the corresponding All the intersection points, and the shading operations corresponding to these intersection points are completed, so the GPU does not need to use the material information in the subsequent shading operations corresponding to the remaining intersection points among the M intersection points. In this way, the number of times any material information is swapped in and out between the memory and the cache can be effectively reduced, thereby reducing memory bandwidth and optimizing the performance of electronic devices.
- the target material information is the i-th material information
- the initial value of i is 1.
- the GPU performs intersection calculation based on ray tracing based on the spatial information of the reflector and the spatial information of the N reflected objects
- M intersection points on the N reflected objects can be obtained, and the N reflected objects correspond to P pieces of material information.
- the GPU determines the intersection point corresponding to the first material information, and performs coloring according to the spatial information of the intersection point corresponding to the first material information and the first material information.
- the GPU can also perform the same operation on the second material information as it does on the first material information, until it completes the same operation on the P-th material information as on the first material information, so the GPU can successfully render An image of the reflection of a reflected object in a reflector.
- the GPU separates and executes the intersection calculation and coloring in ray tracing, that is, after uniformly determining the M intersection points, for any one of the P material information, the GPU can determine the corresponding All the intersection points, and the shading operations corresponding to these intersection points are completed, so the GPU does not need to use the material information in the subsequent shading operations corresponding to the remaining intersection points among the M intersection points. In this way, the number of times any material information is swapped in and out between the memory and the cache can be effectively reduced, thereby reducing memory bandwidth and optimizing the performance of electronic devices.
- the intersection module is used to determine, according to the spatial information of the camera, the spatial information of the reflector, and the hierarchical bounding box BVH tree, that the light from the camera will act on the N reflected objects after passing through the reflector.
- the BVH tree is constructed according to the spatial information of N reflected objects.
- each reflected object has a unique number in the BVH tree, and the coloring unit is used for the number of the reflected object where the j-th intersection point is located, If it is located in the number of at least one reflected object corresponding to the i-th material information, coloring is performed according to the spatial information of the j-th intersection point and the i-th material information.
- the device further includes: a first rasterization module, configured to perform rasterization according to the spatial information of the reflector and the material information of the reflector to obtain an image of the reflector; the second rasterization module , for rasterizing according to the spatial information of the N reflected objects and the material information of the N reflected objects, to obtain the images of the N reflected objects; The image of the object is fused with the image reflected in the reflector to obtain the target image.
- a first rasterization module configured to perform rasterization according to the spatial information of the reflector and the material information of the reflector to obtain an image of the reflector
- the second rasterization module for rasterizing according to the spatial information of the N reflected objects and the material information of the N reflected objects, to obtain the images of the N reflected objects
- the image of the object is fused with the image reflected in the reflector to obtain the target image.
- the spatial information includes at least one of a vertex coordinate, a vertex normal, and a triangle index.
- the material information includes at least one of color, metallicity and roughness.
- the third aspect of the embodiments of the present application provides an electronic device, including a memory and a processor; the memory stores codes, and the processor is configured to execute the codes. When the codes are executed, the electronic device performs the same as the first aspect or the second aspect.
- the fourth aspect of the embodiments of the present application provides a computer-readable storage medium, including computer-readable instructions, when the computer-readable instructions are run on the computer, the computer can execute any one of the first aspect or the first aspect. Possible implementations of the methods described.
- a fifth aspect of the embodiments of the present application provides a computer program product, including computer-readable instructions.
- the computer-readable instructions When the computer-readable instructions are run on a computer, the computer is made to perform any one of the possible functions of the first aspect or the first aspect. Implement the method described in the manner.
- the GPU performs intersection calculation based on ray tracing based on the spatial information of the reflector and the spatial information of N reflected objects, M intersection points on N reflected objects and N reflected objects Corresponding to P pieces of material information.
- the GPU determines the intersection point corresponding to the first material information, and performs coloring according to the spatial information of the intersection point corresponding to the first material information and the first material information.
- the GPU can also perform the same operation on the second material information as it does on the first material information, until it completes the same operation on the P-th material information as on the first material information, so the GPU can successfully render An image reflected in a reflective object.
- the GPU separates and executes the intersection calculation and coloring in ray tracing, that is, after uniformly determining the M intersection points, for any one of the P material information, the GPU can determine the corresponding All the intersection points, and the shading operations corresponding to these intersection points are completed, so the GPU does not need to use the material information in the subsequent shading operations corresponding to the remaining intersection points among the M intersection points. In this way, the number of times any material information is swapped in and out between the memory and the cache can be effectively reduced, thereby reducing memory bandwidth and optimizing the performance of electronic devices.
- Figure 1 is a schematic diagram of the principle of ray tracing technology
- FIG. 2 is a schematic diagram of the principle of rasterization technology
- FIG. 3 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
- FIG. 4 is a schematic flowchart of an image rendering method provided by an embodiment of the present application.
- Fig. 5 is a schematic diagram of the BVH tree provided by the embodiment of the present application.
- FIG. 6 is a schematic diagram of image rendering provided by the embodiment of the present application.
- Fig. 7 is a schematic diagram of the target area provided by the embodiment of the present application.
- FIG. 8 is a schematic diagram of an application example of the image rendering method provided by the embodiment of the present application.
- FIG. 9 is another 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 effectively reduce the number of times any material information is swapped in and out between memory and cache, thereby reducing memory bandwidth and optimizing the performance of electronic devices.
- rasterization processing is usually used to render a 3D scene, so as to obtain an image capable of displaying the 3D scene.
- the quality of the image obtained by rendering with rasterization technology is average, and it is often difficult to present a realistic picture. For example, it is usually difficult to truly restore the light reflection, refraction, and shadow effects in the scene in the rendered image.
- a new rendering technology - ray tracing technology came into being. Both ray tracing technology and rasterization technology are used to achieve image rendering, and their main purpose is to project objects in 3D space to two-dimensional screen space for display through computational shading.
- FIG. 1 is a schematic diagram of the principle of the 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 light into the three-dimensional scene, find the nearest intersection point between the light and the geometric figure, and then calculate the coloring of the intersection point . If the material of the intersection point is reflective, you can continue to track in the reflection direction of the intersection point, and continue to calculate the coloring of the intersection point after reflection. That is to say, 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.
- FIG. 2 is a schematic diagram of the principle of the rasterization technology.
- the principle of rasterization processing is: divide the objects in the 3D scene by triangles, transform the 3D coordinates of the vertices of the triangles into 2D coordinates on the image through coordinate change calculations, and finally create the coordinates in the triangles on the image Fill the texture to achieve the rendering of the image.
- the processing difficulty is relatively low, and the light and shadow effect provided is also poor.
- Ray tracing technology achieves realistic effects such as reflection, refraction, shadow, and ambient light occlusion by tracing each light emitted from the camera, so the ray tracing method can provide realistic and realistic light and shadow effects. Therefore, in order to render a more realistic image, current electronic devices usually use a rasterization technology combined with a ray tracing technology to render a three-dimensional scene, so as to improve the user's viewing experience.
- the GPU receives the spatial information of the reflector (for example, the ground), the material information of the reflector, the spatial information of multiple reflected objects (people on the ground, chairs, etc.) and the spatial information of multiple reflected objects sent by the CPU.
- the spatial information of the reflector and the spatial information of multiple reflected objects can be used for intersection calculation, so as to determine multiple intersection points on multiple reflected objects.
- the GPU can perform coloring based on the spatial information of the intersection point and the material information of the reflected object where the intersection point is located. In this way, after completing the coloring operations corresponding to all intersection points, the reflection in the reflector ( For example, an image of a human figure on the ground). At this point, the ray tracing stage in image rendering is completed.
- the GPU can also use the aforementioned rendering information of the 3D scene to perform rasterization, so as to obtain the image of the reflector and the images of multiple reflected objects. So far, the rasterization stage in image rendering is completed. Finally, the image of the reflection in the reflector, the image of the reflector and the images of multiple reflected objects can be fused to obtain the target image of the simulated 3D scene.
- the target image includes the images of each object in the 3D scene and some objects Reflected image.
- the cache memory (cache) of the GPU can usually only cache one material information.
- some of the reflected objects may correspond to the same material information, so the GPU completes the processing of multiple reflected objects in sequence.
- the same material information is frequently swapped in and out between the memory and the cache, resulting in too much memory bandwidth and unbearable for electronic devices.
- an embodiment of the present application provides an image rendering method, which can be executed by an electronic device.
- the electronic device includes a CPU and a GPU capable of rendering images.
- the electronic device may be, for example, 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) devices, wireless electronic devices in industrial control, wireless electronic devices in self driving, wireless electronic devices 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 an Android system, an IOS system, a windows system and other systems.
- Applications that need to render 3D scenes to obtain 2D images can be run on the electronic device, such as game applications, lock screen applications, map applications, or monitoring applications.
- an electronic device 3000 may include: a central processing unit 3001 , a graphics processor 3002 , a display device 3003 and a memory 3004 .
- the electronic device 3000 may further include at least one communication bus (not shown in FIG. 3 ), which is used to realize connection and communication between various components.
- various components in the electronic device 3000 may also be coupled through other connectors, and other connectors may include various interfaces, transmission lines or buses, and the like.
- Various components in the electronic device 3000 may also be connected radially with the central processing unit 3001 as the center.
- coupling refers to being electrically connected or communicating with each other, including direct connection or indirect connection through other devices.
- the central processing unit 3001 and the graphics processing unit 3002 in the electronic device 3000 may be located on the same chip, or may be independent chips.
- the functions of the central processing unit 3001 , the graphics processing unit 3002 , the display device 3003 and the memory 3004 are briefly introduced below.
- the Central processing unit 3001 for running an operating system 3005 and application programs 3006.
- the application program 3006 may be a graphic application program, such as a game, a video player, and the like.
- the operating system 3005 provides a system graphics library interface
- the application program 3006 uses the system graphics library interface and drivers provided by the operating system 3005, such as graphics library user-mode drivers and/or graphics library kernel-mode drivers, to generate graphics or The instruction stream for an image frame, and the associated rendering data required.
- the system graphics library includes but is not limited to: an embedded open graphics library (open graphics library for embedded system, OpenGL ES), the Kronos 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 includes a series of instructions, which are usually calls to the interface of the system graphics library.
- the central processing unit 3001 may include at least one of the following types of processors: an application processor, one or more microprocessors, a digital signal processor (digital signal processor, DSP), a microcontroller (microcontroller unit, MCU) or artificial intelligence processor, etc.
- processors an application processor, one or more microprocessors, a digital signal processor (digital signal processor, DSP), a microcontroller (microcontroller unit, MCU) or artificial intelligence processor, etc.
- the CPU 3001 may further include necessary hardware accelerators, such as application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), or integrated circuits for implementing logic operations.
- ASICs application specific integrated circuits
- FPGAs field programmable gate arrays
- the processor 3001 may be coupled to one or more data buses for transferring data and instructions between the various components of the electronic device 3000 .
- Graphics processor 3002 for receiving the graphics instruction stream sent by the processor 3001, generating a rendering target through a rendering pipeline (pipeline), and displaying the rendering target to the display device 3003 through the layer composition display module of the operating system.
- the rendering pipeline may also be referred to as 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 independently process graphics signals in parallel.
- 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 for executing 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, the image may be a graphical user interface (graphical user interface, GUI) of the operating system or image data (including still images and video images) processed by the graphics processor 3002 data).
- GUI graphical user interface
- the display device 3003 may include any suitable type of display screen.
- a liquid crystal display liquid crystal display, LCD
- a plasma display or an organic light-emitting diode (organic light-emitting diode, OLED) display and the like.
- OLED organic light-emitting diode
- the memory 3004 is a transmission channel between the central processing unit 3001 and the graphics processing unit 3002, and may 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
- Offscreen render pass The image rendered through this pass is usually an image that does not need to be displayed on the screen temporarily. This part of the image can be stored in the frame buffer assigned to the off-screen render pass.
- the frame buffer can be called an off-screen rendering buffer, and is used to store images that do not need to be displayed on the screen temporarily.
- the off-screen rendering pass can be used to implement ray tracing techniques.
- the image rendered through this pass is usually the image to be displayed on the screen (that is, the image sent to display), and this part of the image can be stored in the frame buffer assigned to the current screen rendering pass Area (framebuffer), the frame buffer can be called the current screen rendering buffer, used to store the image to be displayed on the screen.
- the current screen rendering pass can be used to implement the rasterization technology.
- Fig. 4 is a schematic flow chart of the image rendering method provided by the embodiment of the present application. As shown in Fig. 4, the method includes:
- the CPU of the electronic device can analyze the rendering information of each object in the 3D scene.
- 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 information such as 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 metalness of the object and the roughness of the object and other information.
- the material information of different objects can be the same (type) material information (that is, different objects correspond to the same material information), or multiple (types) material information (that is, different objects correspond to multiple material information) ), it can be seen that the number of objects is generally greater than or equal to the number of material information.
- the 3D scene contains ground, people, chairs and tables, and the chairs and tables are made of the same material.
- the material information of the ground is material information A
- the material information of people is material information B
- the material information of chairs and tables is material information C.
- the CPU may determine the category of the object based on the material information of the object. Specifically, after the CPU obtains the material information of an object, it can determine whether the object is a reflective object based on the metallicity of the object. If the metallicity of the object is greater than or equal to a preset threshold, the object can be determined to be a reflective object. object, if the metallicity of the object is less than the preset threshold, it can be determined that the object is a reflected object.
- the metalness of objects such as the ground, mirrors, and lakes is usually greater than the preset threshold, so these objects can be called reflectors, while the metalness of objects such as people and tables is usually smaller than the preset threshold, so these objects can be called reflectors. called the reflected object.
- the CPU can classify all objects in the three-dimensional scene into two types of objects, ie reflectors and reflected objects.
- the 3D scene contains only one reflector and multiple reflected objects for schematic illustration below.
- the CPU can construct a BVH tree based on the spatial information of all reflected objects, and the BVH tree can be used to implement subsequent ray tracing operations. Specifically, the CPU can construct a BVH tree according to the vertex coordinates, vertex normals, and triangle indexes of the object being reflected.
- Fig. 5 is a schematic diagram of the BVH tree provided by the embodiment of the present application. As shown in Fig. 5, there are 6 reflected objects in the three-dimensional scene, and the bounding box A (enclosed) can be determined based on the spatial information of the 6 reflected objects.
- the spatial information of these 6 objects), the spatial information of the bounding box B (surrounding these 4 objects) can be determined based on the spatial information of 4 of the reflected objects, and the bounding box C can be determined based on the spatial information of the remaining 2 reflected objects (enclosing these two objects), manage the spatial information of the bounding box A, the spatial information of the bounding box B, and the spatial information of the bounding box C 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 the bounding box A, the bounding box B and the bounding box C, which is equivalent to the centralized management of the bounding box A, the bounding box B and the bounding box C.
- the bounding box A is the largest bounding box among all the bounding boxes. It is worth noting that each of the six reflected objects has a unique number in the BVH tree, as shown in Figure 5, counting from left to right, the number of these six reflected objects is 11 , 12, 13, 14, 21 and 22.
- the GPU of the electronic device implements ray tracing based on the BVH tree, it is necessary to calculate whether the ray intersects with the reflected object in the three-dimensional scene (ie, intersection calculation). Due to the existence of the BVH tree, the GPU can determine a bounding box surrounding the reflected object based on the BVH tree, and then judge whether the ray intersects the bounding box. If the ray does not touch the bounding box, it means that the ray will not touch the bounding box. Intersect the reflected object in the bounding box; if the ray hits the bounding box, then calculate whether the ray intersects the reflected object in the bounding box.
- the CPU can also obtain the spatial information of the camera, which is used to shoot the target image of the simulated three-dimensional scene.
- the spatial information of the camera may include the vertical height of the camera and the coordinates of the camera.
- the CPU gets the rendering information of the reflector (including the spatial information of the reflector and the material information of the reflector), the rendering information of all the reflected objects (including the spatial information of all the reflected objects and the material information of all the reflected objects), and the BVH tree And the spatial information of the camera, then send this part of information to the GPU, so that the GPU can perform image rendering according to this part of information.
- intersection points determine the intersection point corresponding to the i-th material information, and perform coloring according to the spatial information of the intersection point corresponding to the i-th material information and the i-th material information, and the initial value of i is 1.
- the GPU gets the rendering information of the reflector (including the spatial information of the reflector and the material information of the reflector), the rendering information of all the reflected objects (including the spatial information of all the reflected objects and the material information of all the reflected objects), and the BVH tree And after the spatial information of the camera, image rendering can be performed based on this part of the information.
- the image rendering performed by the GPU includes two stages, that is, the ray tracing stage (ie step 402 to step 404 in this embodiment) and the rasterization stage (ie step 405 to step 406 in this embodiment) .
- the ray tracing phase includes two sub-phases, the first sub-phase is intersection calculation, and the second sub-phase is coloring.
- the GPU can completely separate these two sub-phases for execution, thereby optimizing the entire ray tracing process.
- FIG. 6 is a schematic diagram of image rendering provided by the embodiment of the present application.
- the GPU is provided with a rendering pipeline 601 for the off-screen rendering pass, and the rendering pipeline 601 includes a vertex shader (vertex shader, VS) 6011, a fragment shader (frag shader, FS) 6012 and a fragment shader 6013.
- vertex shader vertex shader, VS
- fragment shader fragment shader, FS
- the fragment shader 6012 is provided with the part related to the intersection calculation in the ray tracing algorithm
- the fragment shader 6013 is provided with the part related to the coloring in the ray tracing algorithm
- the fragment shader 6012 and the fragment shader 6013 can be Commonly used to implement ray tracing.
- the GPU can process the spatial information of the reflector and the BVH tree through the vertex shader 6011 and the fragment shader 6012, that is, through these two shaders, perform intersection calculation based on ray tracing based on these information, and obtain N
- the M intersection points on the reflected object it can be understood that the N reflected objects are the reflected objects that have intersection points with the light emitted by the camera among all the reflected objects.
- each reflected object has at least one intersection point, so M ⁇ N ⁇ 1.
- the N reflected objects correspond to P pieces (types) of material information, and N ⁇ P ⁇ 1.
- intersection calculation based on ray tracing is performed on the entire reflector, that is, the camera is used as the light source, and light is emitted to each vertex of the reflector, and then the route calculation and intersection calculation are performed for each ray, the calculation involved
- the quantity is quite large.
- not every ray can intersect the object to be reflected, so the calculation based on the invalid ray (that is, the ray that does not intersect the object to be reflected) is an invalid calculation.
- the reflection in the reflector is actually the influence or mirror image of the reflected object in the reflector, etc., so a certain block area containing the reflection can be determined as the target area in the reflector, if the light hits The target area of the reflector, then this part of the light (effective light) will intersect with the reflected object after passing through this area. If the light hits the reflector, other than the target area, then this part of the light will not intersect with the reflected object after passing through this area. It can be seen that if only the intersection calculation based on ray tracing is performed on the target area, the calculation amount of ray tracing can be effectively reduced, thereby saving the computing power of the GPU and reducing the power consumption of image rendering.
- the GPU can determine the target area of reflectors in the following ways:
- the GPU can determine the spatial information of the largest bounding box from the BVH tree, and then determine the spatial information of the target area of the reflector from the spatial information of the reflector according to the spatial information of the largest bounding box and the spatial information of the camera. After obtaining the spatial information of the target area of the reflector, it is equivalent to determining the target area of the reflector. Specifically, any vertex in the largest bounding box is set as the first target point, and any vertex in the target area of the reflector is set as the second target point.
- H1 is determined based on the coordinates of the camera and the coordinates of the second target point
- X1 is determined based on the coordinates of the camera and the first The coordinates of the target point are determined.
- the spatial information of the reflector includes the coordinates of each vertex in the reflector, so the GPU can judge whether the coordinates of each vertex in the reflector satisfy the aforementioned mathematical relationship. If the coordinates of a certain vertex satisfy the aforementioned mathematical relationship, the vertex is a reflector A vertex in the target region of . In this way, the reflector can be divided into the target area and other areas except the target area.
- the GPU can also divide the spatial information of the reflector into the spatial information of the target area and the spatial information of the remaining areas, but for the target area and the remaining areas, the material information of the two areas is the same (that is, the material information of the reflector , because the material information of the entire reflector is uniform).
- FIG. 7 is a schematic diagram of the target area provided by the embodiment of the present application.
- a certain three-dimensional scene is assumed to be a person standing on the ground and the reflection of a person on the ground.
- the largest bounding box in the scene may be determined first, and the largest bounding box is the bounding box surrounding the character.
- the target area on the ground can be determined, and the target area includes the reflection of the person.
- the GPU can input the spatial information of the target area of the reflector (for example, the coordinates of the vertex of the reflector and the normal of the vertex of the reflector) into the vertex shader 6011, and the vertex shader 6011 may perform certain calculation processing on this part of the spatial information (for example, transforming three-dimensional coordinates into two-dimensional coordinates, etc.), and input the processed spatial information into the fragment shader 6012 .
- the spatial information of the target area of the reflector for example, the coordinates of the vertex of the reflector and the normal of the vertex of the reflector
- the vertex shader 6011 may perform certain calculation processing on this part of the spatial information (for example, transforming three-dimensional coordinates into two-dimensional coordinates, etc.), and input the processed spatial information into the fragment shader 6012 .
- the GPU will directly input the camera's spatial information and BVH tree into the fragment shader 6012, so the fragment shader 6012 can perform intersection calculations based on the camera's spatial information, the processed spatial information, and the BVH tree to determine the After the light passes through the reflector, it acts on the M intersection points obtained on the N reflected objects.
- the GPU can save the number of the reflected object where each intersection point is located and the spatial information of the intersection point (the intersection point is a vertex in nature, so the spatial information of the intersection point includes the coordinates and normal of the vertex, etc.).
- the GPU can use the fragment shader 6013 to determine the intersection point corresponding to the first material information in the P material information among the M intersection points, and according to the space of the intersection point corresponding to the first material information information and the first material information for coloring. It should be noted that the GPU can also perform the same operation on the second material information as it does on the first material information, until it completes the same operation on the P-th material information as on the first material information, so the GPU can The image of the reflection in the reflective object is successfully rendered, for example, the image of the reflection of the person in Figure 7.
- intersection points 1, 2, 3, 4, 5 and 6 wherein, intersection 1 and intersection 2 are located on the reflected object 11, intersection 3 and intersection 4 are located on the reflected object 12, and intersection 5 is located on the object to be reflected
- the intersection 6 is located on the reflected object 22
- the reflected object 11 corresponds to the material information 1
- the reflected object 12 corresponds to the material information 2
- the reflected object 21 and the reflected object 22 correspond to the material information 3 .
- the GPU can determine that the intersection points corresponding to the material information 1 are the intersection point 1 and the intersection point 2, and perform coloring according to the spatial information of the two intersection points and the material information 1 .
- the GPU may determine that the intersection points corresponding to the material information 2 are intersection points 3 and 4, and perform coloring according to the spatial information of the two intersection points and the material information 2 . Then, the GPU may determine that the intersection points corresponding to the material information 3 are the intersection points 5 and 6, and perform coloring according to the spatial information of the two intersection points and the material information 3 . In this way, the GPU can obtain images reflected in reflective objects.
- the GPU can render a pixel based on the information of an intersection (that is, the image of the reflection in the reflector contains M pixels), then the GPU can render the reflection in the reflector in the following way Image:
- the GPU may input the first material information among the P pieces of material information and the space information of the M intersection points to the fragment shader 6013 . Then, the input fragment shader 6013 can judge whether the object to be reflected at the first intersection point among the M intersection points corresponds to the first material information, if the object to be reflected at the first intersection point corresponds to the first material information, The fragment shader 6013 performs coloring according to the spatial information of the first intersection point and the first material information, and obtains the first pixel of the reflected image in the reflector. If the material information does not correspond, it ends. Thereafter, the fragment shader 6013 may perform the same operation on the second intersection point as on the first intersection point until the operation on the Mth intersection point is completed as on the first intersection point.
- the GPU can input the second material information of the P material information and the space information of the M intersection points into the fragment shader 6013, so that the fragment shader 6013 can re-execute the above process until the GPU combines the P material information and the M
- the spatial information of the intersection points is input to the fragment shader 6013, so that the above process is re-executed on the fragment shader 6013. So far, the fragment shader 6013 can obtain M pixels of the image reflected in the reflector, which is equivalent to obtaining the image reflected in the reflector.
- fragment shader 6013 can determine whether the reflected object where a certain intersection point is located corresponds to a certain material information in the following manner:
- the fragment shader 6013 can determine whether the number of the reflected object where the intersection point is located (which can be input to the fragment shader 6013 by the GPU) is located in this In the number of all reflected objects corresponding to the material information (which can be input by the GPU to the fragment shader 6013 ), if yes, perform coloring according to the space information of the intersection point and the material information, if not, end.
- the GPU After getting the image of the reflection in the reflector, the GPU can complete the ray tracing stage of image rendering.
- the GPU After obtaining the rendering information of the reflector (including the spatial information of the reflector and the material information of the reflector) and the rendering information of all the reflected objects (including the spatial information of all the reflected objects and the material information of all the reflected objects), the GPU also The rasterization stage of image rendering can be implemented based on this information.
- the GPU is provided with two rendering pipelines for the current screen rendering pass, which are respectively a rendering pipeline 602 and a rendering pipeline 603 .
- the rendering pipeline 602 includes a vertex shader 6021 and a fragment shader 6022
- the rendering pipeline 603 includes a vertex shader 6031 and a fragment shader 6032
- the fragment shader 6022 and the fragment shader 6032 are original fragment shaders (ie No algorithm is set inside), so both the fragment shader 6022 and the fragment shader 6032 can be used to perform the rasterization step, where the fragment shader 6022 is used to perform the rasterization of the reflector, and the fragment shader 6032 is used to perform the reflected Rasterization of objects.
- the GPU can input the rendering information of the reflective object into the rendering pipeline 602, so that the rendering pipeline 602 performs rasterization according to the rendering information of the reflective object, that is, rasterizes the reflective object to obtain an image of the reflective object.
- the GPU can input the spatial information of the reflector (for example, the coordinates of the vertices of the reflector) into the vertex shader, and the vertex shader 6021 can perform certain calculation processing on this part of the spatial information, and input the processed spatial information Fragment shader 6022.
- the GPU will directly input the material information of the reflector into the fragment shader 6022, so the fragment shader 6022 can perform rasterization operations based on the processed spatial information and the material information of the reflector to obtain the image in the reflector.
- the GPU can also input the rendering information of all the reflected objects into the rendering pipeline 603, so that the rendering pipeline 603 performs rasterization according to the rendering information of all the reflected objects, that is, rasterizes all the reflected objects to obtain images of all the reflected objects.
- the GPU can input the spatial information of all reflected objects (for example, the coordinates of vertices of all reflected objects) into the vertex shader, and the vertex shader 6031 can perform certain calculation processing on this part of the spatial information, and the processed The spatial information of is input to the fragment shader 6032.
- the GPU will directly input the material information of all the reflected objects into the fragment shader 6032, so the fragment shader 6032 can perform rasterization operations based on the processed spatial information and the material information of all the reflected objects, so as to obtain all the reflected objects images in objects. So far, the GPU has successfully rendered the images of the reflector and all the reflected objects, for example, the image of the ground and the images of people in Figure 7 .
- the GPU can fuse the image of the reflector, the images of all the reflected objects and the image of the reflection in the reflector to obtain the target for display
- the image for example, the target image may present a three-dimensional scene as shown in FIG. 7 , that is, a person standing on the ground and a reflection of a person on the ground.
- the CPU can acquire the target image from the current screen rendering buffer, and send the target image to the screen for display by the user.
- the ray tracing phase and the rasterization phase may be performed synchronously or asynchronously, which is not limited here.
- step 402 and step 404 (or step 405) can be performed simultaneously.
- step 402 may be performed prior to step 404 (or step 405).
- step 402 may be performed after step 404 (or step 405).
- step 404 and step 405 in the rasterization stage may be performed synchronously or asynchronously, which is not limited here.
- step 404 and step 405 can be performed simultaneously.
- step 404 may be performed prior to step 405 .
- step 404 may be performed after step 405 .
- step 401 to step 407 can be performed on the reflector and all reflected objects in the three-dimensional scene, and the simulation of the three-dimensional scene can also be obtained. target image.
- each material information in the P pieces of material information corresponds to at least one of the N reflected objects for a schematic illustration, and the quantity of material information and the number of reflected objects are not discussed.
- Each of the reflected objects corresponds to at least one piece of material information among the P pieces of material information, then N ⁇ P, and P>1.
- the GPU performs intersection calculation based on ray tracing based on the spatial information of the reflector and the spatial information of N reflected objects, M intersection points on N reflected objects and N reflected objects Corresponding to P pieces of material information.
- the GPU determines the intersection point corresponding to the first material information, and performs coloring according to the spatial information of the intersection point corresponding to the first material information and the first material information.
- the GPU can also perform the same operation on the second material information as it does on the first material information, until it completes the same operation on the P-th material information as on the first material information, so the GPU can successfully render An image reflected in a reflective object.
- the GPU separates and executes the intersection calculation and coloring in ray tracing, that is, after uniformly determining the M intersection points, for any one of the P material information, the GPU can determine the corresponding All the intersection points, and the shading operations corresponding to these intersection points are completed, so the GPU does not need to use the material information in the subsequent shading operations corresponding to the remaining intersection points among the M intersection points. In this way, the number of times any material information is swapped in and out between the memory and the cache can be effectively reduced, thereby reducing memory bandwidth and optimizing the performance of electronic devices.
- Fig. 8 is a schematic diagram of an application example of the image rendering method provided by the embodiment of the present application. As shown in Fig. 8, in this application example, an additional plug-in can be added to the Unity program, and the plug-in is used to realize the 4 shows the method.
- the program when the program is executing the initialization (awake) stage, the original data in the 3D scene can be passed into the plug-in.
- the program When the program is executing the update stage of a certain frame, it can update the rendering information of the reflector corresponding to the frame, the rendering information of the reflected object, the spatial information of the camera, etc. based on the original data, and based on the Rendering information builds a BVH tree, and then updates this part of information to the plug-in.
- the plug-in When the program executes the rendering (on post render) stage, the plug-in is called through the plug-in interface, and the plug-in transmits the aforementioned information to the GPU, and the GPU uses the rendering method provided by the plug-in to complete the rendering to obtain the final target image for display.
- Fig. 9 is another schematic structural diagram of an image rendering device provided by an embodiment of the present application. As shown in Fig. 9, the image rendering device includes:
- the intersection module 901 is used to perform intersection calculation based on ray tracing according to the spatial information of the reflector and the spatial information of the reflected object, to obtain M intersection points on the reflected object, and the reflected object corresponds to P material information, M ⁇ 1;
- the coloring module 902 is configured to determine a plurality of intersection points corresponding to the target material information among the M intersection points, and perform coloring according to the spatial information of the plurality of intersection points corresponding to the target material information and the target material information, so as to obtain the reflected object in the reflector Reflected image, the target material information is one of multiple material information.
- the GPU performs intersection calculation based on ray tracing based on the spatial information of the reflector and the spatial information of the reflected object
- M intersection points on the reflected object can be obtained, and the reflected object corresponds to P pieces of material information.
- the GPU determines all intersection points corresponding to the target material information, and performs coloring according to the spatial information of all intersection points corresponding to the target material information and the target material information, to obtain an image of the reflection of the reflected object in the reflector.
- the GPU separates and executes the intersection calculation and shading in ray tracing, that is, after uniformly determining the M intersection points, for a certain material information among the P material information, the GPU can determine the corresponding All the intersection points, and the shading operations corresponding to these intersection points are completed, so the GPU does not need to use the material information in the subsequent shading operations corresponding to the remaining intersection points among the M intersection points. In this way, the number of times any material information is swapped in and out between the memory and the cache can be effectively reduced, thereby reducing memory bandwidth and optimizing the performance of electronic devices.
- the plurality of material information is P
- the target material information is the i-th material information
- the initial value of i is 1
- the intersection module is configured to determine, according to the spatial information of the camera, the spatial information of the reflector, and the hierarchical bounding box BVH tree, that the light from the camera acts on the reflected object after passing through the reflector.
- the obtained M intersection points, the BVH tree is constructed according to the spatial information of the reflected object.
- each reflected object has a unique number in the BVH tree, and the coloring unit is used for the number of the reflected object where the j-th intersection point is located at the i-th In the number of at least one reflected object corresponding to the material information, coloring is performed according to the spatial information of the j-th intersection point and the i-th material information.
- the device further includes: a first rasterization module, configured to perform rasterization according to the spatial information of the reflector and the material information of the reflector to obtain an image of the reflector; a second rasterization module, It is used to perform rasterization according to the spatial information of the reflected object and the material information of the reflected object to obtain the image of the reflected object; the fusion module is used to combine the image of the reflected object, the image of the reflected object and the image reflected in the reflective object Fusion is performed to obtain the target image.
- a first rasterization module configured to perform rasterization according to the spatial information of the reflector and the material information of the reflector to obtain an image of the reflector
- a second rasterization module It is used to perform rasterization according to the spatial information of the reflected object and the material information of the reflected object to obtain the image of the reflected object
- the fusion module is used to combine the image of the reflected object, the image of the reflected object and the image reflected
- the spatial information includes at least one of a vertex coordinate, a vertex normal, and a triangle index.
- the material information includes at least one of color, metallicity and roughness.
- the embodiment of the present application also relates to a computer-readable storage medium, including computer-readable instructions.
- the computer-readable instructions When the computer-readable instructions are run on the computer, the computer is made to execute the method described in the embodiment shown in FIG. 4 .
- the embodiment of the present application also relates to a computer program product, including computer-readable instructions, and when the computer-readable instructions are run on a computer, the computer is made to execute the method described in the embodiment shown in FIG. 4 .
- the disclosed system, device and method 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 can be combined or May be integrated into another system, or some features may be ignored, or not implemented.
- the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of 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 may be distributed to multiple network units. Part 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 may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
- the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
- the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
- the technical solution of the present application is essentially or part of the contribution to the prior art 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 make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
- the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Generation (AREA)
Abstract
Description
Claims (19)
- 一种图像渲染方法,其特征在于,所述方法包括:S1:根据反射物的空间信息以及被反射物的空间信息进行基于光线追踪的求交计算,得到所述被反射物上的M个交点,所述被反射物对应多个材质信息,M≥1;S2:在所述M个交点中,确定目标材质信息对应的多个交点,并根据所述目标材质信息对应的多个交点的空间信息以及所述目标材质信息进行着色,得到所述反射物中所述被反射物的倒影的图像,所述目标材质信息为所述多个材质信息中的一个。
- 根据权利要求1所述的方法,其特征在于,所述多个材质信息为P个,所述目标材质信息为第i个材质信息,i的初始值为1,所述S2包括:S21:在所述M个交点中,确定所述第i个材质信息对应的多个交点,并根据所述第i个材质信息对应的所述多个交点的空间信息以及所述第i个材质信息进行着色;S22:令i=i+1,并重新执行所述S21,直至i=P,得到所述反射物中所述被反射物的倒影的图像。
- 根据权利要求2所述的方法,其特征在于,所述S21包括:S211:若第j个交点所在的被反射物与第i个材质信息对应,则根据所述第j个交点的空间信息与所述第i个材质信息进行着色,得到所述反射物中倒影的图像的第j个像素点,j的初始值为1;S212:令j=j+1,并重新执行所述S211,直至j=M。
- 根据权利要求3所述的方法,其特征在于,所述S1包括:根据相机的空间信息、反射物的空间信息以及层次包围盒BVH树,确定来自所述相机的光线经过所述反射物后,作用于所述被反射物上所得到的M个交点,所述BVH树根据被反射物的空间信息构建。
- 根据权利要求4所述的方法,其特征在于,在所述被反射物中,每个被反射物在所述BVH树中具有唯一的编号,所述S211包括:若第j个交点所在的被反射物的编号,位于第i个材质信息对应的至少一个被反射物的编号中,则根据所述第j个交点的空间信息与所述第i个材质信息进行着色。
- 根据权利要求1至5任意一项所述的方法,其特征在于,所述方法还包括:S4:根据所述反射物的空间信息和所述反射物的材质信息进行光栅化,得到所述反射物的图像;S5:根据所述被反射物的空间信息和所述被反射物的材质信息进行光栅化,得到所述被反射物的图像;S6:将所述反射物的图像、所述被反射物的图像和所述反射物中倒影的图像进行融合,得到目标图像。
- 根据权利要求1至6任意一项所述的方法,其特征在于,所述空间信息包含顶点坐标、顶点法线和三角形索引中的至少一种。
- 根据权利要求1至7任意一项所述的方法,其特征在于,所述材质信息包含颜色、金属度以及粗糙度中的至少一种。
- 一种图像渲染装置,其特征在于,所述装置包括:求交模块,用于根据反射物的空间信息以及被反射物的空间信息进行基于光线追踪的求交计算,得到所述被反射物上的M个交点,所述被反射物对应P个材质信息,M≥1;着色模块,用于在所述M个交点中,确定目标材质信息对应的多个交点,并根据所述目标材质信息对应的多个交点的空间信息以及所述目标材质信息进行着色,得到所述反射物中所述被反射物的倒影的图像,所述目标材质信息为所述多个材质信息中的一个。
- 根据权利要求9所述的装置,其特征在于,所述多个材质信息为P个,所述目标材质信息为第i个材质信息,i的初始值为1,所述着色模块包括:着色子模块:在所述M个交点中,确定所述第i个材质信息对应的多个交点,并根据所述第i个材质信息对应的所述多个交点的空间信息以及所述第i个材质信息进行着色;循环子模块:令i=i+1,并重新触发所述着色子模块,直至i=P,得到所述反射物中所述被反射物的倒影的图像。
- 根据权利要求10所述的装置,其特征在于,所述着色子模块,包括:着色单元,用于若第j个交点所在的被反射物与第i个材质信息对应,则根据所述第j个交点的空间信息与所述第i个材质信息进行着色,得到所述反射物中倒影的图像的第j个像素点,j的初始值为1;循环单元,用于令j=j+1,并重新触发所述着色单元,直至j=M。
- 根据权利要求11所述的装置,其特征在于,所述求交模块,用于根据相机的空间信息、反射物的空间信息以及层次包围盒BVH树,确定来自所述相机的光线经过所述反射物后,作用于所述被反射物上所得到的M个交点,所述BVH树根据被反射物的空间信息构建。
- 根据权利要求12所述的装置,其特征在于,在所述被反射物中,每个被反射物在所述BVH树中具有唯一的编号,所述着色单元,用于若第j个交点所在的被反射物的编号,位于第i个材质信息对应的至少一个被反射物的编号中,则根据所述第j个交点的空间信息与所述第i个材质信息进行着色。
- 根据权利要求9至13任意一项所述的装置,其特征在于,所述装置还包括:第一光栅化模块,用于根据所述反射物的空间信息和所述反射物的材质信息进行光栅化,得到所述反射物的图像;第二光栅化模块,用于根据所述被反射物的空间信息和所述被反射物的材质信息进行光栅化,得到所述被反射物的图像;融合模块,用于将所述反射物的图像、所述被反射物的图像和所述反射物中倒影的图像进行融合,得到目标图像。
- 根据权利要求9至14任意一项所述的装置,其特征在于,所述空间信息包含顶点坐标、顶点法线和三角形索引中的至少一种。
- 根据权利要求9至15任意一项所述的装置,其特征在于,所述材质信息包含颜色、金属度以及粗糙度中的至少一种。
- 一种电子设备,其特征在于,包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为执行所述代码,当所述代码被执行时,所述电子设备执行如权利要求1至8任一所述的方法。
- 一种计算机可读存储介质,其特征在于,包括计算机可读指令,当所述计算机可读指 令在计算机上运行时,使得所述计算机执行如权利要求1至8中任一项所述的方法。
- 一种计算机程序产品,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机上运行时,使得所述计算机执行如权利要求1至8任一项所述的方法。
Priority Applications (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US18/696,019 US20240378793A1 (en) | 2021-09-30 | 2022-09-29 | Image rendering method and related device |
| EP22875045.1A EP4386682A4 (en) | 2021-09-30 | 2022-09-29 | IMAGE DISPLAY METHOD AND ASSOCIATED DEVICE THEREFOR |
| CN202280057482.7A CN117957576A (zh) | 2021-09-30 | 2022-09-29 | 一种图像渲染方法及其相关设备 |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111163949.X | 2021-09-30 | ||
| CN202111163949.XA CN115908683A (zh) | 2021-09-30 | 2021-09-30 | 一种图像渲染方法及其相关设备 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2023051662A1 true WO2023051662A1 (zh) | 2023-04-06 |
Family
ID=85739430
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2022/122427 Ceased WO2023051662A1 (zh) | 2021-09-30 | 2022-09-29 | 一种图像渲染方法及其相关设备 |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US20240378793A1 (zh) |
| EP (1) | EP4386682A4 (zh) |
| CN (2) | CN115908683A (zh) |
| WO (1) | WO2023051662A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025015971A1 (zh) * | 2023-07-14 | 2025-01-23 | 优三缔科技(上海)有限公司 | 用于多应用的非集成的单引擎后台渲染方法、系统以及设备 |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120451355A (zh) * | 2024-02-08 | 2025-08-08 | 华为技术有限公司 | 一种光线追踪方法、装置和图像渲染系统 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5966134A (en) * | 1996-06-28 | 1999-10-12 | Softimage | Simulating cel animation and shading |
| CN105261059A (zh) * | 2015-09-18 | 2016-01-20 | 浙江大学 | 一种基于在屏幕空间计算间接反射高光的渲染方法 |
| CN106504185A (zh) * | 2016-10-26 | 2017-03-15 | 腾讯科技(深圳)有限公司 | 一种渲染优化方法和装置 |
| CN112396684A (zh) * | 2020-11-13 | 2021-02-23 | 贝壳技术有限公司 | 光线追踪方法、装置及机器可读存储介质 |
| CN112799773A (zh) * | 2021-02-23 | 2021-05-14 | 京东方科技集团股份有限公司 | 一种数据可视化方法、终端设备、系统和存储介质 |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US10565776B2 (en) * | 2015-12-12 | 2020-02-18 | Adshir Ltd. | Method for fast generation of path traced reflections on a semi-reflective surface |
| WO2019224804A1 (en) * | 2018-05-21 | 2019-11-28 | Adshir Ltd. | Fast generation of ray traced reflections of virtual objects in real world environment |
| US10825230B2 (en) * | 2018-08-10 | 2020-11-03 | Nvidia Corporation | Watertight ray triangle intersection |
| CN109961498B (zh) * | 2019-03-28 | 2022-12-13 | 腾讯科技(深圳)有限公司 | 图像渲染方法、装置、终端及存储介质 |
-
2021
- 2021-09-30 CN CN202111163949.XA patent/CN115908683A/zh active Pending
-
2022
- 2022-09-29 CN CN202280057482.7A patent/CN117957576A/zh active Pending
- 2022-09-29 EP EP22875045.1A patent/EP4386682A4/en active Pending
- 2022-09-29 WO PCT/CN2022/122427 patent/WO2023051662A1/zh not_active Ceased
- 2022-09-29 US US18/696,019 patent/US20240378793A1/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5966134A (en) * | 1996-06-28 | 1999-10-12 | Softimage | Simulating cel animation and shading |
| CN105261059A (zh) * | 2015-09-18 | 2016-01-20 | 浙江大学 | 一种基于在屏幕空间计算间接反射高光的渲染方法 |
| CN106504185A (zh) * | 2016-10-26 | 2017-03-15 | 腾讯科技(深圳)有限公司 | 一种渲染优化方法和装置 |
| CN112396684A (zh) * | 2020-11-13 | 2021-02-23 | 贝壳技术有限公司 | 光线追踪方法、装置及机器可读存储介质 |
| CN112799773A (zh) * | 2021-02-23 | 2021-05-14 | 京东方科技集团股份有限公司 | 一种数据可视化方法、终端设备、系统和存储介质 |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP4386682A4 |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025015971A1 (zh) * | 2023-07-14 | 2025-01-23 | 优三缔科技(上海)有限公司 | 用于多应用的非集成的单引擎后台渲染方法、系统以及设备 |
Also Published As
| Publication number | Publication date |
|---|---|
| EP4386682A1 (en) | 2024-06-19 |
| EP4386682A4 (en) | 2024-11-13 |
| CN115908683A (zh) | 2023-04-04 |
| US20240378793A1 (en) | 2024-11-14 |
| CN117957576A (zh) | 2024-04-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12148088B2 (en) | Method for continued bounding volume hierarchy traversal on intersection without shader intervention | |
| US11302057B2 (en) | Rendering of soft shadows | |
| CN113808241B (zh) | 共享顶点的射线追踪图元的硬件加速 | |
| US20230316633A1 (en) | Image processing method and related apparatus | |
| CN114758051B (zh) | 一种图像渲染方法及其相关设备 | |
| CN107408312B (zh) | 光线追踪应用中的有效层次结构遍历 | |
| CN117157676A (zh) | 加速实时光线追踪的三角形可见性测试 | |
| US10628995B2 (en) | Anti-aliasing of graphical elements defined based on functions | |
| KR20240001021A (ko) | 이미지 렌더링 방법, 장치, 전자 설비 및 저장 매체 | |
| CN110827389A (zh) | 严密的光线三角形相交 | |
| WO2024027237A1 (zh) | 渲染的优化方法、电子设备和计算机可读存储介质 | |
| US20130127895A1 (en) | Method and Apparatus for Rendering Graphics using Soft Occlusion | |
| US20110043523A1 (en) | Graphics processing apparatus for supporting global illumination | |
| CN117726496A (zh) | 使用光线剪裁减少假阳性光线遍历 | |
| KR102151443B1 (ko) | 하이브리드 gpu 아키텍처 기반의 그래픽 처리 장치 | |
| WO2023051662A1 (zh) | 一种图像渲染方法及其相关设备 | |
| CN117726732A (zh) | 减少包围体层次结构中的假阳性光线遍历 | |
| CN103426199A (zh) | 一种三维几何场景的低噪声实时全局光照绘制方法 | |
| CN103679818B (zh) | 一种基于虚拟面光源的实时场景绘制方法 | |
| TW202141429A (zh) | 使用陰影資訊進行渲染 | |
| WO2024002130A1 (zh) | 一种图像渲染方法及其相关设备 | |
| CN117726743A (zh) | 使用点退化剔除减少假阳性光线遍历 | |
| CN121392104A (zh) | 渲染处理方法、装置、设备、存储介质及程序产品 | |
| HK40095360A (zh) | 图像渲染方法、装置、计算机设备和存储介质 | |
| KR20080077748A (ko) | 컴퓨터 그래픽 시스템에서의 동영상의 반사 효과 처리 방법 |
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: 22875045 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 202280057482.7 Country of ref document: CN |
|
| ENP | Entry into the national phase |
Ref document number: 2022875045 Country of ref document: EP Effective date: 20240311 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 18696019 Country of ref document: US |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |