Image rendering method, electronic device and computer-readable storage medium

By parametrically representing 3D geometry and using parametric equations for rasterization and pixel visibility determination, the high computational complexity and high power consumption of existing technologies are solved, resulting in faster rendering speed and lower power consumption, making it suitable for dynamic wallpaper display on electronic devices.

WO2026061029A1PCT designated stage Publication Date: 2026-03-26HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2026-03-26

AI Technical Summary

Technical Problem

In existing image rendering methods, the use of a large number of triangular facets to represent three-dimensional geometry leads to high computational complexity and increases device power consumption.

Method used

The three-dimensional geometry is represented parametrically and rasterized using the first parameter equation. Only one projection calculation and one pixel visibility determination are required, which reduces computational complexity.

Benefits of technology

It reduces the computational complexity of image rendering and device power consumption, improves rendering speed, and enables the display of dynamic wallpapers with a sense of space and three-dimensionality for extended periods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025102188_26032026_PF_FP_ABST
    Figure CN2025102188_26032026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the embodiments of the present application are an image rendering method, an electronic device and a computer-readable storage medium. The method comprises: an electronic device acquiring a first parametric equation of a three-dimensional geometric solid, wherein the first parametric equation is used for describing the geometric solid in a three-dimensional virtual scene; performing rasterization on the three-dimensional geometric solid on the basis of the first parametric equation, so as to obtain a target pixel grid of the three-dimensional geometric solid on a screen plane, wherein the screen plane comprises pixel grids, the target pixel grid is a pixel grid located within a projected figure, and the projected figure is a figure obtained by means of projecting the geometric solid from the three-dimensional virtual scene onto the screen plane; and performing shading on shading points corresponding to the target pixel grid. In the embodiments of the present application, a three-dimensional geometric solid in a three-dimensional virtual scene is represented by means of a parametric equation, such that during rasterization based on the parametric equation, projection calculation and pixel visibility determination calculation of the three-dimensional geometric solid can be performed only once, thereby reducing the calculation complexity, and thus lowering the power consumption of a device.
Need to check novelty before this filing date? Find Prior Art

Description

Image rendering method, electronic device and computer readable storage medium

[0001] The present application claims priority to the Chinese patent application No. 202411334462.7, filed on September 23, 2024, and entitled "Image rendering method, electronic device and computer readable storage medium", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD

[0002] The present application relates to the technical field of computer graphics, and in particular to an image rendering method, an electronic device and a computer readable storage medium. BACKGROUND

[0003] In computer graphics, image rendering is used to convert a three-dimensional (3D) scene or model into a two-dimensional image that can be displayed on a screen.

[0004] In the current image rendering method, a three-dimensional geometric body in a three-dimensional virtual scene needs to be represented (or constructed) by a large number of triangular patches, and then the constructed three-dimensional geometric body is processed by rasterization and shading to obtain a two-dimensional image displayed on a screen.

[0005] However, using a large number of triangular patches to represent a three-dimensional geometric body will make the image rendering need to be calculated for a large number of triangular patches, and the calculation complexity is high. High calculation complexity of image rendering will increase the device power consumption. SUMMARY

[0006] The present application provides an image rendering method, an electronic device and a computer readable storage medium, which can solve the problems of low performance and high device power consumption of the existing image rendering method.

[0007] In a first aspect, the present application provides an image rendering method, in which the electronic device obtains a first parametric equation of a three-dimensional geometric body, the first parametric equation being used to describe a three-dimensional geometric body in a three-dimensional virtual scene; performs rasterization on the three-dimensional geometric body according to the first parametric equation to obtain a target pixel grid of the three-dimensional geometric body on a screen plane, the screen plane including at least one pixel grid, the target pixel grid being a pixel grid located in a projection figure, the projection figure being a two-dimensional figure obtained by projecting the three-dimensional geometric body from the three-dimensional virtual scene to the screen plane; and performs shading on a shading point corresponding to the target pixel grid.

[0008] It can be seen from the technical solution that the embodiment of the application represents (or describes) the three-dimensional geometric body in the three-dimensional virtual scene by the first parameter equation, that is, uses the parameterization to represent the three-dimensional geometric body, and can perform projection calculation and pixel visibility judgment calculation (that is, determine which pixel grid is located in the projection graph) on the three-dimensional geometric body only once in the process of obtaining the target pixel grid located in the projection graph after the three-dimensional geometric body is projected to the screen plane, thereby reducing the calculation complexity of image rendering, and further reducing the device power consumption.

[0009] In related technologies, when a three-dimensional geometric body is represented by a triangular facet, there are a large number of triangular facets for one three-dimensional geometric body, and each triangular facet needs to be projected to the screen plane and needs to be subjected to pixel visibility judgment after projection. That is, a large number of projection calculation and pixel visibility judgment calculation are required for each three-dimensional geometric body, and the calculation complexity is high.

[0010] The embodiment of the application can perform projection calculation and pixel visibility judgment calculation on the three-dimensional geometric body only once in rasterization, greatly reduces the calculation amount, reduces the calculation complexity, and further reduces the device power consumption.

[0011] In some possible implementation manners, in the process of rasterizing the three-dimensional geometric body according to the first parameter equation to obtain the target pixel grid of the three-dimensional geometric body on the screen plane, the electronic device can first determine the second parameter equation of the projection graph according to the first parameter equation, and then determine the target pixel grid on the screen plane according to the second parameter equation of the projection graph. In this way, after the three-dimensional geometric body is projected to the screen plane, the second parameter equation of the projection graph can be directly obtained according to the first parameter equation of the three-dimensional geometric body, and it is further determined which pixel grid is located in the projection graph according to the second parameter equation, thereby further reducing the calculation complexity of the rendering process.

[0012] In some possible implementation manners, in the process of determining the target pixel grid on the screen plane according to the second parameter equation of the projection graph, the electronic device converts the second parameter equation into an implicit equation, determines the first distance value of each pixel grid according to the implicit equation, the first distance value is the distance from the pixel grid to the boundary of the projection graph, and for each pixel grid, when the first distance value is less than or equal to zero, it is determined that the pixel grid is the target pixel grid located in the projection graph.

[0013] In the implementation, the second parametric equation can be converted into an implicit expression, a distance field of each pixel grid is calculated according to the implicit expression, and it is determined which pixel grids are located in the projection figure according to distances of the pixel grids to the boundary of the projection figure. In this way, the pixel visibility is determined by the pixel distance field, and the calculation complexity of the rendering process is further reduced.

[0014] In some possible implementation, in the process of determining the pixel visibility according to the distance field, if the first distance value of a certain pixel grid is greater than zero, it is determined that the pixel grid is located outside the projection figure.

[0015] Alternatively, if the first distance value of a certain pixel grid is greater than zero and less than a preset value, it is determined that the pixel grid is a pixel grid in a transition area; if the first distance value of a certain pixel grid is greater than or equal to the preset value, it is determined that the pixel grid is located outside the projection figure; the preset value is greater than zero. In this way, the anti-aliasing can be performed by the distance field of the pixel grid, and the calculation complexity of the rendering process is further reduced.

[0016] In some possible implementation, when the electronic device determines that a certain pixel grid is a target pixel grid, the electronic device can also write depth information of the target pixel grid into a depth buffer.

[0017] In some possible implementation, in the process of performing the lighting shading on the shading point to determine the color of each shading point, the electronic device can determine direct lighting information and indirect lighting information of the shading point; determine a soft shadow coefficient of each shading point according to the first parametric equation; determine an ambient light occlusion coefficient of the shading point according to the first parametric equation; and determine the color of the shading point according to the direct lighting information, the indirect lighting information, the soft shadow coefficient and the ambient light occlusion coefficient.

[0018] In the implementation, after the three-dimensional geometric body is represented by the parametric representation, in the process of the lighting shading calculation, the soft shadow and the ambient light occlusion can be calculated by the first parametric equation, that is, the lighting visibility can be calculated in an analytical manner. In this way, the sampling operation can be avoided or reduced as much as possible, and the calculation complexity of the rendering process is further reduced.

[0019] In some possible implementation, in the process of determining the soft shadow coefficient of the shading point according to the first parametric equation, the electronic device can determine a second distance value of the shading point to an occluder in the three-dimensional virtual scene and a third distance value of a surface of the occluder to a light ray according to the first parametric equation; and determine the soft shadow coefficient of the shading point according to the second distance value and the third distance value; the light ray is a light ray emitted by the shading point to the three-dimensional virtual scene.

[0020] In the implementation, since the three-dimensional geometry is represented by the parameterized equation, the parameters of the three-dimensional geometry are known, and the soft shadow coefficient can be calculated by directly calculating the distance from the three-dimensional geometry to the light ray and the distance from the three-dimensional geometry to the shading point. In this way, the multiple sampling operations can be avoided, and the calculation complexity of the rendering process is reduced.

[0021] In some possible implementation, in the process of determining the ambient light occlusion coefficient of the shading point according to the first parameter equation, the electronic device can project the occluder in the three-dimensional virtual scene to the shading point unit hemisphere according to the first parameter equation, and determine the projection solid angle; and determine the ambient light occlusion coefficient of the shading point according to the projection solid angle and the surface area of the shading point unit hemisphere. The shading point unit hemisphere is a unit hemisphere with the shading point as the center. In this way, the ambient light occlusion coefficient can be determined by directly calculating the projection solid angle of the three-dimensional geometry projected to the shading point unit hemisphere, and then according to the projection solid angle and the surface area of the shading point unit hemisphere, thereby avoiding multiple sampling operations and reducing the calculation complexity of the rendering process.

[0022] In a second aspect, the embodiments of the present application provide a method for image rendering. In the method, an electronic device obtains a three-dimensional virtual scene of a wallpaper, and the three-dimensional virtual scene includes at least one three-dimensional rigid body. The three-dimensional rigid body is rasterized according to a three-dimensional parameter equation of the three-dimensional rigid body, to obtain a target pixel grid of the three-dimensional rigid body on a screen plane. The target pixel grid is a pixel grid located in a projection graph, and the projection graph is a two-dimensional graph obtained by projecting the three-dimensional rigid body from the three-dimensional virtual scene to the screen plane. Shading is performed on a shading point of the target pixel grid, to obtain a rendered wallpaper image. The wallpaper image includes objects corresponding to the three-dimensional rigid bodies.

[0023] As can be seen from the above technical solutions, in the process of rendering the three-dimensional virtual scene of the wallpaper, the three-dimensional rigid body in the three-dimensional virtual scene is represented (or described) by the three-dimensional parameter equation, that is, the three-dimensional rigid body is represented by the parameterized equation. In the process of rasterizing according to the three-dimensional parameter equation to obtain the target pixel grid located in the projection graph after the three-dimensional rigid body is projected to the screen plane, only one projection calculation and one pixel visibility judgment calculation (that is, determining which pixel grid is located in the projection graph) are performed on the three-dimensional rigid body. In this way, the rendering calculation complexity of the electronic device in the wallpaper scene is reduced, the power-off speed of the device is reduced, the standby time of the device is increased, and the rendering speed is improved, so that the electronic device can display the wallpaper (or dynamic wallpaper) with spatial sense and stereoscopic sense for a long time.

[0024] Specifically, in related technologies, when rendering a three-dimensional virtual scene of a wallpaper in real time, the calculation complexity is high, and the rendering speed cannot meet the needs of a dynamic wallpaper scene; and the power consumption of rendering the wallpaper is high, so that the power-off speed of the electronic device is fast, and the dynamic wallpaper with spatial sense and stereoscopic sense cannot be displayed for a long time, and the user experience is not good. In the embodiments of the present application, the three-dimensional rigid body is represented by parameters, so that when the three-dimensional virtual scene of the wallpaper is rendered, the rendering speed is fast, the power consumption is low, the electronic device can display the dynamic wallpaper with spatial sense and stereoscopic sense for a long time, and the user experience is good.

[0025] In some possible implementation ways, in the process of rasterizing the three-dimensional rigid body according to the three-dimensional parameter equation of the three-dimensional rigid body to obtain a target pixel grid of the three-dimensional rigid body on the screen plane, the electronic device can obtain an implicit equation of the projection figure according to the three-dimensional parameter equation; and obtain the target pixel grid on the screen plane according to the implicit equation of the projection figure.

[0026] In some possible implementation ways, in the process of obtaining the target pixel grid on the screen plane according to the implicit equation of the projection figure, the electronic device can determine a first distance value of each pixel grid according to the implicit equation, the first distance value being a distance from the pixel grid to a boundary of the projection figure; and when the first distance value is less than or equal to zero, it is determined that the pixel grid is a target pixel grid located in the projection figure.

[0027] In some possible implementation ways, in the process of judging the pixel visibility according to the distance field, if the first distance value of a certain pixel grid is greater than zero, it is determined that the pixel grid is located outside the projection figure.

[0028] Or, if the first distance value of a certain pixel grid is greater than zero and less than a preset value, it is determined that the pixel grid is a pixel grid in a transition area, and if the first distance value of a certain pixel grid is greater than the preset value, it is determined that the pixel grid is located outside the projection figure; the preset value is greater than zero.

[0029] In some possible implementation ways, after the electronic device determines that a certain pixel grid is a target pixel grid, the electronic device can write depth information of the target pixel grid into a depth buffer.

[0030] In some possible implementation ways, in the process of shading a shading point of the target pixel grid to obtain a rendered wallpaper image, the electronic device can determine direct lighting information and indirect lighting information of the shading point; determine a soft shadow coefficient of the shading point according to the three-dimensional parameter equation; determine an ambient light occlusion coefficient of the shading point according to the three-dimensional parameter equation; determine a color of the shading point according to the direct lighting information, the indirect lighting information, the soft shadow coefficient and the ambient light occlusion coefficient; and obtain the rendered wallpaper image according to the color of the shading point.

[0031] In some possible implementation manners, in the process of determining the soft shadow coefficient of the shading point according to the three-dimensional parametric equation, the electronic device can determine, according to the three-dimensional parametric equation, a second distance value of the shading point to an occluder in the three-dimensional virtual scene and a third distance value of a surface of the occluder to the light ray, and determine the soft shadow coefficient of the shading point according to the second distance value and the third distance value. The light ray is a light ray emitted by the shading point to the three-dimensional virtual scene.

[0032] In some possible implementation manners, in the process of determining the ambient light occlusion coefficient of the shading point according to the three-dimensional parametric equation, the electronic device can project, according to the three-dimensional parametric equation, an occluder in the three-dimensional virtual scene to a shading point unit hemisphere, and determine a projection solid angle; and determine the ambient light occlusion coefficient of the shading point according to the projection solid angle and a surface area of the shading point unit hemisphere. The shading point unit hemisphere is a unit hemisphere with the shading point as a spherical center.

[0033] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method in any one of the above first aspect or the second aspect when executing the computer program.

[0034] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executable on a processor to implement the method in any one of the above first aspect or the second aspect.

[0035] In a fifth aspect, an embodiment of the present application provides a computer program product, and when the computer program product is executed on an electronic device, the electronic device implements the method in any one of the above first aspect or the second aspect.

[0036] In a sixth aspect, an embodiment of the present application provides a chip system, and the chip system includes a processor, the processor is coupled with a memory, and the processor executes a computer program stored in the memory to implement the method in any one of the above first aspect or the second aspect. The chip system can be a single chip, or a chip module composed of multiple chips.

[0037] It can be understood that the beneficial effects of the above-mentioned second aspect to the sixth aspect can be referred to the related description in the above-mentioned first aspect, and will not be described here again. BRIEF DESCRIPTION OF DRAWINGS

[0038] FIG. 1 is a rasterization process schematic diagram provided by an embodiment of the present application;

[0039] FIG. 2 is a structural schematic diagram of an electronic device 100 provided by an embodiment of the present application;

[0040] FIG. 3 is a flow schematic block diagram of an image rendering method provided by an embodiment of the present application;

[0041] FIG. 4 is a schematic diagram of a 3D geometry that can be represented parametrically according to an embodiment of the present application;

[0042] FIG. 5 is a schematic diagram of a sphere represented parametrically according to an embodiment of the present application;

[0043] FIG. 6A is a schematic diagram of a sphere projection according to an embodiment of the present application;

[0044] FIG. 6B is a schematic diagram of a pixel visibility determination process according to an embodiment of the present application;

[0045] FIG. 7 is a schematic diagram of a soft rasterization process based on parametric representation according to an embodiment of the present application;

[0046] FIG. 8 is a schematic diagram of a jagged edge according to an embodiment of the present application;

[0047] FIG. 9 is a schematic diagram of a soft rasterization process based on parametric representation according to an embodiment of the present application;

[0048] FIG. 10 is a schematic diagram of a pixel visibility determination according to an embodiment of the present application;

[0049] FIG. 11 is a schematic diagram of an illumination shading calculation process based on parametric representation according to an embodiment of the present application;

[0050] FIG. 12 is a schematic diagram of a process for computing soft shadows using an analytical formula according to an embodiment of the present application;

[0051] FIG. 13 is a schematic diagram of a process for computing AO using an analytical formula according to an embodiment of the present application;

[0052] FIG. 14 is another schematic flow diagram of an image rendering method according to an embodiment of the present application;

[0053] FIG. 15A is a schematic diagram of a theme wallpaper according to an embodiment of the present application;

[0054] FIG. 15B is a schematic diagram of a theme wallpaper according to an embodiment of the present application;

[0055] FIG. 15C is a schematic diagram of a theme wallpaper according to an embodiment of the present application. DETAILED DESCRIPTION

[0056] In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular architectures, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application.

[0057] The following exemplary introduces the related content that the embodiments of the present application can involve.

[0058] (1) 3D rendering (or drawing) based on rasterization.

[0059] In a rasterization-based rendering process, a three-dimensional virtual scene needs to be constructed first, and then data of the three-dimensional virtual scene is loaded to a rendering pipeline for image rendering to obtain a rendered two-dimensional image.

[0060] The three-dimensional virtual scene includes a plurality of three-dimensional models. The three-dimensional model is a three-dimensional geometric body composed of a large number of polygon primitives. The shape of the polygon primitive can be a triangle, a quadrilateral, or the like.

[0061] Currently, a triangle patch is usually used as a polygon primitive to construct a three-dimensional model in a three-dimensional virtual scene. For example, referring to a rasterization process diagram provided by an embodiment of the present application shown in FIG. 1, a large number of triangle patches (not shown in the figure) can be used to construct the sphere 11 shown in FIG. 1.

[0062] The rendering pipeline can include stages such as vertex processing, rasterization, and shading. The vertex processing stage can include processes such as vertex shading and clipping. Rasterization is a process of converting a triangle patch into a screen pixel through the principle of projection. Specifically, for each triangle patch (not shown in the figure) of the sphere 11, the vertices of the triangle patch are projected onto the screen, and it is determined which pixels on the screen are covered by the projection of the triangle patch, that is, which pixels on the screen are located within the projection of the triangle patch.

[0063] If a certain pixel is located within the projection of the triangle patch, it is determined that the pixel is visible to the camera; if a certain pixel is located outside the projection of the triangle patch, it is determined that the pixel is not visible to the camera. Therefore, the process of determining which pixels on the screen are located within the projection of the triangle patch can also be referred to as pixel visibility determination. The camera is a virtual camera arranged in the three-dimensional virtual scene.

[0064] For example, referring to FIG. 1, for the sphere 11 composed of a large number of triangle patches (not shown in the figure), one of the triangle patches is projected onto the screen 12 to obtain the projection 13 of the triangle patch on the screen 12. The screen 12 includes a plurality of pixel grids. For example, the screen 12 of FIG. 1 includes 64 pixel grids (i.e., small squares in the figure).

[0065] The shape of the projection 13 is a triangle. After calculating the edge functions of the three edges of the projection 13, it is determined which pixel grids are located within the projection 13 according to the edge functions of the three edges. Specifically, the pixel grids on the screen 12 are traversed, and it is determined whether the center of the pixel grid is located within the triangle (i.e., the projection 13) according to the edge functions of the three edges of the triangle; if the center of a certain pixel grid is located within the triangle, it is determined that the pixel grid is located within the triangle; if the center of a certain pixel grid is located outside the triangle, it is determined that the pixel grid is located outside the triangle.

[0066] As shown in FIG. 1, the gray pixel grid is the pixel grid located in the projection 13, and the white pixel grid is the pixel grid located outside the projection 13.

[0067] Each triangle patch of each three-dimensional model is subjected to the rasterization process shown in FIG. 1, and after the triangle patch is converted into a pixel on the screen, the pixel is colored to determine the final color of the pixel.

[0068] After the final color of the pixel is determined, the rendered two-dimensional image can also be obtained through processes such as depth test (for determining the front and back occlusion relationship of the pixel according to the depth value of the pixel), color mixing and merging, etc.

[0069] It should be noted that when a three-dimensional model is represented by a triangle patch, there will be a large number of triangle patches. A large number of triangle patches will result in high computational complexity, thereby increasing the power consumption of the device. For example, the sphere 11 in FIG. 1 includes about 100,000 triangle patches. Each triangle patch needs to be subjected to the projection calculation and pixel visibility judgment calculation shown in FIG. 1, so that more than 100,000 times of projection calculation and pixel visibility judgment calculation are needed when rendering the sphere 11, which is a huge amount of calculation and has high computational complexity. A three-dimensional virtual scene usually includes multiple three-dimensional models, which will make the calculation amount of the rendering process very large and have high computational complexity.

[0070] (2) 3D rendering based on ray tracing.

[0071] Ray tracing is based on the principle of reversibility of light path, and calculates the process of propagation of light rays in a three-dimensional virtual scene by tracking the light rays emitted from a virtual camera, calculates the projection and global illumination, etc., to render a two-dimensional image and obtain a more realistic rendering effect.

[0072] For example, a common ray tracing model can include a virtual camera (also known as a viewpoint or observation point), a projection screen, scene objects, and light sources, etc.

[0073] There are three types of light rays in the ray tracing process, which are primary light rays, shadow rays, and reflection or refraction light rays generated from the intersection point. The primary light ray is a light ray emitted from the virtual camera to the projection screen. The shadow ray is a shadow light ray emitted from the intersection point to the light source.

[0074] A ray is emitted from a virtual camera to a three-dimensional virtual scene, and the propagation of the ray is tracked. The ray passes through a pixel on the screen, and it is detected whether the ray intersects with an object in the three-dimensional virtual scene. If it is determined that the ray intersects with the object by an intersection operation, the position of the intersection point is determined, and the direction of a new ray reflected or refracted from the intersection point is calculated; if the new ray continues to intersect with the object in the three-dimensional virtual scene, the ray tracing algorithm is recursively applied to simulate the propagation and interaction of the ray. Finally, the pixel color is determined according to the light calculation process, and the rendered two-dimensional image is output according to the determined pixel color.

[0075] In ray tracing rendering, a triangular patch can be used to construct a three-dimensional model in a three-dimensional virtual scene, or a signed distance field (SDF) can be used to represent a three-dimensional model in a three-dimensional virtual scene. The SDF can describe a geometric figure by distance, which can not only represent the distance from a pixel to a geometric boundary, but also determine whether the pixel is inside or outside the region, with a positive sign indicating outside the region and a negative sign indicating inside the region.

[0076] If a triangular patch is used to construct a three-dimensional model, a large number of ray intersection operations need to be performed to determine whether a ray hits a triangular patch. As a result, the image rendering calculation complexity is high, which in turn leads to high device power consumption.

[0077] If the SDF is used to represent a three-dimensional model, ray marching needs to be performed along the light path during ray tracing, and each ray needs to be sampled multiple times, resulting in high calculation complexity, which in turn leads to high device power consumption.

[0078] As can be seen from the above, whether a triangular patch is used to represent a three-dimensional model or an SDF is used to represent a three-dimensional model, the calculation complexity of image rendering is high.

[0079] To address the related problems mentioned above, the image rendering scheme provided in the embodiments of the present application represents a three-dimensional geometric body by a parametric equation, reduces the calculation complexity of the image rendering process, and in turn reduces the device power consumption.

[0080] The image rendering scheme provided in the embodiments of the present application can be applied to electronic devices such as mobile phones, tablet computers, car devices, and notebook computers. The specific type and specific structure of the electronic device are not limited here.

[0081] Exemplarily, FIG. 2 shows a structural schematic diagram of an electronic device 100 provided in the embodiments of the present application. The electronic device 100 can include but is not limited to a processor 110, a memory 120, and a display screen 130.

[0082] The structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware. For example, when the electronic device 100 is a mobile phone, the electronic device 100 can further include at least one of a universal serial bus (USB) interface, a charging management module, a power management module, a battery, an antenna, a mobile communication module, a wireless communication module, an audio module, a speaker, a receiver, a microphone, an earphone interface, a sensor module, a key, a motor, an indicator, a camera, and a subscriber identification module (SIM) card interface, etc.

[0083] The processor 110 can include one or more processing units. For example, the processor 110 can include an application processor (AP), a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices or integrated in one or more processors. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.

[0084] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include a mobile industry processor interface (MIPI) and a general-purpose input / output (GPIO) interface, etc.

[0085] The MIPI interface can be used to connect the processor 110 and peripheral devices such as the display screen 130. The MIPI interface includes a display serial interface (DSI), etc. In some embodiments, the processor 110 and the display screen 130 communicate through the DSI interface to realize the display function of the electronic device 100.

[0086] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the display 130.

[0087] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation of the electronic device 100. In some other embodiments of the present application, the electronic device 100 can also use different interface connection modes or a combination of multiple interface connection modes in the above embodiments.

[0088] The electronic device 100 implements display functions through a GPU, a display 130, and an application processor, etc. The GPU is a microprocessor for image processing, connected to the display 130 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.

[0089] The display 130 is used to display images and videos, etc. The display 130 includes a display panel. The display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 can include one or N displays 130, and N is a positive integer greater than 1.

[0090] The memory 120 can be configured to store computer-executable program codes including instructions. The memory 120 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program (such as a sound playing function, an image playing function, etc.) required by at least one function, etc. The data storage area can store data (such as audio data, a phone book, etc.) created during use of the electronic device 100, etc. In addition, the memory 120 can include a high-speed random access memory, and can further include a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various function applications and data processing of the electronic device 100 by running instructions stored in the memory 120 and / or instructions stored in a memory disposed in the processor.

[0091] The image rendering scheme provided by the embodiments of the present application will be described below by taking the electronic device 100 as an example.

[0092] Please refer to FIG. 3 for a flowchart of an image rendering method provided by the embodiments of the present application. The method can include the following steps:

[0093] In step S301, the electronic device 100 acquires a first parametric equation of a three-dimensional geometric body, which is used to describe the three-dimensional geometric body in a three-dimensional virtual scene.

[0094] The three-dimensional virtual scene is pre-constructed. The three-dimensional virtual scene can include at least one three-dimensional geometric body (i.e., a three-dimensional model). After the three-dimensional virtual scene is constructed, the three-dimensional geometric body in the three-dimensional virtual scene can be described by a parametric equation. Generally, a parametric equation can be used to describe a three-dimensional geometric body with simple and regular geometric shape. For example, please refer to FIG. 4 for a diagram of a three-dimensional geometric body provided by the embodiments of the present application, which can be described (or represented) by a parametric equation. The three-dimensional geometric body described (or represented) by a parametric equation can include, but is not limited to, a cylinder, a cone, a cube, a sphere, a pyramid, a prism, a tetrahedron, an octahedron, etc.

[0095] The parametric equation is different for three-dimensional geometric bodies with different shapes. For example, please refer to FIG. 5 for a diagram of a sphere provided by the embodiments of the present application, which is represented by a parametric equation. For a sphere in a three-dimensional virtual scene, if the sphere is represented by triangular patches, the surface of the sphere needs to be divided into a large number of triangular patches, i.e., the sphere is composed of a large number of triangular patches. If the sphere is represented by a parametric equation, the parametric equation of the sphere can be determined after the coordinates of the sphere center and the radius of the sphere are determined. In this case, the first parametric equation of the sphere in FIG. 5 is {c(x, y, z); r}, where c(x, y, z) is the coordinates of the sphere center, and r is the radius of the sphere.

[0096] It can be understood that the first parameter equation is a three-dimensional parameter equation for describing (or representing) a three-dimensional geometric body in a three-dimensional space.

[0097] After using the parameter equation to represent the three-dimensional geometric body in the three-dimensional virtual scene, the first parameter equation of the three-dimensional geometric body can be stored into the scene data of the three-dimensional virtual scene. When rendering the three-dimensional virtual scene, the electronic device 100 can obtain the first parameter equation of the three-dimensional geometric body in the three-dimensional virtual scene by loading the scene data of the three-dimensional virtual scene.

[0098] In step S302, the electronic device 100 rasterizes the three-dimensional geometric body according to the first parameter equation to obtain a target pixel grid of the three-dimensional geometric body on a screen plane, the screen plane including at least one pixel grid, and the target pixel grid being a pixel grid located within a projection figure, the projection figure being a two-dimensional figure obtained by projecting the three-dimensional geometric body from the three-dimensional virtual scene to the screen plane.

[0099] In the rasterization process, first, the three-dimensional geometric body is projected onto the screen plane to obtain a projection figure of the three-dimensional geometric body on the screen plane; then, according to the first parameter equation, a second parameter equation of the projection figure is determined; and finally, according to the second parameter equation, the target pixel grid is determined from the plurality of pixel grids on the screen plane, that is, which pixel grid is located within the projection figure.

[0100] The projection mode can be an orthogonal projection or a perspective projection.

[0101] The first parameter equation of the three-dimensional geometric body can be represented as f(x, y, z) = 0, x, y, and z being coordinates in a three-dimensional space. After projecting the three-dimensional geometric body onto the screen plane, a second parameter equation of the projection figure can be obtained according to the first parameter equation through coordinate transformation. The second parameter equation is a representation of the projection figure on the screen plane (two-dimensional plane). The second parameter equation of the projection figure can be represented as f(x, y) = 0.

[0102] Based on the second parameter equation of the projection figure, the pixel grids on the screen plane are traversed to determine whether the pixel network is located within the projection figure, and then pixel visibility is determined.

[0103] Exemplarily, referring to a ball projection diagram shown in FIG. 6A, the ball 61 is projected onto the screen plane 62 in a perspective projection mode to obtain a projection figure 63 of the ball 61 on the screen plane 62.

[0104] Referring to a pixel visibility judgment process diagram provided by the embodiment of the present application shown in FIG. 6B, the screen plane 62 includes a plurality of pixel grids. After the sphere 61 is projected to the screen plane 62, the second parametric equation of the projection figure 63 is determined according to the first parametric equation of the sphere 61.

[0105] According to the second parametric equation of the projection figure 63, the pixel grids located in the projection figure 63 are determined. For example, whether the center of each pixel grid is located in the projection figure 63 can be determined according to the second parametric equation of the projection figure 63. If the center of the pixel grid is located in the projection figure 63, it is determined that the pixel grid is located in the projection figure; if the center of the pixel grid is not located in the projection figure 63, it is determined that the pixel grid is located out of the projection figure.

[0106] As shown in FIG. 6B, in order to facilitate the distinction, the pixel grids located in the projection figure 63 are represented by shading, that is, the shaded pixel grids are the pixel grids located in the projection figure 63, that is, the shaded pixel grids are the target pixel grids.

[0107] As shown in FIGS. 6A and 6B, in the rasterization process, only one projection calculation and one pixel visibility judgment calculation are required for the sphere 61, which reduces the calculation complexity and further reduces the power consumption of the device. If the sphere 61 is represented by triangular patches, in the rasterization process, one projection calculation and one pixel visibility judgment calculation are required for each triangular patch. A large number of triangular patches will result in a large number of projection calculations and pixel visibility judgment calculations, which has high calculation complexity.

[0108] In step S303, the electronic device 100 performs shading on the shading point corresponding to the target pixel grid.

[0109] Shading refers to a process of determining the color of a point in space along a certain direction according to certain rules.

[0110] The process of light shading can be regarded as a process of solving a rendering equation. Exemplarily, the rendering equation can be as follows:

[0111] wherein L o (x, w o ) is the color (or the outgoing light intensity) at the shading point x, L e (x, w o ) is the spontaneous light intensity at the shading point x; L i (x, w i ) is the incident light intensity at the shading point x; f r (x, w i , w o) is a bidirectional reflectance distribution function (BRDF); V(x, w i ) is a visibility term; w i is a light incident direction; w o is a light exit direction; θ i is an angle between the normal and the incident light.

[0112] In real-time rendering, an approximation is made to the reflection equation in the rendering equation, and the self-illumination term is ignored, to obtain the following rendering equation:

[0113] wherein, is a visibility part; is a reflection part; is a constant π.

[0114] That is, the illumination shading calculation of the shading point can be divided into two sub-problems of the visibility part calculation and the reflection part calculation.

[0115] The calculation of the reflection part includes the calculation of direct illumination and the calculation of indirect illumination. The direct illumination only considers the illumination effect of the direct light source on the scene. The global illumination (or indirect illumination) considers the illumination effect of the mutual reflection between objects in the scene in addition to the illumination effect of the direct light source on the scene, and is closer to the real illumination effect.

[0116] Exemplarily, the electronic device 100 can calculate the direct illumination information of the shading point by using a Blinn-Phong illumination model or a Physically Based Shading (PBR) model, and calculate the indirect illumination information of the shading point by using an Image Base Lighting (IBL) model. According to the direct illumination information and the indirect illumination information, the calculation result of the above-mentioned reflection part can be obtained.

[0117] The calculation of the visibility part can be divided into the direct illumination visibility calculation (i.e., the soft shadow calculation) and the indirect illumination visibility calculation (i.e., the Ambient Occlusion (AO) calculation).

[0118] Exemplarily, the electronic device 100 can calculate the soft shadow and the AO by using a Path Tracing algorithm or an SDF algorithm.

[0119] The path tracking algorithm is a basis of a rendering method based on global illumination, which samples and tracks light into the eye based on a Monte Carlo method, and for each light from the eye, when each object in the scene is encountered, a direction is obtained according to the material of the object to reflect or refract according to a probability until a light source is encountered, a scene range is exceeded or a maximum iteration number is reached. That is, all possible paths of the light are sampled according to a probability distribution, and finally, integration is performed according to a contribution. This rendering method is an unbiased global illumination rendering model, and a rendering result with strong realism can be obtained.

[0120] After the soft shadow and the AO of the shading point are calculated, the visibility calculation result of the shading point can be obtained. The visibility calculation result of the shading point and the calculation result of the reflection part are substituted into the above formula (2), and the color of the shading point can be determined.

[0121] In the embodiment of the present application, after the target pixel grid is determined, the corresponding shading point of each target pixel grid can be obtained, and after the illumination coloring calculation of each shading point is performed, a rendered two-dimensional image can be output according to the color of each shading point.

[0122] As can be seen from the above, by using the parameterized representation of the three-dimensional geometric body, the embodiment of the present application can perform only one projection calculation and one pixel visibility judgment calculation on the three-dimensional geometric body during rasterization, thereby reducing the calculation complexity of image rendering and further reducing the power consumption of the device.

[0123] In some embodiments, when the electronic device 100 performs pixel visibility judgment according to the second parameter equation of the projection figure, the second parameter equation can be converted into an implicit expression, and then the distance of each pixel grid can be calculated according to the implicit expression to determine whether the pixel grid is located in the projection figure.

[0124] Exemplarily, referring to the soft rasterization process schematic diagram based on the parameterized representation provided by the embodiment of the present application shown in FIG. 7, the method can include the following steps:

[0125] In step S701, the electronic device 100 determines the second parameter equation of the projection figure according to the first parameter equation.

[0126] In step S702, the electronic device 100 converts the second parameter equation into an implicit equation.

[0127] Exemplarily, the first parameter equation of the three-dimensional geometric body is f(x, y, z) = 0; the second parameter equation of the projection figure is f(x, y) = 0; and the implicit equation (or implicit expression) is d = f(u, v). Wherein, u and v are coordinates on the screen plane.

[0128] In step S703, the electronic device 100 determines the first distance value of each pixel grid according to the implicit equation, and the first distance value is the distance from the pixel grid to the boundary of the projection figure.

[0129] It can be understood that the first distance value (i.e., d) is the shortest distance from the pixel network to the boundary of the projection figure. Generally, there are multiple distances from the pixel grid to the projection figure, and the shortest distance in the multiple distances is taken as the first distance value of the pixel grid.

[0130] The first distance value of the pixel grid refers to the directed distance field (e.g., SDF) of the pixel grid. The SDF can determine whether the pixel is inside or outside the projection figure, and the positive sign indicates that the pixel is outside the projection figure, and the negative sign indicates that the pixel is inside the projection figure.

[0131] In the embodiments of the present application, if the first distance value of a certain pixel grid is greater than zero (i.e., d>0), the pixel grid is located outside the projection figure, and vice versa, if the first distance value is less than or equal to zero (i.e., d≤0), the pixel network is located inside the projection figure.

[0132] In step S704, when it is determined that the first distance value of a certain pixel grid is less than or equal to zero, the electronic device 100 determines that the pixel grid is a target pixel grid located inside the projection figure.

[0133] Optionally, the method can further include step S705, the electronic device 100 writes the depth information of the target pixel grid into the depth buffer.

[0134] Writing the depth information of the target pixel grid into the depth buffer can determine the front and back occlusion relationship of two pixels according to the depth information of the two pixels.

[0135] In step S706, when it is determined that the first distance value of a certain pixel grid is greater than zero, the electronic device 100 determines that the pixel grid is located outside the projection figure.

[0136] When determining whether the pixel grid is located inside the projection figure according to the first distance value of the pixel grid, all pixel grids on the screen plane can be traversed, and the first distance value of each pixel grid can be determined one by one. Of course, the bounding box algorithm can also be used to obtain the pixel grids located in the bounding box range, and only the pixel grids in the bounding box range are traversed. In this way, all pixel grids on the screen plane do not need to be traversed, and the amount of calculation is reduced.

[0137] It should be pointed out that in the related art, when a triangular patch is used to represent a three-dimensional geometric body, the number of triangular patches is huge, and only hard rasterization can be performed. That is, only GPU and other hardware can be used to accelerate the projection calculation of the triangular patch to realize rasterization, and software calculation cannot be used to realize rasterization.

[0138] In addition, in the pixel visibility judgment of the related art, the pixel visibility judgment according to the implicit equation is not supported, the pixel visibility judgment through the distance field of the pixel grid is not supported, and the pixel is only judged to be inside or outside the triangle through the parameters.

[0139] However, the embodiment of the present application can realize rasterization through software calculation according to the parametric equation after the three-dimensional geometric body is represented by the parameters, that is, soft rasterization is realized. In addition, the pixel visibility judgment can be performed through the distance field of the pixel grid (that is, whether d is greater than zero), and the pixel visibility judgment according to the implicit equation is supported.

[0140] The embodiment of the present application performs soft rasterization based on the parametric representation, and the pixel visibility judgment can be performed according to the distance field of the pixel grid, so that the calculation amount is smaller and the calculation complexity is lower, and the device power consumption is further reduced.

[0141] The electronic device 100 can determine the target pixel grid of the three-dimensional geometric body on the screen plane through the rasterization stage. The edges of the figure composed of a plurality of target pixel grids are irregular and have jagged edges. For example, referring to the jagged edge diagram provided by the embodiment of the present application shown in FIG. 8, the edges of the figure composed of the shadow pixel grid located in the 3rd row and the 6th column and the shadow pixel grid located in the 4th row and the 7th column have obvious steps, that is, jaggies.

[0142] The jaggies of the edges of the figure will affect the rendering effect of the final rendering image. For example, the jagged edges will cause pixel artifacts of the figure. The anti-aliasing function can be used to obtain a rendering figure with better effect.

[0143] In the embodiment of the present application, the anti-aliasing can be performed based on the implicit expression in the soft rasterization process based on the parametric representation. At this time, the soft rasterization process based on the parametric representation can be as shown in FIG. 9.

[0144] Referring to the soft rasterization process diagram based on the parametric representation provided by the embodiment of the present application shown in FIG. 9, the process can include the following steps:

[0145] Step S901, the electronic device 100 determines the second parametric equation of the projection figure according to the first parametric equation.

[0146] Step S902, the electronic device 100 converts the second parametric equation into an implicit equation.

[0147] Step S903, the electronic device 100 determines the first distance value of each pixel grid according to the implicit equation, and the first distance value is the distance from the pixel grid to the boundary of the projection figure.

[0148] Step S904, when determining that the first distance value of a certain pixel grid is less than or equal to zero, the electronic device 100 determines that the pixel grid is a target pixel grid located in the projection figure, and writes the depth information of the target pixel grid into the depth buffer.

[0149] Step S905, when determining that the first distance value of a certain pixel grid is greater than zero and less than a preset value, the electronic device 100 determines that the pixel grid is a pixel grid in the transition area, and the preset value is greater than zero.

[0150] Step S906, when determining that the first distance value of a certain pixel grid is greater than or equal to the preset value, the electronic device 100 determines that the pixel grid is located outside the projection figure.

[0151] The preset value can be represented as δ. At this time, when the first distance value (i.e., d) of a certain pixel grid satisfies 0 < d < δ, it is determined that the pixel grid is a pixel grid in the transition area; when the first distance value (i.e., d) of a certain pixel grid satisfies d ≥ δ, it is determined that the pixel grid is located outside the projection figure. For example, referring to the pixel visibility judgment diagram provided by the embodiment of the present application shown in FIG. 10, based on FIGS. 6A-6B, after the sphere 61 is projected onto the screen plane 62, the projection figure 63 is obtained. According to the first distance value of the pixel grid, it can be determined that the pixel grid located in the projection figure 63 (i.e., the shaded pixel grid in FIG. 10) and the pixel grid located in the transition area (i.e., the pixel grid in the transition area in FIG. 10).

[0152] It should be noted that the boundary of the projection figure appears jagged, which is caused by insufficient sampling rate. The idea of anti-aliasing is to make the boundary of the projection figure gradually change. When the embodiment of the present application determines whether the pixel grid is located in the projection figure through the distance scene of the pixel grid, a very small δ can be set to make the geometric boundary of the projection figure gradually transition, so that the R channel is no longer 0 or 1, but has a transition between 0 and 1. In this way, after mixing the rendering layer of the three-dimensional geometric body with the background, the effect of anti-aliasing can be achieved.

[0153] In addition, when a triangular patch is used to represent a three-dimensional geometric body, rasterization can only rely on GPU hardware acceleration, and cannot support determining whether a pixel is located in the projection figure through an implicit function and a distance field, which causes the related technology to only support hardware anti-aliasing. The embodiment of the present application can support soft rasterization through an implicit function and a distance scene by parameterizing the three-dimensional geometric body, and further support anti-aliasing through an implicit function and a distance field, which has smaller calculation amount and lower device power consumption.

[0154] At this time, in the illumination shading calculation, in addition to the shading of the shading point corresponding to the target pixel grid, the shading of the shading point corresponding to the pixel grid in the transition region can also be performed. The shading process of the shading point corresponding to the pixel grid in the transition region is similar to the shading process of the shading point corresponding to the target pixel grid, and details can be referred to the shading process of the shading point corresponding to the target pixel grid, which will not be described here.

[0155] In some embodiments, the electronic device 100 can calculate the soft shadow and AO of the shading point through a path tracking algorithm or SDF. However, both the path tracking algorithm and the SDF need to be sampled multiple times, which in turn leads to a huge amount of calculation and high computational complexity. For example, in the path tracking algorithm, each pixel needs to sample hundreds of light rays, and the amount of calculation is very large.

[0156] In order to reduce the computational complexity of soft shadow calculation and AO calculation, on the basis of parameterized representation of the three-dimensional geometric body, the soft shadow calculation and AO calculation can be performed according to the first parameter equation of the three-dimensional geometric body. At this time, the specific process of the above step S303 can be as shown in FIG. 11.

[0157] Referring to the process diagram for illumination shading calculation based on parameterized representation provided by the embodiments of the present application shown in FIG. 11, the process can include the following steps:

[0158] Step S1101, the electronic device 100 determines the direct illumination information and the indirect illumination information of the shading point.

[0159] Exemplarily, the PBR illumination model can be used to calculate the direct illumination information, and the IBL illumination model can be used to calculate the indirect illumination information.

[0160] Step S1102, the electronic device 100 determines the soft shadow coefficient of the shading point according to the first parameter equation.

[0161] The first parameter equation is used to represent the three-dimensional geometric body, so the parameters of the three-dimensional geometric body are known. At this time, the electronic device 100 can determine the second distance value of the shading point to the occluder in the three-dimensional virtual scene and the third distance value of the surface of the occluder to the light ray according to the first parameter equation; and finally determine the soft shadow coefficient of the shading point according to the second distance value and the third distance value. The light ray is the light ray emitted by the shading point to the three-dimensional virtual scene.

[0162] That is, the shortest distance from the surface of the three-dimensional geometric body to the light ray can be directly calculated, and the soft shadow is calculated according to the shortest distance, so as to avoid multiple sampling operations and reduce the computational complexity of soft shadow calculation.

[0163] Exemplarily, referring to a process diagram for calculating soft shadow by using an analytical expression provided by the embodiment of the present application shown in FIG. 12, at this time, the three-dimensional geometric body is a sphere with a radius of r and a sphere center of c(x, y, z), and the sphere is located in a three-dimensional virtual scene. The three-dimensional virtual scene includes a plurality of three-dimensional geometric bodies (i.e., includes a plurality of three-dimensional models). ro is a shading point, rd is a light ray emitted from the shading point ro in a direction with a bearing, t is the travel time of the light ray, and the length of the light ray can be obtained according to rd and t.

[0164] For the light ray rd emitted from the shading point ro, the sphere is an occluder. At this time, the distance between the shading point ro and the sphere center c of the occluder, i.e., the sphere, is calculated, that is, b = ||ro-c||, b is the distance (i.e., the second distance value) from the shading point ro to the sphere center c. The shortest distance d of the surface of the occluder to the light ray rd is calculated, that is, wherein a = (ro-c)·rd.

[0165] Finally, the soft shadow coefficient is calculated by using the formula wherein k is a coefficient. According to the soft shadow coefficient, the rendered sphere can be obtained.

[0166] It should be noted that after the three-dimensional geometric body is represented by using the parametric representation, the soft shadow can be calculated by using an analytical expression based on the parametric equation of the three-dimensional geometric body, the sampling operation can be avoided, the calculation amount of the soft shadow calculation is greatly reduced, and the calculation complexity of the image rendering process is further reduced.

[0167] In step S1103, the electronic device 100 determines the ambient light occlusion coefficient of the shading point according to the first parametric equation.

[0168] It should be noted that the ambient light occlusion coefficient can be equivalent to the visible angle in the positive hemispherical range of the shading point. The visible angle calculation in the positive hemispherical range of the shading point can be equivalent to: projecting the three-dimensional geometric body to the unit sphere of the shading point, and calculating the projection area (i.e., the projection solid angle). At this time, for each shading point, the electronic device 100 can project the occluder in the three-dimensional virtual scene to the unit hemisphere of the shading point according to the first parametric equation, and determine the projection solid angle; finally, the ambient light occlusion coefficient of the shading point is determined according to the projection solid angle and the surface area of the unit hemisphere of the shading point. The unit hemisphere of the shading point is a unit hemisphere with the shading point as the sphere center, and the radius of the unit hemisphere is 1.

[0169] Exemplarily, referring to a process diagram for calculating AO by using an analytical expression provided by the embodiment of the present application shown in FIG. 13, at this time, the three-dimensional geometry is a sphere with a radius of r and a sphere center of c, and the sphere is located in a three-dimensional virtual scene, specifically, the large sphere in FIG. 13. The large sphere is an occluder. The three-dimensional virtual scene includes a plurality of three-dimensional geometries (i.e., includes a plurality of three-dimensional models). x is a shading point, and the small sphere in FIG. 13 is a unit sphere (i.e., a shading point unit sphere) with x as the sphere center and a radius of 1. The upper hemisphere of the shading point unit sphere is a shading point unit hemisphere used for calculating AO. d is the distance from the sphere center c of the large sphere to the sphere center x of the small sphere.

[0170] After projecting the large sphere onto the small sphere, the projected solid angle is calculated

[0171] At this time, the calculation of the projected solid angle can be equivalent to the calculation of the area integral on the disc. The disc refers to the gray disc on the large sphere in FIG. 13. The area integral calculation formula of the disc can be as follows:

[0172] After the projected solid angle Ap(r, d) is calculated, the AO coefficient can be obtained according to the projected solid angle and the surface area of the shading point unit hemisphere (i.e., 2π). That is, occ=Ap(r, d) / 2π. Wherein, occ is the AO coefficient. According to the AO coefficient, the rendered sphere can be obtained.

[0173] It should be pointed out that after the three-dimensional geometry is represented by the parametric expression in the embodiment of the present application, the AO can be calculated by using the analytical expression based on the parametric equation of the three-dimensional geometry, which can avoid the multiple sampling operations, greatly reduce the calculation amount of the AO calculation, and further reduce the calculation complexity of the image rendering process.

[0174] In step S1104, the electronic device 100 determines the color of the shading point according to the direct lighting information, the indirect lighting information, the soft shadow coefficient and the ambient light occlusion coefficient.

[0175] According to the rendering formula shown above, after the direct lighting information, the indirect lighting information, the soft shadow coefficient and the ambient light occlusion coefficient are obtained, the color of the shading point can be determined.

[0176] At this time, the shading point can include the shading point corresponding to the target pixel grid, and can also include the shading point corresponding to the target pixel grid and the pixel grid in the transition area.

[0177] It should be noted that in some embodiments, the electronic device 100 can use an analytical formula to calculate the soft shadow and the AO when calculating the soft shadow and the AO; only the soft shadow can be calculated using an analytical formula, and the AO calculation can use an SDF or path tracking algorithm; or only the AO can be calculated using an analytical formula, and the soft shadow calculation can use an SDF or path tracking algorithm.

[0178] Of course, when using an analytical formula to calculate the soft shadow and / or the AO, the rasterization stage can use the soft rasterization method based on the parametric representation provided in the embodiments of the present application, or can use the rasterization method in the related art, which is not limited herein.

[0179] The embodiments of the present application use an analytical formula to calculate the soft shadow and the AO based on the parametric representation of the three-dimensional geometric body, which can greatly reduce the calculation amount of the soft shadow calculation and the AO calculation, thereby reducing the calculation complexity of the image rendering process and further reducing the device power consumption.

[0180] The image rendering scheme provided by the embodiments of the present application can be applied to a game rendering scene or a window rendering scene, and the application scenario is not limited herein. For some performance and power sensitive scenarios, the image rendering method using a triangular patch or an SDF to represent a three-dimensional model has high calculation complexity in the rendering process, which will generate a large amount of power consumption, not only causing the device to generate a lot of heat, but also shortening the device standby time, which seriously affects the user experience.

[0181] For example, in the operating system window rendering scene of a mobile terminal device such as a mobile phone and a tablet computer, the image rendering method using a triangular patch or an SDF to represent a three-dimensional model has high calculation complexity in the rendering process, which will generate a large amount of power consumption, and then cause the mobile terminal device such as a mobile phone and a tablet computer to generate a lot of heat and the device to power off quickly. In addition, if the GPU performance of the mobile phone and the like is low, due to the high calculation complexity, the mobile phone cannot complete the rendering in time, that is, the rendering speed cannot meet the performance requirements of the window rendering scene.

[0182] Among them, the mobile terminal device such as a mobile phone and a tablet computer is very sensitive to power consumption, and the operating system window scene usually requires fast rendering speed (that is, the rendering can be completed in time) and low power consumption.

[0183] The operating system window scene may, for example, include a charging animation, a boot animation, a theme, a wallpaper and the like user interface (User Interface, UI). If these UI scenes involve 3D rendering, the mobile terminal device such as a mobile phone needs to perform image rendering through a GPU, and display the rendered image on the screen.

[0184] For example, a mobile phone displays a dynamic wallpaper with stereoscopic and spatial effects, which is obtained by the mobile phone through image rendering on a three-dimensional virtual scene of the wallpaper. At this time, since the mobile phone needs to continuously display the dynamic wallpaper, the mobile phone needs to continuously perform image rendering through a GPU. If the GPU performance of the mobile phone is high, the image rendering can be completed in time, and the rendered wallpaper can be displayed on the screen. However, due to the high computational complexity of image rendering, the device generates a large amount of heat and has high power consumption. The high heat generation and power consumption of the device cause the mobile phone to power off quickly when displaying the dynamic wallpaper, and seriously shorten the standby time of the mobile phone. In this case, the user perceives that the mobile phone powers off quickly after using the dynamic wallpaper in normal standby mode, which seriously affects the user experience.

[0185] If the GPU performance of the mobile phone is not high, due to the high computational complexity of image rendering, not only the image rendering cannot be completed in time, but also the device generates a large amount of heat and has high power consumption, which seriously affects the user experience.

[0186] Therefore, in order to meet the 3D rendering requirements of high performance and low power consumption of the view window scene, the embodiments of the present application use parameterized representation of three-dimensional geometric bodies to replace the triangular patch representation of three-dimensional geometric bodies. Further, a soft rasterization method based on parameterized representation can be used for rasterization to further reduce the computational complexity of the rendering process, further improve the rendering speed, and reduce the power consumption of the device. Further, in the soft shadow calculation and AO calculation process, based on the parameterized representation of the geometric body, an analytical expression can be used to calculate the soft shadow and AO to further reduce the computational complexity of the rendering process, further improve the rendering speed, and reduce the power consumption of the device.

[0187] Exemplarily, referring to another flowchart of the image rendering method provided by the embodiments of the present application shown in FIG. 14, the method can include the following steps:

[0188] In step S1401, the electronic device 100 obtains a three-dimensional virtual scene of a wallpaper, and the three-dimensional virtual scene includes at least one three-dimensional rigid body.

[0189] The three-dimensional virtual scene of the wallpaper is pre-constructed. The three-dimensional virtual scene includes a plurality of three-dimensional rigid bodies. For each three-dimensional rigid body, a three-dimensional parameter equation of the three-dimensional rigid body is determined in advance. The three-dimensional parameter equation of each three-dimensional rigid body is stored in the scene data of the three-dimensional virtual scene. The electronic device 100 can obtain the three-dimensional parameter equation of the three-dimensional rigid body by loading the scene data of the three-dimensional virtual scene of the wallpaper. The three-dimensional rigid body refers to a three-dimensional geometric body that does not deform or deform. Exemplarily, the three-dimensional rigid body can be a three-dimensional geometric body as shown in FIG. 4, and the three-dimensional geometric body is a rigid body.

[0190] The three-dimensional parameter equation is a parameter equation of a three-dimensional rigid body in a three-dimensional space, that is, the three-dimensional parameter equation is used to describe the three-dimensional rigid body in the three-dimensional space. Exemplarily, the three-dimensional parameter equation can be expressed as f(x, y, z) = 0, which can be equivalent to the first parameter equation mentioned above.

[0191] Of course, in other embodiments, the three-dimensional virtual scene of the wallpaper can also include an elastic body or the like, which is not limited herein.

[0192] By rendering the three-dimensional virtual scene of the wallpaper, the wallpaper displayed on the screen of the electronic device 100 can be obtained. The wallpaper can be a dynamic wallpaper, and can be a certain theme wallpaper.

[0193] In step S1402, the electronic device 100 rasterizes the three-dimensional rigid body according to the three-dimensional parameter equation of the three-dimensional rigid body, to obtain a target pixel grid of the three-dimensional rigid body on the screen plane, the target pixel grid being a pixel grid located in a projection figure, the projection figure being a two-dimensional figure obtained by projecting the three-dimensional rigid body from the three-dimensional virtual scene to the screen plane.

[0194] In some embodiments, the electronic device 100 can obtain an implicit equation of the projection figure according to the three-dimensional parameter equation; and determine the target pixel grid on the screen plane according to the implicit equation of the projection figure, to realize the rasterization of the three-dimensional rigid body.

[0195] In a specific application, the parameter equation of the projection figure on the screen plane can be obtained according to the three-dimensional parameter equation, and then the parameter equation of the projection figure is converted into an implicit equation. For example, the parameter equation of the projection figure on the screen plane is f(x, y) = 0, and the implicit equation is d = f(u, v).

[0196] Further, in the process of determining which pixel grid is located in the projection figure, the electronic device 100 can determine a first distance value of each pixel grid according to the implicit equation, the first distance value being a distance from the pixel grid to the boundary of the projection figure; for each pixel grid, if the first distance value is less than or equal to zero, it is determined that the pixel grid is a target pixel grid located in the projection figure; and if the first distance value is greater than zero, it is determined that the pixel grid is located outside the projection figure.

[0197] Alternatively, if the first distance value is greater than zero and less than a preset value, it is determined that the pixel grid is a pixel grid of a transition region, and if the first distance value of a certain pixel grid is greater than the preset value, it is determined that the pixel grid is located outside the projection figure; the preset value is greater than zero; the shading point further includes the pixel grid of the transition region.

[0198] In some embodiments, after determining that a certain pixel grid is a target pixel grid, the electronic device 100 can write the depth information of the target pixel grid into the depth buffer.

[0199] It should be noted that the pixel visibility judgment and anti-aliasing by the implicit equation and the distance field can further reduce the calculation amount and power consumption of the rendering process, thereby improving the wallpaper rendering speed, reducing the power consumption of the mobile phone and other devices, and prolonging the standby time of the device.

[0200] It should be noted that the process of rasterization and anti-aliasing according to the three-dimensional parameter equation can be referred to the related content above, and will not be repeated here.

[0201] In step S1403, the electronic device 100 colors the shading points of the target pixel grid to obtain a rendered wallpaper image, and the wallpaper image includes objects corresponding to each three-dimensional rigid body.

[0202] In some embodiments, during illumination shading, the electronic device 100 can calculate soft shadows and AO in the way of path tracing or SDF.

[0203] In some embodiments, during illumination shading, the electronic device 100 can determine direct illumination information and indirect illumination information of the shading point; determine a soft shadow coefficient of the shading point according to the three-dimensional parameter equation; determine an ambient light occlusion coefficient of the shading point according to the three-dimensional parameter equation; and determine a color of the shading point according to the direct illumination information, the indirect illumination information, the soft shadow coefficient, and the ambient light occlusion coefficient. Further, the electronic device 100 can determine a second distance value of the shading point to an occluder in the three-dimensional virtual scene and a third distance value of a surface of the occluder to a light ray according to the three-dimensional parameter equation; determine the soft shadow coefficient of the shading point according to the second distance value and the third distance value; and the light ray is a light ray emitted by the shading point to the three-dimensional virtual scene.

[0204] Further, the electronic device 100 can project the occluder in the three-dimensional virtual scene to a shading point unit hemisphere and determine a projection solid angle according to the three-dimensional parameter equation; determine the ambient light occlusion coefficient of the shading point according to the projection solid angle and the surface area of the shading point unit hemisphere; and the shading point unit hemisphere is a unit hemisphere with the shading point as the center.

[0205] It should be noted that the analytical expression is used to calculate AO and soft shadow, which can further reduce the calculation amount and power consumption of the rendering process, thereby improving the wallpaper rendering speed, reducing the power consumption of the mobile phone and other devices, and prolonging the standby time of the device. For specific introduction of the analytical expression for calculating AO and soft shadow, please refer to the related content above, which will not be repeated here.

[0206] In addition, if the pixel grid of the transition region is determined in the rasterization process, the electronic device 100 can color the shading points corresponding to the pixel grid of the transition region in addition to the shading points corresponding to the target pixel grid.

[0207] After the color of the coloring point is determined, the electronic device 100 can obtain a rendered wallpaper image according to the color of each coloring point, and display the wallpaper image on the screen.

[0208] In some embodiments, the wallpaper rendered by the electronic device 100 is a three-dimensional wallpaper. The three-dimensional wallpaper can change with user operations or time, which can be, for example, a screen-on operation or an unlocking operation, and the like. Illustratively, the three-dimensional wallpaper includes a plurality of emoticons, and the positions and occlusion relationships of the plurality of emoticons can change with user operations or time. When rendering the three-dimensional wallpaper, the electronic device 100 continuously renders a plurality of consecutive wallpaper images in response to user operations or time changes, and sequentially displays the plurality of consecutive wallpaper images on the screen to present a continuous and smooth animation effect to the user. Illustratively, referring to the subject wallpaper schematic diagram provided by the embodiment of the present application shown in FIG. 15A, the subject wallpaper is a three-dimensional rigid body-based subject wallpaper. As shown in FIG. 15A, the subject wallpaper includes a plurality of position-changeable emoticons. At this time, the emoticons in FIG. 15A are objects corresponding to three-dimensional rigid bodies, which are obtained by rendering a three-dimensional spherical emoticon model (i.e., a three-dimensional rigid body). As shown in FIG. 15A, the subject wallpaper has good spatial and stereoscopic effects.

[0209] The subject wallpaper shown in FIG. 15A is a dynamic wallpaper, and with user operations or time, and the like, each emoticon can “move” in the screen of the mobile phone, and each emoticon can collide with each other, and the user can see the corresponding animation effect. After the emoticons “move”, the positions and front-back occlusion relationships of the emoticons change accordingly. For example, compared with the subject wallpaper schematic diagram provided by the embodiment of the present application shown in FIG. 15B and FIG. 15A, the positions, front-back occlusion relationships, and shadow effects of the emoticons in the two frames of wallpaper shown in FIG. 15B and FIG. 15A are different. Assuming that the mobile phone first displays the wallpaper image shown in FIG. 15A, and after receiving a user operation, the mobile phone displays the wallpaper image shown in FIG. 15B in response to the user operation, and thus presents the animation effect of the emoticons “moving” in the screen of the mobile phone to the user.

[0210] Illustratively, referring to the subject wallpaper schematic diagram provided by the embodiment of the present application shown in FIG. 15C. The wallpaper in FIG. 15C includes a plurality of emoticons, the plurality of emoticons are arranged in an array, and the plurality of emoticons can dynamically “rotate” to change the directions of the emoticons, and thus present the animation effect of the emoticons “rotating” to the user.

[0211] It can be understood that for the dynamic wallpaper, the electronic device 100 constantly renders the three-dimensional virtual scene of the wallpaper. If a three-dimensional rigid body is represented using a triangular patch or an SDF, the calculation amount of the rendering process is huge, resulting in high device power consumption and serious heat generation, which in turn causes the power-off speed of the electronic device 100 in normal standby to be very fast, seriously affecting the user experience. By using the image rendering scheme provided in the embodiments of the present application, the calculation amount of image rendering can be greatly reduced, the device power consumption and heat generation are reduced, and thus the standby time of the device is prolonged.

[0212] In the embodiments of the present application, when rendering the three-dimensional virtual scene of the wallpaper, a three-dimensional rigid body in the three-dimensional virtual scene is represented by a three-dimensional parametric equation, and only one projection calculation and one pixel visibility judgment calculation are performed on the three-dimensional rigid body in the rasterization process. In this way, the rendering calculation complexity of the electronic device in the wallpaper scene is reduced, and thus the device power-off speed is reduced, the device standby time is increased, and the rendering speed is also improved, so that the electronic device can display the wallpaper (or dynamic wallpaper) with a sense of space and stereoscopic effect for a long time.

[0213] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit or module in the embodiments can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit or module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the system can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0214] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0215] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0216] In the embodiments provided in this application, it should be understood that the disclosed devices, electronic devices, and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings or direct couplings or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0217] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0218] The electronic device provided by the embodiments of the present application can include a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method of any of the above method embodiments when executing the computer program.

[0219] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps in the above various method embodiments.

[0220] The embodiments of the present application provide a computer program product, which, when running on an electronic device, causes the electronic device to implement the steps in the above various method embodiments.

[0221] The embodiments of the present application also provide a chip system, which includes a processor coupled with a memory, and the processor executes a computer program stored in the memory to implement the method described in the above various method embodiments. The chip system can be a single chip or a chip module composed of multiple chips.

[0222] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments. It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. In addition, in the description of the present application and the appended claims, the terms "first", "second", "third", etc. are only used for distinction, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features limited by "first", "second", "third", "fourth" can explicitly or implicitly include one or more features. In addition, it should be understood that at least one of the embodiments of the present application includes one or more, and the plurality refers to more than or equal to two. In the embodiments of the present application, "and / or" is only a description of the association between the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the existence of A alone, the existence of A and B, and the existence of B alone. In addition, the character " / " in this paper generally represents that the front and rear associated objects have an "or" relationship.

[0223] Reference throughout this application to "one embodiment" or "an embodiment" or "a specific embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" or "in a specific embodiment" or "in some embodiments" or "in other embodiments" in various places throughout this specification are not necessarily all referring to the same embodiment, but can refer to one or more, but not all, embodiments.

Claims

1. An image rendering method, characterized by, The method is applied to an electronic device, and comprises: obtaining a first parametric equation of a three-dimensional geometry, the first parametric equation being used to describe the three-dimensional geometry in a three-dimensional virtual scene; rasterizing the three-dimensional geometry according to the first parametric equation to obtain a target pixel grid of the three-dimensional geometry on a screen plane, the screen plane comprising at least one pixel grid, the target pixel grid being a pixel grid located within a projection figure, the projection figure being a two-dimensional figure obtained by projecting the three-dimensional geometry from the three-dimensional virtual scene to the screen plane; shading a shading point corresponding to the target pixel grid.

2. The method of claim 1, wherein, The method further comprises: determining a second parametric equation of the projection figure according to the first parametric equation; determining the target pixel grid on the screen plane according to the second parametric equation of the projection figure.

3. The method of claim 2, wherein, The method further comprises: converting the second parametric equation into an implicit equation; determining a first distance value of each of the pixel grids according to the implicit equation, the first distance value being a distance from the pixel grid to a boundary of the projection figure; when the first distance value is less than or equal to zero, determining that the pixel grid is the target pixel grid located within the projection figure.

4. The method of claim 3, wherein, The method further comprises: when the first distance value is greater than zero, determining that the pixel grid is located outside the projection figure; or, when the first distance value is greater than zero and less than a preset value, determining that the pixel grid is a pixel grid of a transition region, and when the first distance value is greater than or equal to the preset value, determining that the pixel grid is located outside the projection figure; the preset value is greater than zero.

5. The method of claim 3, wherein, The method further comprises: writing depth information of the target pixel grid into a depth buffer.

6. The method according to any one of claims 1 to 5, characterized in that, The method further comprises: determining direct lighting information and indirect lighting information of the shading point; determining a soft shadow coefficient of the shading point according to the first parametric equation; determining an ambient light occlusion coefficient of the shading point according to the first parametric equation; determining a color of the shading point according to the direct lighting information, the indirect lighting information, the soft shadow coefficient, and the ambient light occlusion coefficient.

7. The method of claim 6, wherein, The method further comprises: determining a second distance value from the shading point to an occluder in the three-dimensional virtual scene and a third distance value from a surface of the occluder to a light ray according to the first parametric equation, and determining the soft shadow coefficient of the shading point according to the second distance value and the third distance value; the light ray is a light ray emitted by the shading point to the three-dimensional virtual scene.

8. The method of claim 6, wherein, The method further comprises: determining an ambient light occlusion coefficient of the shading point according to the first parametric equation, comprising: According to the first parameter equation, an occluder in the three-dimensional virtual scene is projected to a shading point unit hemisphere, and a projected solid angle is determined; according to the projected solid angle and a surface area of the shading point unit hemisphere, an ambient light masking coefficient of the shading point is determined; the shading point unit hemisphere is a unit hemisphere with the shading point as a spherical center.

9. An image rendering method, characterized by, The method is applied to an electronic device, and the method comprises: obtaining a three-dimensional virtual scene of a wallpaper, the three-dimensional virtual scene comprising at least one three-dimensional rigid body; performing rasterization on the three-dimensional rigid body according to a three-dimensional parameter equation of the three-dimensional rigid body to obtain a target pixel grid of the three-dimensional rigid body on a screen plane; the target pixel grid is a pixel grid located in a projection graph, and the projection graph is a two-dimensional graph obtained by projecting the three-dimensional rigid body from the three-dimensional virtual scene to the screen plane; performing shading on a shading point of the target pixel grid to obtain a rendered wallpaper image, the wallpaper image comprising objects corresponding to each three-dimensional rigid body.

10. The method of claim 9, wherein, performing rasterization on the three-dimensional rigid body according to a three-dimensional parameter equation of the three-dimensional rigid body to obtain a target pixel grid of the three-dimensional rigid body on a screen plane, comprising: obtaining an implicit equation of the projection graph according to the three-dimensional parameter equation; obtaining the target pixel grid on the screen plane according to the implicit equation of the projection graph.

11. The method of claim 10, wherein, obtaining the target pixel grid on the screen plane according to the implicit equation of the projection graph, comprising: determining a first distance value of each pixel grid according to the implicit equation, the first distance value being a distance from the pixel grid to a boundary of the projection graph; when the first distance value is less than or equal to zero, determining that the pixel grid is the target pixel grid located in the projection graph.

12. The method of claim 11, wherein, The method further comprises: when the first distance value is greater than zero, determining that the pixel grid is located outside the projection graph; or, when the first distance value is greater than zero and less than a preset value, determining that the pixel grid is a pixel grid of a transition region, and when the first distance value is greater than the preset value, determining that the pixel grid is located outside the projection graph; the preset value is greater than zero.

13. The method of claim 11, wherein, The method further comprises: writing depth information of the target pixel grid into a depth buffer.

14. The method according to any one of claims 9 to 13, characterized in that, performing shading on a shading point of the target pixel grid to obtain a rendered wallpaper image, comprising: determining direct lighting information and indirect lighting information of the shading point; determining a soft shadow coefficient of the shading point according to the three-dimensional parameter equation; determining an ambient light masking coefficient of the shading point according to the three-dimensional parameter equation; determining a color of the shading point according to the direct lighting information, the indirect lighting information, the soft shadow coefficient and the ambient light masking coefficient; obtaining a rendered wallpaper image according to the color of the shading point.

15. The method of claim 14, wherein, determining a soft shadow coefficient of the shading point according to the three-dimensional parameter equation, comprising: According to the three-dimensional parameter equation, a second distance value of the shading point to an occluder in the three-dimensional virtual scene and a third distance value of a surface of the occluder to a light ray are determined; according to the second distance value and the third distance value, a soft shadow coefficient of the shading point is determined; the light ray is a light ray emitted by the shading point to the three-dimensional virtual scene.

16. The method of claim 14, wherein, According to the three-dimensional parameter equation, an ambient light shading coefficient of the shading point is determined, comprising: According to the three-dimensional parameter equation, an occluder in the three-dimensional virtual scene is projected to a shading point unit hemisphere, and a projection solid angle is determined; according to the projection solid angle and a surface area of the shading point unit hemisphere, an ambient light shading coefficient of the shading point is determined; the shading point unit hemisphere is a unit hemisphere with the shading point as a spherical center.

17. An electronic device, comprising: A computer program product comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the method according to any one of claims 1 to 8 or 9 to 16.

18. A computer-readable storage medium, the computer-readable storage medium storing a computer program, characterized in that, The computer program product is executed by the processor to implement the method according to any one of claims 1 to 8 or 9 to 16.

19. A computer program product, characterised in that, When the computer program product is executed on the electronic device, the electronic device is caused to implement the method according to any one of claims 1 to 8 or 9 to 16.

Citation Information

Patent Citations

  • System, method, and computer program product for rendering at variable sampling rates using projective geometric distortion

    CN107392988A

  • Full-parallax light field content generation method and device based on multiple times of depth image rendering

    CN110246146A

  • Image processing method, device, equipment, medium and program product

    CN117173314A

  • System, method, and computer program product for rendering a screen-aligned rectangle primitive

    US20150084952A1

  • System and method for computing intersections between rays and surfaces

    US7567248B1