Image rendering method, device, storage medium and program product
By dividing the rendering object into multiple planar units and using rasterization technology for ray tracing, the problem of high computational complexity in ray tracing algorithms is solved, achieving efficient image rendering effects, reducing hardware performance requirements, and making it suitable for real-time rendering applications.
Patent Information
- Application Number
- CN202411570574.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2044-11-05
AI Technical Summary
Existing ray tracing algorithms have high computational complexity in computer graphics rendering, making it difficult to meet the needs of real-time rendering. Furthermore, the performance of ordinary GPU hardware is limited, making it difficult to support high-quality ray tracing rendering.
The rendering object is divided into multiple planar units, and ray tracing is performed using rasterization technology. By calculating the intersection results of reflected rays on each planar unit, the computational complexity is reduced and the parallel processing capability is improved.
It improves the efficiency of ray intersection, reduces the requirements for GPU hardware performance, and enhances image rendering efficiency and quality, making it suitable for real-time rendering applications.
Smart Images

Figure CN119762655B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer graphics technology, and more particularly to an image rendering method, apparatus, storage medium, and program product. Background Technology
[0002] Ray tracing is a physically based rendering technique that simulates complex light propagation and interaction effects, providing high-quality rendering results. It is widely used in computer graphics (CG) rendering. Because ray tracing algorithms require significant computational resources to simulate light propagation and interaction effects, they demand very high performance from graphics processing units (GPUs). However, the limited computational resources of typical GPUs make it difficult to meet the computational demands of ray tracing algorithms. Summary of the Invention
[0003] In view of this, embodiments of this application provide an image rendering method, an image rendering apparatus, a computer storage medium, and a computer program product that can improve rendering quality while reducing hardware performance requirements.
[0004] To achieve the above objectives, the technical solution of this application embodiment is implemented as follows:
[0005] This application provides an image rendering method, the method comprising: dividing a rendering object into multiple planar units; performing rasterization processing on each planar unit to obtain a target patch on a display plane for each planar unit; the target patch comprising multiple pixels; for each planar unit, determining the reflected light rays formed by each light source point of the rendering object in the planar unit; wherein the light source point is determined according to a preset initial light ray; and rendering the target patch according to the reflected light rays.
[0006] In some embodiments, the planar unit includes a plurality of vertices; determining the reflected light rays formed by each light source point of the rendering object in the planar unit for each of the planar units includes: determining the reflected light rays formed by the light source point at each of the vertices based on the light source point and the planar unit; and determining the reflected light rays formed by the light source point in the planar unit based on the reflected light rays formed by the light source point at the vertices.
[0007] In some embodiments, determining the reflected light rays formed by the light source point at each vertex based on the light source point and the planar unit includes: determining the incident light ray direction of each vertex based on the coordinates of the light source point and the coordinates of each vertex; and determining the reflection direction corresponding to the reflected light rays of the vertex based on the incident light ray direction and the normal of the planar unit.
[0008] In some embodiments, the planar unit includes a plurality of reflection points corresponding to pixels; determining the reflected ray formed by the light source point on the planar unit based on the reflected ray formed by the light source point at the vertex includes: determining the reflection direction corresponding to the reflected ray formed by the light source point at the reflection point by interpolation based on the reflection direction corresponding to the reflected ray of the vertex.
[0009] In some embodiments, the method further includes: determining the first intersection point of each initial ray with the rendered object as the light source point.
[0010] In some embodiments, rendering the target patch based on the reflected light rays includes: determining a set of reflected light rays on the planar unit based on the reflected light rays formed by each of the light source points on the planar unit; determining pixel parameters of the target patch based on the set of reflected light rays; and rendering the target patch based on the pixel parameters.
[0011] In some embodiments, rendering the target patch based on the reflected light rays includes: determining sub-pixel parameters of the target patch based on the reflected light rays formed by any of the light source points in the planar unit; the sub-pixel parameters correspond one-to-one with the light source points; superimposing the sub-pixel parameters to obtain the pixel parameters of the target patch; and rendering the target patch based on the pixel parameters.
[0012] In some embodiments, dividing the rendering object into multiple planar units includes: dividing the surface of the rendering object into multiple triangular facets; and defining one or more of the triangular facets that are connected in the same plane as one planar unit.
[0013] This application provides an image rendering apparatus, comprising: a geometric unit, a rasterization unit, a reflected ray determination unit, and a rendering unit. The geometric unit is configured to divide the rendering object into multiple planar units; the rasterization unit is configured to perform rasterization processing on each planar unit to obtain a target patch of each planar unit on a display plane; the target patch includes multiple pixels; the reflected ray determination unit is configured to determine, for each planar unit, the reflected ray formed by each light source point of the rendering object in the planar unit; wherein the light source point is determined according to a preset initial ray; the rendering unit is configured to render the target patch according to the reflected ray.
[0014] In some embodiments, the planar unit includes a plurality of vertices; the reflected ray determining unit is configured to determine, based on the light source point and the planar unit, the reflected ray formed by the light source point at each of the vertices; and to determine, based on the reflected ray formed by the light source point at the vertices, the reflected ray formed by the light source point at the planar unit.
[0015] In some embodiments, the reflected ray determining unit is configured to determine the incident ray direction of each vertex based on the coordinates of the light source point and the coordinates of each vertex; and to determine the reflection direction corresponding to the reflected ray of the vertex based on the incident ray direction and the normal of the plane unit.
[0016] In some embodiments, the planar unit includes a plurality of reflection points corresponding to pixels; the reflected ray determining unit is configured to interpolate and determine the reflection direction corresponding to the reflected ray formed by the light source point at the reflection point based on the reflection direction corresponding to the reflected ray of the vertex.
[0017] In some embodiments, the image rendering apparatus further includes a light source point determination unit, configured to determine the first intersection point of each initial ray and the rendering object as the light source point.
[0018] In some embodiments, the rendering unit is configured to determine a set of reflected rays on the planar unit based on the reflected rays formed by each of the light source points on the planar unit; determine pixel parameters of the target patch based on the set of reflected rays; and render the target patch based on the pixel parameters.
[0019] In some embodiments, the rendering unit is configured to determine sub-pixel parameters of the target patch based on the reflected light rays formed by any of the light sources in the planar unit; the sub-pixel parameters correspond one-to-one with the light sources; the sub-pixel parameters are superimposed to obtain the pixel parameters of the target patch; and the target patch is rendered based on the pixel parameters.
[0020] In some embodiments, the geometric unit is configured to divide the surface of the rendered object into a plurality of triangular facets; and to define one or more of the triangular facets that are adjacent to each other in the same plane as a single planar unit.
[0021] This application provides a computer storage medium, which includes a memory and a processor; the computer memory is used to store computer instructions; the processor is used to execute the above-described image rendering method when running the computer instructions.
[0022] This application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described image rendering method.
[0023] The image rendering method in this embodiment utilizes rasterization technology to simulate ray tracing. By dividing the rendering object into multiple planar units, the target patch of each planar unit on the display plane is determined during the rasterization stage. By calculating the multiple reflected rays formed by each light source point on a certain planar unit, the intersection result of multiple rays within the planar unit can be calculated at once. Then, multiple pixels within the target patch range are rendered based on the intersection result of multiple rays. This effectively improves the efficiency of ray intersection, enhances image rendering efficiency, reduces computational complexity, and lowers the performance requirements of hardware such as GPUs and graphics cards. Attached Figure Description
[0024] Figure 1 This is a flowchart illustrating the steps of the image rendering method in an embodiment of this application;
[0025] Figure 2 This is a schematic diagram of the initial ray principle of the image rendering method in the embodiments of this application;
[0026] Figure 3 This is a schematic diagram illustrating the principle of reflected light in the image rendering method of this application embodiment;
[0027] Figure 4 This is a schematic diagram of the surface division of the rendering object in the image rendering method of this application embodiment;
[0028] Figure 5 This is a schematic diagram illustrating the perspective projection principle of the image rendering method in the embodiments of this application;
[0029] Figure 6 This is a schematic diagram of the image rendering apparatus in an embodiment of this application;
[0030] Figure 7 This is a schematic diagram of the structure of the computer storage medium in an embodiment of this application;
[0031] Figure 8 This is a schematic diagram of the on-chip cache structure in an embodiment of this application;
[0032] Figure 9 This is a schematic diagram of the structure of the computer program product in the embodiments of this application. Detailed Implementation
[0033] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0034] In the following description, numerous specific details are set forth in order to provide a more thorough understanding of this application. However, it will be apparent to those skilled in the art that this application can be practiced without one or more of these details. In other instances, to avoid confusion with this application, some technical features well-known in the art have not been described; that is, not all features of actual embodiments are described herein, nor are well-known functions and structures described in detail.
[0035] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. When used herein, the singular forms “a,” “an,” and “the” are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the terms “comprising” and / or “including,” when used in this specification, identify the presence of the stated features, integers, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups. When used herein, the term “and / or” includes any and all combinations of the associated listed items.
[0036] To fully understand this application, detailed steps and structures will be presented in the following description to illustrate the technical solution of this application. Preferred embodiments of this application are described in detail below; however, in addition to these detailed descriptions, this application may have other implementation methods.
[0037] Current ray tracing technologies generally employ recursive algorithms. These algorithms are based on the interaction between light rays and objects in a scene, recursively tracing the paths of light rays to simulate the propagation and interaction effects of light. Specifically, ray tracing technology emits several light rays from a virtual point on the camera or in the viewer's eye. These rays interact with objects in the scene, producing reflections or refractions upon encountering them. Ray tracing technology needs to track the light rays that are reflected or refracted by the surfaces of objects in the scene, determining the intersection point of each ray with an object and the path taken by each ray. This allows for a relatively accurate simulation of the propagation of light in three-dimensional space, thereby improving image rendering quality. While ray tracing technology can solve the problem of global illumination, its computational complexity is high due to the need to calculate the intersection point of every ray with an object in the scene, involving a large number of recursive calculations. This results in long rendering times. Especially in highly complex scenes, the number of intersections between light rays and objects increases, exponentially increasing the computational and time costs of rendering. This makes it difficult to apply to some real-time rendering applications, such as games and interactive graphical interfaces. Furthermore, not all GPUs meet the computational requirements of ray tracing technology, which limits its application in real-time rendering. Therefore, improving the parallel computing capabilities of ray tracing and reducing its performance requirements on GPUs and other hardware has become a key research direction for ray tracing.
[0038] Rasterization is a technique that projects rendered objects from a 3D scene onto a 2D display plane, approximates these objects using pixels, and then colors these pixels to generate an image. Rasterization employs a highly optimized graphics pipeline, making full use of hardware resources. It can efficiently process geometric and pixel data, has low hardware performance requirements, and provides fast rendering speeds and high computational efficiency with limited computing resources. Therefore, rasterization is widely used in scenes requiring rapid rendering, such as in the gaming industry. However, rasterization has limitations in simulating complex lighting effects and global illumination, making it difficult to simulate realistic lighting effects and obtain high-quality images.
[0039] In view of this, embodiments of this application provide an image rendering method that can improve rendering quality while reducing hardware performance requirements. For example... Figure 1 As shown, the image rendering methods include:
[0040] S100: Divide the rendered object into multiple planar units.
[0041] S200: Rasterize each planar unit to obtain a target patch of each planar unit on the display plane; the target patch includes multiple pixels.
[0042] S300: For each planar unit, determine the reflected light rays formed by each light source point of the rendered object in the planar unit. The light source points are determined based on preset initial light rays.
[0043] S400: Renders the target tile based on reflected light.
[0044] It is understandable that the scene to be rendered may include multiple objects to be rendered, i.e., rendering objects. (See reference) Figure 2 The scene to be rendered includes rendering object A, rendering object B, and rendering object C. In the actual rendering process, the rendering object is usually an object in three-dimensional space, whose surface includes curved surfaces or irregular planes. If the surface of the rendering object is divided into multiple smaller surfaces, these smaller surfaces can be approximated as a planar unit, that is, a three-dimensional surface can be represented by multiple two-dimensional planes.
[0045] After the initial ray 3 is projected onto the scene to be rendered, it may interact with the rendering objects in the scene. The initial ray 3 can refer to a series of rays that originate from viewpoint 1, pass through display plane 2, and are projected onto the scene to be rendered. Here, viewpoint 1 refers to the virtual human eye point or virtual camera point; the initial direction of the initial ray 3 can be determined by the line connecting viewpoint 1 and a point (pixel or sampling point) on the display plane.
[0046] The image rendering method in this embodiment utilizes rasterization technology to simulate ray tracing. It divides the surface of the rendering object into multiple planar units and determines the target tile range of each planar unit on the display plane during the rasterization stage. By calculating the multiple reflected rays formed by each light source point on a specific planar unit, the intersection results of multiple rays within the planar unit can be calculated simultaneously. Then, based on the intersection results of these rays, multiple pixels within the target tile range are rendered. This effectively improves the efficiency of ray intersection calculation, enhances image rendering efficiency, reduces computational complexity, and lowers the performance requirements of hardware such as GPUs and graphics cards.
[0047] It should be noted that the image rendering method in this embodiment is based on target tile rendering, which can better utilize the parallel processing capabilities of the GPU. Since each target tile can be rendered independently, they can be assigned to different processing units of the GPU for parallel processing, thereby improving rendering speed.
[0048] In some embodiments, the above image rendering method further includes: determining the first intersection point of each initial ray and the rendering object as the light source point.
[0049] Continue to refer to Figure 2The initial ray is projected onto the scene to be rendered and interacts with the rendered objects in the scene. For example, the initial ray 3 intersects with rendered object A for the first time at intersection point 4. Ray 5 is generated at intersection point 4 and intersects with the rendered object at intersection point 6. Subsequently, the reflected ray 7 reaches the scene light source 8. Intersection point 4 is the starting point of the reflected ray 5, and can be considered a light source point of rendered object B. That is, the first intersection of the initial ray 3 and rendered object A is a light source point of rendered object B. It should be noted that the first intersection of the initial ray 3 with any rendered object (or planar unit) in the scene to be rendered could be a light source point of another rendered object (or planar unit).
[0050] In some embodiments, dividing a rendering object into multiple planar units includes: dividing the surface of the rendering object into multiple triangular elements; and defining one or more triangular elements that are adjacent to each other in the same plane as a single planar unit.
[0051] In this context, a triangular element is a triangle defined by three vertices. A triangle is the simplest polygon, and using triangular elements to represent the surface of a rendered object can further simplify subsequent operations and calculations. For example, two adjacent triangular elements can be defined as a single planar unit, meaning that these two adjacent triangular elements include four vertices and a normal.
[0052] In some embodiments, a planar unit includes a plurality of vertices; for each planar unit, determining the reflected light rays formed by each light source point of the rendering object in the planar unit includes: determining the reflected light rays formed by the light source point at each vertex based on the light source point and the planar unit; and determining the reflected light rays formed by the light source point in the planar unit based on the reflected light rays formed by the light source point at the vertex.
[0053] It should be noted that the information carried by the light source point may include its coordinates in three-dimensional space, as well as shading information such as the light intensity of the light source point.
[0054] In some embodiments, determining the reflected light rays formed by the light source point at each vertex based on the light source point and the planar unit includes: determining the incident light ray direction of each vertex based on the coordinates of the light source point and the coordinates of each vertex; and determining the reflection direction corresponding to the reflected light ray of the vertex based on the incident light ray direction and the normal of the planar unit.
[0055] Specifically, based on the coordinates of any light source point in three-dimensional space and the coordinates of each vertex of the planar unit in three-dimensional space, the direction of the incident light ray reaching the vertex from that light source point can be determined. For example... Figure 3 As shown, if the coordinates of the light source point in three-dimensional space are P(P... x P y P zThe planar unit X0X1X2X3 includes four vertices: X0(x0, y0, z0), X1(x1, y1, z1), X2(x2, y2, z2), and X3(x3, y3, z3). Then, the vector pointing from the light source point P to vertex X0 can be used as the coordinates. Let X represent the incident ray at vertex X0. Similarly, a vector can be used. The incident ray at vertex X1 is represented by a vector. The incident ray at vertex X2 is represented by a vector. Let X represent the incident light at vertex X3. The unit vector of each incident ray vector can represent the incident direction of the incident ray.
[0056] The reflected ray vectors formed by the incident ray at each vertex of the planar element can be calculated according to formula (1):
[0057]
[0058] in, Represents the vector of the reflected ray; Indicates the incident ray vector; Represents the unit vector of the normal to a planar element; This represents the dot product of the incident ray vector and the unit vector of the plane element normal. The result is the cosine of the angle between the incident ray and the normal.
[0059] In some embodiments, the planar unit includes a plurality of reflection points corresponding to pixels. Determining the reflected ray formed by the light source point on the planar unit based on the reflected ray formed by the light source point at the vertex includes: determining the reflection direction corresponding to the reflected ray formed by the light source point at the reflection point by interpolation based on the reflection direction corresponding to the reflected ray at the vertex.
[0060] Continue to refer to Figure 2 Considering specular reflection as a priority, all reflected rays formed by the light source point P on the planar unit X0X1X2X3 are reflected rays. and Within the formed spatial range, reflected light. and The backward extensions of the rays intersect at the convergence point F. The cone 10 formed by all the reflected rays can be regarded as the frustum in perspective projection. Then, the reflection direction of the reflected rays formed by each reflection point of the light source point P on the plane unit X0X1X2X3 can be determined according to the direction of the reflected rays at each vertex.
[0061] The rasterized planar units correspond to the target patch. The target patch consists of multiple pixels, and the position information of each reflection point corresponding to each pixel within the planar unit is determined based on the pixel position information of the target patch. There is a one-to-one correspondence between multiple pixels within the target patch and reflection points within the planar unit; that is, the number of pixels in the target patch corresponding to a planar unit is the same as the number of reflection points within the planar unit.
[0062] It is understandable that, for the same light source, the direction of the incident light rays at different points on a plane unit varies linearly. For example... Figure 3 As shown, considering specular reflection first, the incident direction of the incident light rays at each point on the planar unit X0X1X2X3 changes linearly. Since the normal directions within the planar unit X0X1X2X3 are the same, the reflection directions at each point within the planar unit X0X1X2X3 also change linearly. Therefore, the reflection direction at each point in the plane can be determined by interpolation based on the reflection directions of the four vertices of the planar unit X0X1X2X3. By calculating the multiple reflected light rays formed by the light source point on the planar unit X0X1X2X3, the intersection results of multiple light rays within the planar unit X0X1X2X3 can be calculated at once, effectively improving the efficiency of light ray intersection. In some embodiments, the calculation of the reflected light rays formed by each light source point on the planar unit can be obtained through a compute shader.
[0063] In some embodiments, after calculating the position information of each reflection point, the incident light rays of each reflection point can also be calculated, and the reflection direction corresponding to each reflection ray can be obtained by formula (1) based on the incident light rays and the normal of the plane element.
[0064] In some embodiments, rendering a target patch based on reflected rays includes: determining a set of reflected rays on a planar unit based on the reflected rays formed by each light source point on the planar unit; determining pixel parameters of the target patch based on the set of reflected rays; and rendering the target patch based on the pixel parameters.
[0065] In some embodiments, for the same planar element, the reflected light rays formed by each reflection point of each light source point within that planar element are calculated. For example, assume that the planar element includes n reflection points {r0, r1, ..., r...} n-1}, then the n reflected rays formed by the light source point P0 in this plane element can be represented as The n reflected rays formed by the light source point P1 in this planar unit can be represented as: By superimposing the reflected rays formed by light source points P0 and P1 within this planar unit, a set of these reflected rays can be obtained. Based on the set of reflected rays from the planar unit, the pixel parameters of each pixel within the target tile range can be determined. These pixel parameters include at least one of the following: incident ray direction, normal direction, reflected ray direction, and ray intensity. Then, using the pixel parameters of each pixel within the target tile range, the target tile is rendered to obtain the final output image. For example, using the pixel parameters corresponding to each reflection point as input, a specular reflection lighting model can be used to simulate the lighting effects of each light source point on objects with smooth surfaces such as metal, water, and glass, and the color value of the pixel corresponding to that reflection point can be calculated. For instance, for a given reflection point, based on multiple reflected rays associated with that reflection point in the set of reflected rays, the vector sum of the reflection directions of these rays at that reflection point can be obtained. This vector sum can then be used as input to the lighting model to calculate the color value of the corresponding pixel.
[0066] In some embodiments, rendering a target patch based on reflected light rays includes: determining sub-pixel parameters of the target patch based on reflected light rays formed by any light source point on a planar unit; the sub-pixel parameters correspond one-to-one with the light source points; superimposing the sub-pixel parameters to obtain pixel parameters of the target patch; and rendering the target patch based on the pixel parameters.
[0067] In some embodiments, the sub-pixel parameters of the target patch are determined based on the reflected light rays formed by any light source point on the planar unit. The sub-pixel parameters include at least one of the following: incident light direction, normal direction, reflected light direction, and light intensity. The sub-pixel parameters corresponding to each light source point are superimposed to obtain the set of sub-pixel parameters corresponding to all light source points, i.e., the pixel parameters of the target patch. For example, for a given pixel, its pixel parameters may include the sub-pixel parameters corresponding to light source point P0 and light source point P1. Subsequently, the target patch is rendered using the pixel parameters of each pixel within the target patch area to obtain the final image used for output.
[0068] In some embodiments, a sub-image can be obtained by rendering the target patch according to the sub-pixel parameters of the target patch, and the sub-images corresponding to each light source point, such as light source point P0 and light source point P1, can be superimposed to obtain the rendering result. Multiple sub-images can be considered as multiple image layers, and the superposition of these image layers yields the final image used for output.
[0069] This application also provides the following examples:
[0070] refer to Figure 3 and Figure 4The surface of the objects to be rendered in the scene is divided into multiple triangular facets; multiple adjacent triangular facets located in the same plane are defined as a planar unit. A light source point P is selected; all rays emitted from point P that hit this planar unit are surrounded by rays hitting the four vertices. The principle can be found in [reference needed]. Figure 5 The diagram shown illustrates perspective projection. Under perspective projection, the projection lines converge at the camera point F at the projection center. ′ The truncated cone formed by the projection lines between the near plane (defined by boundary lines 21, 22, 23, and 24) and the far plane is the viewing cone 20. If the far plane in the viewing cone 20 is approximated as a far plane at infinity, then... Figure 3 The frustum 10 formed by the reflected rays shown is considered as frustum 20. However, perspective projection projects the object in frustum 20 onto the near plane of the frustum, while this scheme restores the reflected rays from the distant focal point F back into frustum 10.
[0071] Then, for this planar element, the reflected light rays formed by the light source point P in the planar element are determined, including: calculating the incident light rays at each vertex of the planar element. For example, based on the position information of the triangular elements (triangular elements X0X1X3 and X1X2X3), the position information of the corresponding planar element X0X1X2X3 is determined, including the coordinates of the four vertices of the planar element in three-dimensional space: X0(x0, y0, z0), X1(x1, y1, z1), X2(x2, y2, z2), and X3(x3, y3, z3). The vertex coordinates are subtracted from the light source point coordinates to obtain the incident light ray vector of the vertex. and
[0072] For this planar element, determining the reflected ray formed by the light source point P in the planar element also includes: calculating the reflected ray of the vertex based on the vertex position information and the incident ray. Specifically, the reflected ray of each vertex is calculated according to formula (1). and
[0073] Each planar unit is rasterized to obtain the target tile of each planar unit on the display plane. Since each pixel after rasterization corresponds to the intersection point of a ray and an object (reflection point), the coordinates of the pixels on the display plane correspond one-to-one with the coordinates of the reflection points in three-dimensional space. Each pixel processed by the fragment shader can be regarded as a ray, and then the reflected rays formed by the light source point at each reflection point can be determined based on the reflected rays of the vertex and the position information of the reflection points on the planar unit, and then rendered.
[0074] Then, the reflected rays formed by each light source point on the next planar unit are calculated. Superimposing the reflected rays from all planar units yields the combined color of each point hitting each planar unit. By using rasterization to replace the ray intersection process, the intersection process of multiple rays within a planar unit can be completed in one step, improving rendering efficiency.
[0075] Based on the same inventive concept, embodiments of this application also provide an image rendering apparatus, such as... Figure 6 As shown, the image rendering apparatus 100 includes: a geometry unit 110, a rasterization unit 120, a reflected ray determination unit 130, and a rendering unit 140. The geometry unit 110 is configured to divide the rendering object into multiple planar units. The rasterization unit 120 is configured to perform rasterization processing on each planar unit to obtain a target patch of each planar unit on the display plane. The target patch includes multiple pixels. The reflected ray determination unit 130 is configured to determine, for each planar unit, the reflected ray formed by each light source point of the rendering object in the planar unit. The light source point is determined according to a preset initial ray. The rendering unit 140 is configured to render the target patch according to the reflected ray.
[0076] In some embodiments, the planar unit includes a plurality of vertices; the reflected ray determining unit is configured to determine, based on the light source point and the planar unit, the reflected ray formed by the light source point at each vertex; and based on the reflected ray formed by the light source point at the vertex, to determine the reflected ray formed by the light source point at the planar unit.
[0077] In some embodiments, the reflected ray determining unit is configured to determine the incident ray direction of each vertex based on the coordinates of the light source point and the coordinates of each vertex; and to determine the reflection direction corresponding to the reflected ray of the vertex based on the incident ray direction and the normal of the plane unit.
[0078] In some embodiments, the planar unit includes a plurality of reflection points corresponding to pixels; the reflected ray determination unit is configured to interpolate and determine the reflection direction corresponding to the reflected ray formed by the light source point at the reflection point based on the reflection direction corresponding to the reflected ray at the vertex.
[0079] In some embodiments, the image rendering apparatus further includes a light source point determination unit, configured to determine the first intersection point of each initial ray with the rendering object as a light source point.
[0080] In some embodiments, the rendering unit is configured to determine a set of reflected rays on the planar unit based on the reflected rays formed by each of the light source points on the planar unit; determine pixel parameters of a target tile based on the set of reflected rays; and render the target tile based on the pixel parameters.
[0081] In some embodiments, the rendering unit is configured to determine the sub-pixel parameters of the target tile based on the reflected light rays formed by any light source point in the planar unit; the sub-pixel parameters correspond one-to-one with the light source points; the sub-pixel parameters are superimposed to obtain the pixel parameters of the target tile; and the target tile is rendered based on the pixel parameters.
[0082] In some embodiments, the geometric unit is configured to divide the surface of the rendered object into a plurality of triangular elements; one or more triangular elements that are adjacent to each other in the same plane are defined as a planar unit.
[0083] Based on the same inventive concept, embodiments of this application also provide a computer storage medium, such as... Figure 7 As shown, the computer storage medium 200 includes a memory 210 and a processor 220; the computer memory 210 stores computer instructions; the processor 220 executes the image rendering method described above when running the computer instructions. Since the processor in the computer storage medium can execute the above-described task processing method when running computer instructions, the computer storage medium has similar beneficial technical effects to the above-described task processing method. Therefore, the beneficial effects of the computer storage medium will not be repeated here.
[0084] It should be noted that for each planar unit, the storage space required for the reflected light rays formed by each light source point within that unit is relatively small. However, when rendering a target tile, the rendering process for each pixel may involve reflected light rays from multiple light sources. Storing this reflected light ray information directly in memory could lead to frequent processor accesses, increasing the pressure on memory access and management. Figure 8 As shown, to alleviate memory access and management pressure and improve processor operating efficiency, multiple storage areas 231 corresponding to rendering targets (RTs) can be partitioned in the on-chip cache 230. Each storage area 231 is used to store information about the reflected rays formed by the light source point on the planar unit, and this information is used to represent an RT. Since the processor's processing speed is much faster than the memory access speed, the on-chip cache can alleviate the speed difference between the processor and memory, improve the processor's operating efficiency, and avoid frequent memory read and write operations.
[0085] Based on the same inventive concept, embodiments of this application also provide a computer program product, such as... Figure 9As shown, the computer program product 300 includes a computer program 310, which implements the aforementioned image rendering method when executed by a processor. Since the computer program in the computer program product can implement the aforementioned task processing method when executed by a processor, the computer program product has similar beneficial technical effects to the aforementioned task processing method. Therefore, the beneficial effects of the computer storage medium will not be repeated here.
[0086] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0087] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0088] The various embodiments / implementations provided in this application can be combined with each other without creating contradictions.
[0089] The above description is merely a preferred embodiment of this application and is not intended to limit the application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. An image rendering method, characterized in that, The method includes: Divide the rendered object into multiple planar units; Each planar unit is rasterized to obtain a target patch of each planar unit on the display plane; the target patch includes multiple pixels, and the multiple pixels correspond one-to-one with the reflection points in the planar unit. For each of the planar units, the position information of each reflection point corresponding to each pixel in the planar unit is determined according to the pixel position information of the target image block, and the reflected light rays formed by each reflection point of each light source point of the rendering object in the planar unit are determined; wherein, the first intersection point of each initial ray with the rendering object is the light source point; The target tile is rendered based on the reflected light rays.
2. The image rendering method according to claim 1, characterized in that, The planar unit includes multiple vertices; determining, for each planar unit, the reflected light rays formed by each light source point of the rendering object in the planar unit includes: Based on the light source point and the planar unit, determine the reflected light rays formed by the light source point at each of the vertices; The reflected light rays formed by the light source point at the vertex are determined based on the reflected light rays formed by the light source point at the vertex.
3. The image rendering method according to claim 2, characterized in that, The step of determining the reflected light rays formed by the light source point at each of the vertices based on the light source point and the planar unit includes: Based on the coordinates of the light source point and the coordinates of each vertex, determine the direction of the incident light ray at each vertex; The reflection direction of the reflected ray at the vertex is determined based on the direction of the incident ray and the normal of the plane element.
4. The image rendering method according to claim 3, characterized in that, The planar unit includes multiple reflection points corresponding to pixels; Determining the reflected ray formed by the light source point on the planar unit based on the reflected ray formed by the light source point at the vertex includes: Based on the reflection direction corresponding to the reflected ray from the vertex, the reflection direction corresponding to the reflected ray formed by the light source point at the reflection point is determined by interpolation.
5. The image rendering method according to claim 1, characterized in that, The step of rendering the target patch based on the reflected light includes: The set of reflected rays on the planar unit is determined based on the reflected rays formed by each light source point on the planar unit; The pixel parameters of the target patch are determined based on the set of reflected rays; The target image patch is rendered based on the pixel parameters.
6. The image rendering method according to claim 1, characterized in that, The step of rendering the target patch based on the reflected light includes: The sub-pixel parameters of the target patch are determined based on the reflected light rays formed by any of the light sources in the planar unit; the sub-pixel parameters correspond one-to-one with the light sources. The pixel parameters of the target image patch are obtained by superimposing the sub-pixel parameters; The target image patch is rendered based on the pixel parameters.
7. The image rendering method according to claim 1, characterized in that, The process of dividing the rendering object into multiple planar units includes: The surface of the rendered object is divided into multiple triangular face elements; One or more of the triangular facets that are connected in the same plane are defined as a planar unit.
8. An image rendering apparatus, characterized in that, The device includes: Geometric units are configured to divide a rendered object into multiple planar units; A rasterization unit is configured to perform rasterization processing on each planar unit to obtain a target patch of each planar unit on the display plane; the target patch includes multiple pixels, and the multiple pixels correspond one-to-one with the reflection points in the planar unit. The reflected ray determination unit is configured to, for each of the planar units, determine the position information of each reflection point corresponding to each pixel within the planar unit based on the pixel position information of the target image block, and determine the reflected rays formed by each reflection point of each light source point of the rendering object within the planar unit; wherein, the first intersection point of each initial ray with the rendering object is the light source point. The rendering unit is configured to render the target tile based on the reflected light rays.
9. A computer storage medium, characterized in that, The storage medium includes: a memory and a processor; The computer memory is used to store computer instructions; The processor is configured to execute the image rendering method according to any one of claims 1 to 7 when running the computer instructions.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the image rendering method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image rendering method and device, electronic equipment and storage medium
CN115496845A
Scene rendering method and device, equipment, medium and program product
CN118674850A