Pixel filling method and terminal
By assigning an identification number to the model and determining the shading rate, reducing the number of pixels for ray tracing rendering, and updating the color values of hole pixels, the problem of high power consumption of ray tracing rendering is solved, and high-quality and efficient graphics rendering is achieved.
Patent Information
- Application Number
- CN202410373284.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-09
- Publication Date
- 2024-09-06
AI Technical Summary
Ray tracing rendering consumes high power in the terminal, making it difficult to achieve high-quality image rendering and increase rendering speed.
By assigning identification numbers to models in the scene and determining their shading rates, reducing the number of pixels whose color values are determined through ray tracing rendering, using shaded pixels to update the color values of hole pixels, and sharpening the target image to ensure that the image is realistic sense and three-dimensional effect.
It reduces the power consumption of ray tracing rendering, improves the speed and quality of graphics rendering, achieves high-quality rendering results, and improves the realism and clarity of images.
Smart Images

Figure CN118608673A
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminals and image processing, and in particular to a pixel filling method and a terminal. Background Art
[0002] Graphics rendering can be applied to games, virtual simulation, virtual reality (VR) or augmented reality (AR) and other fields. Improving the realism of rendered images (images obtained after rendering) is the research direction of the industry. Among them, ray tracing technology, a graphics rendering method (ray tracing rendering), follows the laws of physics: it tracks the light that interacts with objects in the scene, simulates the reflection and scattering of light, and can naturally achieve the effects of shadows and ambient light occlusion, bringing high-quality rendering results, so it has attracted much attention.
[0003] As hardware-accelerated real-time ray tracing rendering is increasingly used in the program counter (PC) and console fields, terminal Vulkan-based ray tracing rendering is also supported by many chip products (in terminals). However, even with the use of hardware acceleration, ray tracing rendering is still a heavy-load technology in terminals. When terminals use ray tracing rendering, corresponding acceleration solutions at the software level are also proposed, aiming to reduce the power consumption of terminal ray tracing rendering, expand it to more application scenarios and increase usage time.
[0004] How to reduce power consumption during ray tracing rendering and complete image rendering with high quality is a direction worthy of research. Summary of the invention
[0005] The present application provides a pixel filling method and terminal, which reduce the power consumption of ray tracing rendering while ensuring that each pixel in the image obtained by graphics rendering has a real color value.
[0006] In a first aspect, the present application provides a pixel filling method, which includes: a terminal assigns identification numbers to W first-class models included in a scene; the terminal determines the shading rates of the W first-class models respectively; W is an integer greater than or equal to 1; the terminal performs ray tracing rendering on each first-class model based on the shading rate and identification number of each first-class model to obtain a rendering result to be filled; the rendering result to be filled includes at least the color value of each pixel in the image to be filled; each pixel in the image to be filled includes all pixels corresponding to the W first-class models; the W first-class models include a first model, the shading rate of the first model is p, then the proportion of colored pixels corresponding to the first model shown in the image to be filled in the total pixels corresponding to the first model is p, and the proportion of hole pixels corresponding to the first model shown in the image to be filled in the total pixels corresponding to the first model is p. The proportion of all pixels in the first type is 1-p; the colored pixel is a pixel whose color value is determined by ray tracing rendering among all pixels corresponding to the first model; the color value of each hole pixel is a first preset value or is empty; the terminal uses the colored pixel corresponding to the i-th first type model to update the color value of each hole pixel corresponding to the i-th first type model to obtain the image to be sharpened; wherein, i is an integer and changes from 1 to W; the terminal sharpens all pixels corresponding to all first type models in the image to be sharpened to obtain a target image; wherein all pixels corresponding to the first type model include the first pixel, and the terminal sharpens the first pixel including: determining the color value of the first pixel based on the shading rate of the i-th first type model and the color values of K pixels around the first pixel, and K is an integer greater than or equal to 1.
[0007] In the above embodiment, when performing ray tracing rendering on the model, the terminal can reduce the number of pixels whose color values are determined by ray tracing rendering, thereby reducing the number of emitted rays to save power consumption of ray tracing rendering. Later, the color values of pixels whose color values have not been determined by ray tracing rendering are updated (filled) and sharpened to ensure the realism and three-dimensional visual sense of the target image. In this way, high-quality rendering results are achieved while reducing power consumption of graphics rendering or increasing the speed of graphics rendering.
[0008] In combination with the first aspect, in some embodiments, the terminal determines the shading rates of W first-class models respectively, specifically including: the terminal determines the establishment accuracy level of the i-th first-class model; the establishment accuracy level of the i-th first-class model is used to indicate the distance from the i-th first-class model to the camera, and the weighted sum of the pixel quantity proportions corresponding to the i-th first-class model; wherein the pixel quantity proportion of the i-th model is: the proportion of all pixels corresponding to the i-th first-class model in all pixels of the target image; the terminal determines the shading rate corresponding to the establishment accuracy level through the establishment accuracy level of the i-th first-class model as the shading rate of the i-th first-class model.
[0009] In the above embodiment, the terminal determines the shading rate by the weighted sum of the distance from the model to the camera and the pixel volume proportion corresponding to the first type of model. The higher the weighted sum, the more important the model is in the target image, and the higher the corresponding establishment accuracy level is, and the corresponding shading rate is also high. In this way, the resources of ray tracing rendering can be given to more important models as much as possible. A reasonable allocation of resources is achieved.
[0010] In combination with the first aspect, in some embodiments, the terminal determines the establishment accuracy level of the i-th first-category model, specifically including: the terminal takes a times the distance from the i-th first-category model to the camera plus b times the pixel ratio corresponding to the i-th first-category model as the establishment accuracy value of the i-th first-category model; wherein a+b=1, and a is less than b; and determines the establishment accuracy level corresponding to the establishment accuracy value of the i-th first-category model.
[0011] In the above embodiment, when determining the accuracy level, the key consideration is still the proportion of pixels corresponding to the model, which is more in line with physical laws.
[0012] In combination with the first aspect, in some embodiments, the scene also includes E second-category models, and the terminal performs ray tracing rendering on each first-category model based on the shading rate and identification number of each first-category model to obtain a rendering result to be filled, specifically including: the terminal performs other rendering on each second-category model, and performs ray tracing rendering on each first-category model based on the shading rate and identification number of each first-category model to obtain a rendering result to be filled; wherein the rendering result to be filled includes a color image and a semantic image; the color image includes the color value of each pixel in the image to be filled, and also includes the filling identifier of each pixel in the image to be filled; in addition to all the pixels corresponding to the W first-category models, each pixel in the image to be filled also includes all the pixels corresponding to the E second-category models; the semantic image includes the rendering method identifier of the model corresponding to each pixel in the image to be filled and the shading rate of the model corresponding to each pixel in the image to be filled; Including a second pixel; when the second pixel is a pixel in the i-th first-category model and the second pixel is a colored pixel, the terminal determines that the fill identifier of the second pixel in the color image is 0; when the second pixel is a pixel in the i-th first-category model and the second pixel is a hole pixel, the terminal determines that the fill identifier of the second pixel in the color image is 1; when the second pixel is a pixel in the i-th first-category model, the terminal determines that the rendering method identifier of the second pixel in the semantic image is the identification number of the i-th first-category model; and, determines that the coloring rate of the second pixel in the semantic image is the coloring rate of the i-th first-category model; when the second pixel is a pixel in the second-category model, the terminal determines that the fill identifier of the second pixel in the color image is 0, and, determines that the rendering method identifier of the second pixel in the semantic image is a second preset value, and, the coloring rate of the second pixel in the semantic image is 0.
[0013] In the above embodiment, the terminal may record the information of each pixel using a semantic image and a color image, and subsequently generate a target image based on the information of each pixel.
[0014] In combination with the first aspect, in some embodiments, the terminal assigns identification numbers to the W first-category models included in the scene, specifically including: the terminal assigns identification numbers that are not equal to the second preset value to the W first-category models included in the scene.
[0015] In the above embodiment, because the second preset value has been used as the rendering mode identifier of the second type of model, in order to avoid ambiguity and affect the generation of the target image, the identification number of the first type of model cannot be equal to the second preset value.
[0016] In combination with the first aspect, in some embodiments, the terminal uses the colored pixels corresponding to the i-th first type model to update the color values of each hole pixel corresponding to the i-th first type model to obtain the image to be sharpened, specifically including: the terminal obtains the pixel with a filling mark of 1 in the image to be filled as the first hole pixel in a preset order; the terminal determines a third pixel that is adjacent to the first hole pixel and meets preset conditions; the meeting the preset conditions includes: the filling mark of the third pixel is 0, and the rendering mode mark of the third pixel is the same as the rendering mode mark of the first hole pixel; the terminal updates the color value of the first hole pixel to the color value of the third pixel.
[0017] In the above embodiment, the color value of the hole pixel is updated by using the color value of the colored pixel adjacent to the hole pixel, so that the hole pixel can obtain the correct color value to a greater extent, thereby making the target image more realistic.
[0018] In combination with the first aspect, in some embodiments, the color value of the first pixel is determined based on the shading rate of the i-th first-category model and the color values of K pixels around the first pixel, specifically including: the terminal obtains the color values of eight pixels adjacent to the first pixel; the color value of the first pixel includes a green value, a red value and a blue value; the sharpening coefficient is calculated based on the green value of the eight pixels and the shading rate of the first-category model corresponding to the first pixel; the terminal determines the color value of the first pixel based on the sharpening coefficient and the color value of the first pixel.
[0019] In the above embodiment, the color value of a pixel is sharpened based on K pixels surrounding the pixel, so that the color of the pixel becomes realistic to the greatest extent, thereby improving the clarity of the target image.
[0020] In combination with the first aspect, in some embodiments, the other rendering method includes raster rendering.
[0021] In combination with the first aspect, in some embodiments, a is 0.3 and b is 0.7.
[0022] In combination with the first aspect, in some embodiments, the fourth pixel is located in the cth row and the fth column in the target image, and the positions of pixels adjacent to the fourth pixel in the target image include: (c+1th row, fth column), (c-1th row, fth column), (cth row, f-1th column), (cth row, f+1th column), (c+1th row, f+1th column), (c-1th row, f-1th column), (c+1th row, f-1th column) and (c-1th row, f+1th column); the fourth pixel is a first hole pixel or a first pixel.
[0023] In a second aspect, the present application provides a terminal, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to cause the terminal to execute the method described in the first aspect or any one of the embodiments of the first aspect.
[0024] In the above embodiment, when performing ray tracing rendering on the model, the terminal can reduce the number of pixels whose color values are determined by ray tracing rendering, thereby reducing the number of emitted rays to save power consumption of ray tracing rendering. Later, the color values of pixels whose color values have not been determined by ray tracing rendering are updated (filled) and sharpened to ensure the realism and three-dimensional visual sense of the target image. In this way, high-quality rendering results are achieved while reducing power consumption of graphics rendering or increasing the speed of graphics rendering.
[0025] In a third aspect, an embodiment of the present application provides a chip system, which is applied to a terminal, and the chip system includes one or more processors, which are used to call computer instructions so that the terminal executes the method described in the first aspect or any one of the embodiments of the first aspect.
[0026] In the above embodiment, when performing ray tracing rendering on the model, the terminal can reduce the number of pixels whose color values are determined by ray tracing rendering, thereby reducing the number of emitted rays to save power consumption of ray tracing rendering. Later, the color values of pixels whose color values have not been determined by ray tracing rendering are updated (filled) and sharpened to ensure the realism and three-dimensional visual sense of the target image. In this way, high-quality rendering results are achieved while reducing power consumption of graphics rendering or increasing the speed of graphics rendering.
[0027] In a fourth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a terminal, enables the terminal to execute the method described in the first aspect or any one of the implementations of the first aspect.
[0028] In the above embodiment, when performing ray tracing rendering on the model, the terminal can reduce the number of pixels whose color values are determined by ray tracing rendering, thereby reducing the number of emitted rays to save power consumption of ray tracing rendering. Later, the color values of pixels whose color values have not been determined by ray tracing rendering are updated (filled) and sharpened to ensure the realism and three-dimensional visual sense of the target image. In this way, high-quality rendering results are achieved while reducing power consumption of graphics rendering or increasing the speed of graphics rendering.
[0029] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a terminal, cause the terminal to execute the method described in the first aspect or any one of the implementations of the first aspect.
[0030] In the above embodiment, when performing ray tracing rendering on the model, the terminal can reduce the number of pixels whose color values are determined by ray tracing rendering, thereby reducing the number of emitted rays to save power consumption of ray tracing rendering. Later, the color values of pixels whose color values have not been determined by ray tracing rendering are updated (filled) and sharpened to ensure the realism and three-dimensional visual sense of the target image. In this way, high-quality rendering results are achieved while reducing power consumption of graphics rendering or increasing the speed of graphics rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A schematic diagram is shown when a terminal performs image rendering;
[0032] Figure 2 An exemplary flow chart is shown when a terminal executes a pixel filling method based on ray tracing rendering to obtain a target image;
[0033] Figure 3A , which shows a schematic diagram of a terminal setting an identification number for a model in a scene;
[0034] Figure 3B A schematic diagram showing that a terminal performs raster rendering or ray tracing rendering based on Q models in a scene to obtain a rendering result to be filled;
[0035] Figure 3C An exemplary diagram showing updating the color value of a hole pixel;
[0036] Figure 4 is a schematic diagram of eight pixels adjacent to pixel E;
[0037] Figure 5 It is a schematic diagram of the structure of the terminal provided in the embodiment of the present application. DETAILED DESCRIPTION
[0038] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0039] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0040] Since the embodiments of the present application involve the application of graphics rendering, for ease of understanding, the relevant terms and concepts involved in the embodiments of the present application are first introduced below.
[0041] (1) Raster rendering and ray tracing rendering
[0042] Raster rendering is a common graphics rendering method. Graphics rendering can be understood as a method of processing (such as geometric transformation, projection transformation, etc.) at least one model (three-dimensional) to obtain a two-dimensional graphic, in which the at least one model can be presented, and the two-dimensional graphic has a three-dimensional visual sense and a sense of reality.
[0043] Figure 1 A schematic diagram showing the process involved in image rendering by a terminal.
[0044] like Figure 1 As shown, the model may include model 101, model 102 and model 103. The terminal may set a virtual camera and use the virtual camera as a reference. When models 101-103 are all in the field of view of the virtual camera, the terminal may perform graphic rendering (such as geometric transformation, projection transformation, etc.) on models 101, 102 and 103 to obtain a target image (two-dimensional), so that the target image includes model 101, model 102 and model 103. The target image may also reflect the relative position relationship of each model when the virtual camera is used as a reference.
[0045] Raster rendering projects each geometric body (model) onto the screen, then traverses each pixel and fills the pixels covered by the geometric body to obtain the rendering result. It should be understood that raster rendering has lower hardware requirements (compared to the ray tracing rendering involved below), but the rendering results obtained by raster rendering, such as the rendered images, have obvious deficiencies, including the lack of global illumination effects such as shadows and ambient occlusion, which makes it difficult to clearly understand the molecular structure.
[0046] Ray tracing rendering is another graphics rendering method. It simulates the reflection and scattering of light by tracing the light that interacts with objects in the scene. It can naturally achieve the effects of shadows and ambient light occlusion, and bring high-quality rendering results. However, the rendering process is very computationally intensive and has always been limited by hardware performance bottlenecks (high requirements for graphics processor hardware and limited scope of application). Therefore, ray tracing is often used for offline rendering of pictures and videos, and it is difficult to achieve the frame rate requirements for real-time interaction.
[0047] For the sake of convenience in the following description, ray tracing rendering can be referred to as ray tracing rendering.
[0048] In the prior art, in order to achieve high-quality rendering results while reducing graphics rendering power consumption or increasing graphics rendering speed, a combination of raster rendering and ray tracing rendering can usually be used to achieve graphics rendering. For models that do not require natural shadow and ambient occlusion effects, raster rendering can be used, and for models that require natural shadow and ambient occlusion effects, ray tracing rendering can be used.
[0049] However, once ray tracing rendering is involved, the hardware performance will be improved, and the terminal will consume more power when rendering images. The more pixels that need ray tracing rendering, the more power consumption of ray tracing rendering.
[0050] In an embodiment of the present application, a pixel filling method is proposed. Here, it is taken as an example that a scene includes W first-class models that can be rendered by ray tracing, where W is a positive integer greater than or equal to 1. In the process of the terminal using ray tracing to render the W first-class models to output the target image, the shading rate of some or all of the W first-class models can be reduced according to preset rules: some three-dimensional points of the first-class model are set not to be colored by ray tracing rendering, and the color values of the pixels corresponding to the uncolored three-dimensional points of the part can be set to the default value, that is, after the first-class model is rendered by ray tracing, all the pixels corresponding to the first-class model include uncolored pixels (called hole pixels) and colored pixels (pixels colored by ray tracing rendering). The lower the shading rate of a first-class model, the more uncolored hole pixels there are in all the pixels corresponding to the first-class model in the target image. In this way, the power consumption of ray tracing can be reduced.
[0051] Subsequently, the terminal may perform pixel filling on the hole pixels corresponding to the first type of model and calculate the color value of the hole pixels. For example, for a hole pixel A applied to the first type of model A, the terminal may determine the color value of a colored pixel around the hole pixel A in the first type of model A as the color value of the hole pixel A. After updating the color values of all the hole pixels corresponding to the W first type of models, since the color values of the hole pixels corresponding to the W first type of models are the same as the color values of the surrounding colored pixels, the resulting image will become blurred. Therefore, the terminal may perform sharpening processing on all the pixels corresponding to the first type of model to obtain the target image to improve the clarity of the target image.
[0052] Among them, sharpening a pixel means re-estimating the color value of the pixel based on the color values of the R pixels surrounding the pixel and the shading rate of the model corresponding to the pixel. The color value of the pixel after sharpening can be related to the color values of the R pixels around it, but usually they are not the same. In this way, the clarity of the target image is improved while ensuring the realism of the target image.
[0053] It should be understood that the scene may also include E second-type models, and the second-type models may be processed using raster rendering to obtain pixel information corresponding to the E second models in the target image.
[0054] Figure 2 An exemplary flow chart involved in a terminal executing a pixel filling method to obtain a target image is shown.
[0055] For this process, reference may be made to the following description of steps S101 to S106 .
[0056] S101. The terminal assigns identification numbers (IDs) to Q models, and determines W first-category models to be rendered by ray tracing, and E second-category models to be subsequently rendered by rasterization; wherein Q and W are integers greater than or equal to 1, and Q=W+E.
[0057] The identification number (ID) can be used to uniquely identify a model, that is, different models have different corresponding identification numbers.
[0058] Here, a scenario including Q models is used as an example for explanation. The Q models include W first-type models and E second-type models. Wherein, Q and W are integers greater than or equal to 1, and Q=W+E.
[0059] The first type of model is a model that can perform ray tracing rendering, and the second type of model is a model that can perform raster rendering. It should be understood that, generally speaking, a model that can perform raster rendering may not perform ray tracing rendering, or a model that can perform ray tracing rendering may not perform raster rendering. Whether a model performs raster rendering or ray tracing rendering can be preset by the terminal.
[0060] In some possible cases, the identification number of the first type of model can also be used to determine the rendering mode identifier of the model. Among them, the rendering mode includes the aforementioned raster rendering and ray tracing rendering. The terminal can set the rendering mode identifier corresponding to the model for raster rendering (second model) to a preset value A (for example, 0 or other characters). Set the rendering mode identifier corresponding to the model for ray tracing rendering (first type of model) to the identification number of the first type of model. Therefore, when the terminal assigns identification numbers to Q models, the identification number corresponding to the first type of model cannot be equal to the preset value A.
[0061] Figure 3A A schematic diagram showing a terminal setting an identification number for a model in a scene is shown in FIG.
[0062] like Figure 3A The W models included in the scene may be model 101, model 102, model 103 and other models. Model 101-model 103 is specifically used as an example for illustration here, and the processing methods of other models can refer to the description of model 101-model 103. Further, here, model 101 is taken as the second model, model 102 and model 103 are the first type of models, and the preset value A is equal to 0. The terminal may define the identification number of model 101 as 1; define the identification number of model 102 as different from the preset value A(0), for example, as 2; and define the identification number of model 103 as different from the preset value A(0), for example, as 3.
[0063] It should be understood that the identification number of the second type of model may be the same as the preset value A, or may be different from the preset value A, and this is not limited in the present embodiment. In some possible cases, the terminal may identify different models separately during drawcall drawing.
[0064] S102. For the W first-class models, the terminal determines the establishment accuracy (LOD) levels of different first-class models based on the distances of different first-class models from the camera and their proportions in the target image, and obtains the LOD levels of the W first-class models.
[0065] For the ith first-category model among W first-category models, the terminal can take a times the distance from the ith first-category model to the camera plus b times the percentage of the number of pixels corresponding to the ith first-category model as the establishment accuracy value of the ith first-category model. Then, the establishment accuracy value is converted into the corresponding establishment accuracy level. Wherein, a+b=1, and a is less than b; i is an integer and changes from 1 to W. Wherein, the percentage of the number of pixels corresponding to the ith first-category model is: the percentage of the ith first-category model in the target image, which can be expressed as the percentage of all pixels corresponding to the ith first-category model in all pixels of the target image.
[0066] The process involved in the terminal determining the distance from the i-th first-category model to the camera can be described as follows:
[0067] The terminal determines the world coordinates (X0, Y0, Z0) of the camera in the world coordinate system established based on the camera (the virtual camera involved in the graphics rendering), and the world coordinates (X, Y, Z) of the i-th first-class model in the model's space matrix (also referred to as the camera space matrix). Then, the terminal converts the world coordinates (X0, Y0, Z0) of the camera and the world coordinates (X i ,Y i ,Z i ) is taken as the distance from the i-th first-category model to the camera. The calculation process involved can refer to the following formula (1).
[0068]
[0069] In formula (1), D i It represents the distance from the i-th first-class model to the camera.
[0070] The process of the terminal determining the pixel amount ratio corresponding to the i-th first-category model may refer to the following description:
[0071] The terminal can calculate the ratio of the number of pixels in the bounding sphere of the i-th first-category model to the total number of pixels in the target image as the percentage of the number of pixels corresponding to the i-th first-category model. The bounding sphere of the i-th first-category model represents the smallest sphere that surrounds the i-th first-category model. In addition to the bounding sphere, a bounding box can also be used, as long as the i-th first-category model can be surrounded as small as possible. The embodiment of the present application does not limit this. The formula involved in this process is as follows: Formula (2).
[0072]
[0073] In formula (2), R represents the number of pixels of the bounding sphere of the i-th first-class model. width and height represent the width and height of the target image resolution, in pixels. R represents the number of pixels on the radius of the bounding sphere.
[0074] Then, the terminal can determine the establishment accuracy value of the i-th first-class model by combining the distance from the i-th first-class model to the camera and the pixel volume ratio corresponding to the i-th first-class model. The process can refer to the following description of formula (3).
[0075] L i =a×D i +b×P i Formula (3)
[0076] Among them, L i represents the accuracy of the i-th model, a represents the contribution (weight) of the distance from the i-th first-class model to the camera to the accuracy of the i-th first-class model, and b represents the contribution (weight) of the percentage of pixels corresponding to the i-th first-class model to the accuracy of the i-th first-class model. Generally speaking, a+b=1, and a is less than b. For example, a=0.3, b=0.7.
[0077] Then, the terminal may convert the establishment accuracy value of the i-th model into the corresponding establishment accuracy level. The specific description of the process is as follows:
[0078] The terminal includes an accuracy parameter table, which records the correspondence between different establishment accuracy values and accuracy establishment levels. The terminal can determine the establishment accuracy level corresponding to the establishment accuracy value of the i-th first type model by searching the accuracy parameter table. For example, the following Table 1 describes an exemplary accuracy parameter table.
[0079] Table 1
[0080] Establishing precision values Establishing the level of accuracy Range A 0 (highest level) Range B 1 Range C 2 Range D 3 … …
[0081] As shown in Table 1, when the establishment accuracy value is in different ranges, the corresponding establishment accuracy level is different. For example, when the establishment accuracy value belongs to range A, the establishment accuracy level is level 0.
[0082] It should be understood that in addition to the method of determining the model establishment accuracy level recorded in the aforementioned step S102, the terminal can also determine the establishment accuracy level in other ways. For example, the accuracy level is determined based on the pixel ratio corresponding to the i-th first-class model. The higher the pixel ratio, the higher the accuracy level. Correspondingly, the higher the shading rate corresponding to the accuracy level. In some possible cases, the terminal can transmit the shading rate of the model to the ray tracing shader through a uniform variable.
[0083] S103. The terminal determines the shading rates of different first-class models based on the LOD levels of W first-class models; wherein, the lower the LOD level of the i-th first-class model, the lower the shading rate of the first-class model, and the shading rate of the first-class model represents the proportion of colorable pixels corresponding to the first-class model in all pixels corresponding to the first-class model, and the colorable pixels represent pixels whose color values can be determined by ray tracing rendering; all pixels corresponding to the first-class models are all pixels corresponding to the first-class models in the image to be filled, and all pixels corresponding to the first-class models include not only colorable pixels but also hole pixels; hole pixels are pixels whose color values can be determined without ray tracing rendering; the image to be filled includes the color values of each pixel after rendering by Q models.
[0084] The terminal includes a shading rate parameter table, which records the correspondence between different establishment accuracy levels and shading rates. The terminal can determine the shading rate corresponding to the establishment accuracy level of the i-th first type model by searching the shading rate parameter table. For example, Table 2 below describes an example shading rate parameter table.
[0085] Table 2
[0086] Establishing Level of Detail (LOD) Coloring rate 0 (highest level) 1 1 0.5 2 0.25 3 0.0625 … …
[0087] As shown in Table 2, different LOD levels correspond to different shading rates. Among them, a shading rate of a first-class model of 1 indicates that all pixels corresponding to the first-class model can determine the color value through ray tracing rendering. The smaller the shading rate of a first-class model, the more hole pixels there are after ray tracing rendering of the first-class model. A hole pixel is a pixel whose color value is not determined by ray tracing rendering when ray tracing rendering is performed on the first-class model. The color value of the hole pixel can be determined according to the color of the adjacent colored pixels in the first-class model where the hole pixel is located. The description of this science can be referred to the following description of step S105, which will not be repeated here.
[0088] It should be understood here that if the shading rate of the i-th first-category model is p, then the percentage of colorable pixels corresponding to the i-th first-category model in all pixels corresponding to the first-category model is p. The percentage of hole pixels corresponding to the i-th first-category model in all pixels corresponding to the first-category model is 1-p. Among them, colorable pixels refer to pixels whose color values can be determined by ray tracing rendering.
[0089] All pixels corresponding to the first type of model are all pixels corresponding to the first type of model in the image to be filled, and the number of pixels included in the image to be filled is the same as the number of pixels in the image to be sharpened and the target image. Moreover, the three-dimensional points of the model indicated by the pixels in the i-th row and j-th column in the image to be filled, the image to be sharpened and the target image are the same. Among them, the image to be filled is an image obtained after raster rendering or ray tracing rendering of Q models respectively. For the relevant description of the image to be filled, please refer to the following description of step S104. For the relevant description of the image to be sharpened and the target image, please refer to the following description of step S105 and step S106 respectively.
[0090] S104. The terminal performs ray tracing rendering based on the shading rates and identification numbers of the W first-category models, and performs raster rendering based on the identification numbers of the E second-category models, to obtain a rendering result to be filled, which includes a color image and a semantic image; wherein the color image includes the color value of each pixel in the image to be filled, and the filling identification of each pixel; the semantic image includes the rendering method identification (preset value A or identification number) of the model corresponding to each pixel in the image to be filled, and the shading rate of the model corresponding to each pixel, each pixel in the image to be filled includes a colored pixel and a hole pixel, the color value of the colored pixel is the rendering result, and the color value of the uncolored pixel is empty or the preset value B.
[0091] It should be understood that in step S104, the operation of performing raster rendering on the second type of model by the terminal is optional because the second type of model may not be included in the scene, that is, E=0.
[0092] The terminal can perform ray tracing rendering based on the shading rates and identification numbers of the W first-class models to obtain a rendering result to be filled, which includes the color value of each pixel in the image to be filled. Each pixel in the image to be filled includes all pixels corresponding to the W first-class models. The W first-class models include the i-th first-class model, and the shading rate of the i-th first model is p. Then, the proportion of colored pixels included in all pixels corresponding to the i-th first-class model in the image to be filled to the i-th first-class models is p, and the proportion of hole pixels included in all pixels corresponding to the i-th first-class model to the i-th first-class models is 1-p. Among them, the colored pixels are the pixels to be colored after the color values of the aforementioned pixels to be colored are determined by ray tracing rendering.
[0093] When E is not 0, the terminal may perform raster rendering based on the identification numbers of the E second-type models. In this case, the image to be filled included in the rendering result to be filled may also include all pixels corresponding to the E second models.
[0094] It should be understood that the identification number of a model may correspond to the rendering method of the model (raster rendering or ray tracing rendering). The terminal may determine whether the model determines the color value of the pixel using raster rendering or ray tracing rendering through the identification number of the model.
[0095] In addition to the color value of each pixel in the image to be filled mentioned above, the rendering result to be filled may also include the filling mark of each pixel in the image to be filled. It may also include the rendering method mark of each pixel in the image to be filled and the coloring rate of the model corresponding to each pixel. The color value of each pixel in the image to be filled and the filling mark of each pixel may be included in the color image; the rendering method mark of each pixel in the image to be filled and the coloring rate of the model corresponding to each pixel may be included in the semantic image.
[0096] That is, the rendering result to be filled may include a color image and a semantic image. A pixel in the rendering result to be filled may include a color value, a fill flag, a rendering mode flag, and a shading rate of the model corresponding to the pixel. The following describes a method for determining the color value, fill flag, rendering mode flag, and shading rate of the model corresponding to the pixel in the rendering result to be filled, assuming that each pixel in the image to be filled includes pixel A; pixel A may be any pixel in the pixels to be filled:
[0097] When the pixel A is a pixel in the i-th first-category model, and the pixel A is a colored pixel, the terminal determines that the fill mark of the pixel A in the color image is 0; when the pixel A is a pixel in the i-th first-category model, and the pixel A is a hole pixel, the terminal determines that the fill mark of the pixel A in the color image is 1; that is, the fill mark of 0 indicates that the color value of the pixel A is determined by ray tracing rendering. The fill mark of 1 indicates that the color value of the pixel A is empty or is a preset value B. Among them, when the color value of the pixel A is represented in the RGB space, the preset value B can be defined as (0,0,0) or other values. The embodiments of the present application do not limit this. It can be seen that in the image to be filled, the color value of the hole pixel is not the real color value.
[0098] When the pixel A is a pixel in the i-th first-category model, the terminal determines that the rendering method of the pixel A in the semantic image is identified as the identification number of the i-th first-category model; and determines that the coloring rate of the pixel A in the semantic image is the coloring rate of the i-th first-category model.
[0099] When the pixel A is a pixel in the second model, the terminal determines that the fill flag of the pixel A in the color image is 0, and determines that the rendering mode flag of the pixel A in the semantic image is a preset value A, and the coloring rate of the pixel A in the semantic image is 0. Here, the preset value A is 0 for example, and it can also be other values, which is not limited in the embodiments of the present application.
[0100] It should be understood that when it is determined that the rendering mode identifier of pixel A is equal to 0, it can be determined that the rendering mode of the model corresponding to pixel A is raster rendering. When it is determined that the rendering mode identifier of pixel A is not equal to 0, it can be determined that the rendering mode of the model corresponding to pixel A is ray tracing rendering. The rendering mode identifier that is not 0 is the same as the identification number of the model corresponding to pixel A, and can also be used to determine the model corresponding to pixel A.
[0101] The terminal performs ray tracing rendering based on the shading rate and identification number of the i-th first-category model, and obtains the color values of all pixels corresponding to the i-th first-category model in the image to be filled as follows:
[0102] Here, pixel B is taken as an example for detailed description. Pixel B can be any pixel among all pixels corresponding to the i-th first-category model. The terminal determines the pixel coordinates (U0, V0) of pixel B, and determines whether there is a pixel C whose color value has been determined by ray tracing rendering among the [1 / α] or [1 / α]+1 pixels (the identification number is the same as that of pixel B, that is, both of them correspond to the i-th first-category model) close to (adjacent to) pixel B. If pixel C exists, ray tracing rendering may not be performed on pixel B; if pixel C does not exist, ray tracing rendering may be performed on pixel B. Among them, [1 / α] means rounding 1 / α.
[0103] In some possible cases, pixel B is in the cth row and fth column of the image, and the positions of pixels adjacent to pixel B in the image include: (c+1th row, fth column), (c-1th row, fth column), (cth row, f-1th column), (cth row, f+1th column), (c+1th row, f+1th column), (c-1th row, f-1th column), (c+1th row, f-1th column) and (c-1th row, f+1th column).
[0104] Figure 3B A schematic diagram is shown in which a terminal performs raster rendering or ray tracing rendering based on Q models in a scene to obtain a rendering result to be filled.
[0105] Here, the aforementioned models 101 to 103 are still used as an example for explanation, with model 101 being the second model and models 102 and 103 being the first type of models.
[0106] like Figure 3B As shown, the rendering result to be filled includes a color image and a semantic image, and the color image includes 4 channels, namely, R channel, G channel, B channel and A channel. Among them, the R channel, G channel and B channel in the color image are used to record the color value of each pixel in the image to be filled, and the A channel is used to record the filling mark of each pixel in the image to be filled. The semantic image may include 2 channels, namely, R channel and G channel. Among them, the R channel in the semantic image is used to record the rendering mode mark of each pixel in the image to be filled, and the G channel is used to record the shading rate of each pixel in the image to be filled.
[0107] If pixel 101 is a pixel in model 101 (the second type of model), the terminal can use raster rendering to determine the color value of pixel 101, and the fill flag is recorded as 0. Then, in the color image, the terminal can fill a3, b3, c3 and 0 in the R, G, B, and A channels corresponding to pixel 101, respectively. In the semantic image, 0 is filled in the R and G channels corresponding to pixel 101, respectively.
[0108] If pixel 102 is a pixel in model 102 (a first type model with a shading rate of 1), the terminal may perform ray tracing rendering on the light emitted by pixel 102 when rendering the model 102 to determine the color value of pixel 102. At this time, the terminal may fill a2, b2, c2, and 0 in the R, G, B, and A channels corresponding to pixel 102 in the color image, respectively. In the semantic image, 2 and 1 are filled in the R and G channels corresponding to pixel 102, respectively.
[0109] Pixel 1003 and pixel 104 are pixels in model 103 (a first type model with a shading rate of 0.5). When the terminal renders model 103, it can perform ray tracing rendering on the light emitted by pixel 1003 to determine the color value of pixel 1003. At this time, the terminal can fill a1, b1, c1 and 0 in the R, G, B, and A channels corresponding to pixel 1003 in the color image, respectively. In the semantic image, 3 and 0.5 are filled in the R and G channels corresponding to pixel 1003, respectively. Ray tracing rendering may not be performed on the light emitted by pixel 104, that is, the color value of pixel 104 is not determined by ray tracing rendering. At this time, the terminal can fill 0, 0, 0 and 1 in the R, G, B, and A channels corresponding to pixel 104 in the color image, respectively. In the semantic image, 3 and 0.5 are filled in the R and G channels corresponding to pixel 104, respectively.
[0110] It should be understood that there are some pixels in model 103 (0.5 times all pixels corresponding to model 103) whose color values can be determined without ray tracing rendering, so the terminal can save some power consumption when performing ray tracing rendering on model 103.
[0111] It can be understood that the aforementioned pixel 1003 and pixel 102 are colored pixels, and pixel 104 is a hole pixel.
[0112] The color value of the hole pixel included in the pixels to be filled may be updated to the color value of a colored pixel (same model as the hole pixel) around the hole pixel. For a detailed description of this process, please refer to the description of step S105 below.
[0113] In some cases, the terminal may complete the rendering of the Q models through multi-target rendering (MRT) to obtain rendering targets to be filled.
[0114] S105. In combination with the semantic image included in the rendering result to be filled, color filling is performed on each hole pixel in the image to be filled, and the color value of each hole pixel is updated to obtain the rendering result to be sharpened. The color image of the rendering result to be sharpened includes the color value of each pixel in the image to be sharpened and the filling mark of each pixel, and also includes the semantic image. Each pixel in the image to be sharpened includes the pixels corresponding to the second model and the pixels corresponding to the first type of model (including the colored pixels and the updated hole pixels).
[0115] The terminal may obtain the pixel (hole pixel A) with a filling mark of 0 in the image to be filled in the first order, and update the color value of the hole pixel A. It is updated to a pixel D adjacent to the hole pixel and meeting a preset condition. The preset condition includes: the filling mark of the pixel D is 0, and the rendering mode mark of the pixel D is the same as the rendering mode mark of the hole pixel. That is, the models corresponding to the hole pixel A and the pixel D are the same.
[0116] Among them, the first order includes from the first hole pixel to the last hole pixel; or, from the last hole pixel to the first hole pixel, as long as all the hole pixels can be traversed according to the first order, the embodiment of the present application is not limited to this.
[0117] The terminal can update the color value of each hole pixel in the image to be filled to the color value of the pixel adjacent to the hole pixel and meeting the preset conditions, so that the image to be sharpened can be obtained. That is, when the terminal updates the image to be filled in the rendering result to be filled to the image to be sharpened, the terminal can obtain the rendering result to be sharpened.
[0118] Figure 3C An exemplary diagram showing updating the color values of hole pixels.
[0119] Here is an update to the above Figure 3BThe color value of pixel 104 (hole pixel) involved in is used as an example for explanation. The terminal can determine pixel 1003 as a pixel adjacent to pixel 104 and meeting the preset conditions. Subsequently, the terminal can update the color value of pixel 104 from (0,0,0) to (a1, b1, c1). After the update, the R, G, B, and A channels corresponding to pixel 104 are a1, b1, c1, and 1, respectively. The R, G, B, and A channels corresponding to pixel 1003 are a1, b1, c1, and 0, respectively.
[0120] All the hole pixels of the image to be filled include the hole pixel A. Here, updating the color value of the hole pixel A is taken as an example for explanation. The process of the terminal determining the pixel D adjacent to the hole pixel A and meeting the preset conditions can refer to the following description.
[0121] Determine the shading rate of the hole pixel A, the pixel coordinates (U1, V1) of the hole pixel A, the shading rate α1, the offset step size m (initialized to 1), and the offset direction dir is preset as a vector (X1, Y1). The terminal executes the following steps 1-6 to determine the pixel coordinates (U2, V2) of the pixel D.
[0122] Step 1. Determine whether the current offset step size m is less than [1 / α1].
[0123] If the offset step size m is less than [1 / α1], execute the following step 2.
[0124] If the offset step length m is greater than or equal to [1 / α1], the color value of the hole pixel A is updated, and its corresponding color value is determined to be the preset value B.
[0125] Step 2. Determine that the offset direction dir is one of the following preset vectors. The preset vectors include the 8th preset vector, which are: (1, 0), (0, 1), (-1, 0), (0, -1), (1, 1), (-1, 1), (-1, -1), (1, -1), that is, the vector (X1, Y1) can be the jth (initial value of j = 1) preset vector among the aforementioned multiple preset vectors. j is updated from 1 to 8; the sequence numbers of the 8 preset vectors (the number of the preset vector) are not limited, and one preset vector corresponds to one sequence number.
[0126] Step 3. The terminal determines j=j+1.
[0127] Step 4. The terminal determines whether j is less than or equal to 8;
[0128] When the terminal determines that j is less than or equal to 8, the following step 5 is executed.
[0129] When the terminal determines that j is greater than 8, the terminal determines that m=m+1, j=1. Subsequently, the terminal executes the aforementioned step 1.
[0130] Step 5. The terminal determines the pixel coordinates (U2, V2) = (U1, V1) + (X1, Y1) * m.
[0131] Step 6. The terminal determines whether the rendering mode identifier of the pixel corresponding to the pixel coordinates (U2, V2) is the same as the rendering mode identifier of the hole pixel A, and whether the filling identifier of the pixel corresponding to the pixel coordinates (U2, V2) is 0.
[0132] If it is determined that the rendering mode identifier of the pixel corresponding to the pixel coordinate (U2, V2) is the same as the rendering mode identifier of the hole pixel A, and the filling identifier of the pixel corresponding to the pixel coordinate (U2, V2) is 0. The terminal uses the pixel corresponding to the pixel coordinate (U2, V2) determined in step 6 as the pixel coordinate (U2, V2) of pixel D, and terminates this calculation, determines the next hole pixel according to the first order, and determines the neighboring pixels of the next hole pixel that meet the preset conditions according to steps 1 to 6.
[0133] If it is determined that the rendering mode identifier of the pixel corresponding to the pixel coordinates (U2, V2) is different from the rendering mode identifier of the hole pixel A, or the filling identifier of the pixel corresponding to the pixel coordinates (U2, V2) is 1, the terminal executes the aforementioned step 2.
[0134] In some possible cases, the pixel coordinates of the hole pixel A are (U1, V1) = (X2, Y2) * (width, height), where width and height respectively represent the width and height of the target image resolution, and (X2, Y2) represents the spatial coordinates of the hole pixel.
[0135] S106. In combination with the semantic image included in the rendering result to be sharpened, the color values of all pixels corresponding to the first type of model in the image to be sharpened in the rendering result to be sharpened to obtain the target rendering result, and the color value of each pixel in the target rendering result is used as the target image; wherein the pixel to be processed is a pixel whose color value is obtained by fill shading or ray tracing rendering shading.
[0136] Obtain pixels in the image to be sharpened in the second order. When it is determined that the rendering mode identifier of the pixel is 0, keep the color value of the pixel unchanged, and obtain the next pixel in the second order. When it is determined that the rendering mode of the pixel is not 0, determine that the pixel is a pixel to be sharpened, and define the pixel as pixel E. Subsequently, the terminal can redetermine the color value of the pixel E based on the shading rate of the model corresponding to the pixel E and the color values of K (e.g., 8) pixels around the pixel, and change the current color value of the pixel E to the redetermined color value.
[0137] After the terminal performs sharpening processing on all the pixels to be sharpened in the image to be sharpened, the target image can be obtained. It should be understood here that the pixels to be sharpened are the pixels whose corresponding model is the first type of model.
[0138] The process of re-determining the color value of the pixel E based on the shading rate of the model corresponding to the pixel E and the color values of K (e.g., 8) pixels around the pixel (the process may be referred to as sharpening the pixel E) may refer to the following description:
[0139] First, the terminal obtains 8 pixels adjacent to pixel E in the image to be sharpened. Figure 4 , which is a schematic diagram of eight pixels adjacent to pixel E. The eight pixels are: pixel 1 to pixel 8.
[0140] Subsequently, the terminal determines the sharpening coefficient of pixel E based on the eight pixels and the green value of pixel E (data in the G channel of the color image) and the shading rate α2 of pixel E. The detailed description of this process can refer to the following formula (4).
[0141]
[0142] In formula (4), w_final(E) is the sharpening coefficient of pixel E; α2 is the shading rate of pixel E. max_g is the maximum green value among the eight pixels and pixel E. min_g is the minimum green value among the eight pixels and pixel E.
[0143] Then, the terminal can sharpen the color value of the pixel E based on the sharpening coefficient of the pixel E. When the color value of the pixel E is expressed in the RGB space, the color value of the pixel E includes a red value (R value), a green value (G value) and a blue value (B value). The formula for sharpening the red value of the pixel E can refer to the following formula (5).
[0144]
[0145] Formula (5), R_E is the red value of the pixel E before sharpening, color_E_R is the red value of the pixel E after sharpening, R(k) represents the red value of the kth pixel in pixel 1 to pixel 8. w_final(E) represents the sharpening coefficient of pixel E.
[0146] It should be understood that the sharpening process of the green value of the pixel E and the sharpening process of the blue value of the pixel E are the same as the aforementioned sharpening process of the red value of the pixel E, and reference may be made to the relevant description, which will not be repeated here.
[0147] The second order can be from the first pixel in the image to be sharpened to the last pixel in the image to be sharpened; it can also be from the last pixel in the image to be sharpened to the first pixel in the image to be sharpened; it can also be other orders, as long as the pixels in the image to be sharpened can be traversed according to the second order, and the embodiments of the present application are not limited to this.
[0148] In this way, when ray tracing is performed on the model, the number of pixels whose color values are determined by ray tracing rendering can be reduced, thereby reducing the number of emitted rays to save power consumption of ray tracing rendering. Later, the color values of pixels whose color values are not determined by ray tracing rendering are updated (filled) and sharpened to ensure the realism and three-dimensional visual effect of the target image.
[0149] It should be understood that in the embodiment of the present application, the rendering method corresponding to the second model, in addition to raster rendering, also includes other rendering methods other than ray tracing rendering, and the implementation of the present application does not limit this.
[0150] In the embodiment of the present application, the i-th first-category model involved in the embodiment of the present application may also be referred to as the first model. The preset value B may also be referred to as the first preset value; the first pixel may be a pixel in any first-category model in the image to be sharpened, such as the pixel E mentioned above. The first order may also be referred to as the preset order; the hole pixel A may also be referred to as the first hole pixel. Any pixel in the image to be filled may be referred to as the second pixel. Pixel D may be referred to as the third pixel. The rendering mode identifier (preset value A) corresponding to the second-category model may be referred to as the second preset value.
[0151] The following introduces an exemplary terminal provided in an embodiment of the present application.
[0152] Figure 5 It is a schematic diagram of the structure of the terminal provided in the embodiment of the present application.
[0153] The following embodiment is specifically described by taking a terminal as an example. It should be understood that a terminal may have more than Figure 5 More or fewer components may be shown, two or more components may be combined, or there may be a different configuration of components. Figure 5 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0154] The terminal may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194 and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0155] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the terminal. In other embodiments of the present application, the terminal may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0156] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0157] The controller can be the nerve center and command center of the terminal. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0158] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or is cyclically used.
[0159] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0160] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the terminal. In other embodiments of the present application, the terminal may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0161] The charging management module 140 is used to receive charging input from a charger.
[0162] The power management module 141 is used to connect the battery 142 , the charging management module 140 and the processor 110 .
[0163] The wireless communication function of the terminal can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0164] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the terminal can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas.
[0165] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc. applied to the terminal. The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc.
[0166] A modem processor may include a modulator and a demodulator.
[0167] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), etc. applied on the terminal.
[0168] In some embodiments, antenna 1 of the terminal is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that the terminal can communicate with the network and other devices through wireless communication technology.
[0169] The terminal implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0170] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display panel can also be made of an organic light-emitting diode (OLED), an active matrix organic light-emitting diode, etc. In some embodiments, the terminal can include 1 or N display screens 194, where N is a positive integer greater than 1.
[0171] The terminal can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0172] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0173] Camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the terminal may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0174] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the terminal is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0175] Video codecs are used to compress or decompress digital video.
[0176] NPU is a neural-network (NN) computing processor. It can quickly process input information by drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, and can also continuously self-learn.
[0177] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0178] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), etc.
[0179] Non-volatile memory may include disk storage devices and flash memory.
[0180] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle, and can be divided into single-level cell (SLC), multi-level cell (MLC), etc. according to the potential level of the storage cell.
[0181] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0182] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0183] The external memory interface 120 may be used to connect to an external non-volatile memory to expand the storage capacity of the terminal.
[0184] The terminal can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor.
[0185] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals.
[0186] The speaker 170A, also called a "horn", is used to convert audio electrical signals into sound signals.
[0187] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals.
[0188] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.
[0189] The earphone jack 170D is used to connect a wired earphone.
[0190] Touch sensor 180K, also called "touch panel".
[0191] The buttons 190 include a power button, a volume button, etc. The motor 191 can generate a vibration prompt.
[0192] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0193] The SIM card interface 195 is used to connect a SIM card.
[0194] In the embodiment of the present application, the processor 110 can call the computer instructions stored in the internal memory 121 to enable the terminal to execute the pixel filling method in the embodiment of the present application.
[0195] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0196] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
[0197] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0198] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
Claims
1. A pixel filling method, the method being applied to an electronic device, characterized in that: The method comprises: Determine the coloring rates of W first-category models respectively; W is an integer greater than or equal to 1; Perform ray tracing rendering on each of the first-category models based on the shading rate and identification number of each first-category model to obtain a rendering result to be filled; the rendering result to be filled includes at least the color value of each pixel in the image to be filled; each pixel in the image to be filled includes all pixels corresponding to the W first-category models; the W first-category models include a first model, and the shading rate of the first model is p, then the proportion of colored pixels corresponding to the first model shown in the image to be filled in all pixels corresponding to the first model is p, and the proportion of hole pixels corresponding to the first model in all pixels corresponding to the first model is 1-p; the colored pixels are pixels whose color values are determined by ray tracing rendering among all pixels corresponding to the first model; the color value of each hole pixel is a first preset value or empty; Using the colored pixels corresponding to the i-th first type model, the color values of the hole pixels corresponding to the i-th first type model are updated to obtain the image to be sharpened; wherein i is an integer and changes from 1 to W; Sharpening all pixels corresponding to all first-type models in the image to be sharpened to obtain a target image; wherein all pixels corresponding to the first-type models include a first pixel, and sharpening the first pixel includes: determining a color value of the first pixel based on a shading rate of the i-th first-type model and color values of K pixels around the first pixel, where K is an integer greater than or equal to 1.
2. The method according to claim 1, characterized in that The method further includes: before determining the coloring rates of the W first-type models, the method further includes: Assign identification numbers to the W first-category models.
3. The method according to claim 1 or 2, characterized in that: Determine the coloring rates of W first-class models respectively, including: Determine the level of accuracy of establishing the i-th first-category model; the level of accuracy of establishing the i-th first-category model is used to indicate the distance from the i-th first-category model to the camera, and the weighted sum of the percentage of pixels corresponding to the i-th first-category model; wherein the percentage of pixels of the i-th model is: the percentage of all pixels corresponding to the i-th first-category model in all pixels of the target image; The coloring rate corresponding to the building accuracy level is determined according to the building accuracy level of the i-th first-category model as the coloring rate of the i-th first-category model.
4. The method according to any one of claims 1 to 3, characterized in that Determining the accuracy level of the i-th first-category model, specifically comprising: A times the distance from the i-th first-category model to the camera plus b times the percentage of pixels corresponding to the i-th first-category model are taken as the establishment accuracy value of the i-th first-category model; wherein a+b=1, and a is less than b; Determine the establishment accuracy level corresponding to the establishment accuracy value of the i-th first-category model.
5. The method according to any one of claims 1 to 4, characterized in that Performing ray tracing rendering on each of the first-category models based on the shading rate and identification number of each of the first-category models to obtain a rendering result to be filled, specifically including: Rendering is performed on each of the second-category models separately in a manner other than ray tracing rendering, and ray tracing rendering is performed on each of the first-category models based on the shading rate and identification number of each of the first-category models to obtain a rendering result to be filled; wherein the rendering result to be filled includes a color image and a semantic image; the color image includes the color value of each pixel in the image to be filled, and also includes the filling identification of each pixel in the image to be filled; in addition to all the pixels corresponding to the W first-category models, each pixel in the image to be filled also includes all the pixels corresponding to the E second-category models; the semantic image includes the rendering method identification of the model corresponding to each pixel in the image to be filled and the shading rate of the model corresponding to each pixel in the image to be filled; each pixel in the image to be filled includes a second pixel; When the second pixel is a pixel in the i-th first-category model and the second pixel is a colored pixel, a fill flag of the second pixel in the color image is determined to be 0; when the second pixel is a pixel in the i-th first-category model and the second pixel is a hole pixel, a fill flag of the second pixel in the color image is determined to be 1; In the case where the second pixel is a pixel in the i-th first-category model, determining that the rendering mode identifier of the second pixel in the semantic image is the identification number of the i-th first-category model; and determining that the coloring rate of the second pixel in the semantic image is the coloring rate of the i-th first-category model; When the second pixel is a pixel in the second type of model, the fill flag of the second pixel in the color image is determined to be 0, and the rendering mode flag of the second pixel in the semantic image is determined to be a second preset value, and the shading rate of the second pixel in the semantic image is 0.
6. The method according to claim 5, characterized in that Assigning identification numbers to the W first-category models specifically includes: Assign identification numbers that are not equal to the second preset value to the W first-category models.
7. The method according to claim 6, characterized in that Using the colored pixels corresponding to the i-th first type model, the color values of the hole pixels corresponding to the i-th first type model are updated to obtain the image to be sharpened, specifically including: Acquire pixels with a filling mark of 1 in the to-be-filled image as first hole pixels in a preset order; Determine a third pixel that is adjacent to the first hole pixel and meets a preset condition; the meeting the preset condition includes: a filling flag of the third pixel is 0, and a rendering mode flag of the third pixel is the same as a rendering mode flag of the first hole pixel; The color value of the first hole pixel is updated to the color value of the third pixel.
8. The method according to claim 6 or 7, characterized in that: Determining the color value of the first pixel based on the shading rate of the i-th first-type model and the color values of K pixels around the first pixel specifically includes: Acquire color values of eight pixels adjacent to the first pixel; the color value of the first pixel includes a green value, a red value, and a blue value; Calculate a sharpening coefficient based on the green values of the eight pixels and a shading rate of the first type of model corresponding to the first pixel; A color value of the first pixel is determined based on the sharpening factor and the color value of the first pixel.
9. The method according to claim 5, characterized in that The other rendering methods include raster rendering.
10. The method according to any one of claims 4 to 7, characterized in that: The a is 0.3, and the b is 0.
7.
11. The method according to any one of claims 7 to 10, characterized in that: The fourth pixel is in the cth row and the fth column of the target image, and the positions of pixels adjacent to the fourth pixel in the target image include: (c+1th row, fth column), (c-1th row, fth column), (cth row, f-1th column), (cth row, f+1th column), (c+1th row, f+1th column), (c-1th row, f-1th column), (c+1th row, f-1th column) and (c-1th row, f+1th column); the fourth pixel is a first hole pixel or a first pixel.
12. A terminal, characterized in that: The terminal comprises: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions so that the terminal executes the method as described in any one of claims 1 to 11.
13. A chip system, characterized in that: The chip system is applied to a terminal, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the terminal executes the method as described in any one of claims 1 to 11.
14. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on a terminal, the terminal is caused to execute the method according to any one of claims 1 to 11.
