CN111798372A - Image rendering method, device, equipment and readable medium - Google Patents
Image rendering method, device, equipment and readable medium Download PDFInfo
- Publication number
- CN111798372A CN111798372A CN202010524844.1A CN202010524844A CN111798372A CN 111798372 A CN111798372 A CN 111798372A CN 202010524844 A CN202010524844 A CN 202010524844A CN 111798372 A CN111798372 A CN 111798372A
- Authority
- CN
- China
- Prior art keywords
- rendering
- sampling
- data
- size
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformation in the plane of the image
- G06T3/40—Scaling the whole image or part thereof
- G06T3/4023—Decimation- or insertion-based scaling, e.g. pixel or line decimation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/20—Processor architectures; Processor configuration, e.g. pipelining
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/60—Memory management
Abstract
The embodiment of the invention provides an image rendering method, an image rendering device, image rendering equipment and a readable medium, wherein the method comprises the following steps: creating memory resources for storing rendering data in a memory; determining the size of an original image, and zooming the size of the original image according to a preset rasterization ratio control parameter to obtain a physical size; rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and taking the single-sampling data as target scene rendering data; and based on the target scene rendering data, restoring to a logical size according to the mapping table of the rasterization ratio control parameter, and outputting the rendering data of the logical size. By adopting the method and the device, the calculation cost required in the image rendering process can be reduced, and the image quality of the rendered image can be ensured.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image rendering method, an image rendering apparatus, an image rendering device, and a readable medium.
Background
Due to the large computational overhead involved in rendering images, technicians are working to reduce the computational overhead in rendering images.
In the related art, the original rendered image size is set, and then the original rendered image size is reduced to a target size, so that the target scene can be rendered into the rendered image of the target size. Since the target size is small compared to the original rendered image size, the computational overhead required to render a rendered image of the target size is also much reduced. And after the rendered image with the target size is obtained through rendering, amplifying the rendered image with the target size back to the rendered image with the original rendered image size for displaying.
In the above process, since the rendered image of the original rendered image size is linearly scaled, the overall resolution of the final display result is reduced, and the fineness of the display result is reduced. Therefore, a technical solution for reducing the computational overhead required in the process of rendering an image and ensuring the quality of the rendering result is needed.
Disclosure of Invention
Embodiments of the present invention provide an image rendering method, an image rendering device, an image rendering apparatus, and a storage medium, so as to reduce the computational overhead required in an image rendering process and ensure the quality of a rendering result.
In a first aspect, an embodiment of the present invention provides an image rendering method, where the method includes:
creating memory resources for storing rendering data in a memory;
carrying out linear scaling on the size of the original image to obtain a logic size;
zooming the logic size according to a preset rasterization ratio control parameter to obtain a physical size;
rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and taking the single-sampling data as target scene rendering data;
and based on the target scene rendering data, restoring to a logic size according to a mapping table of the rasterization ratio control parameter, and outputting rendering data according to the logic size.
In a second aspect, an embodiment of the present invention provides an image rendering apparatus, including:
the creating module is used for creating memory resources used for storing rendering data in the memory;
the scaling module is used for linearly scaling the original image size to obtain a logic size; zooming the logic size according to a preset rasterization ratio control parameter to obtain a physical size;
the rendering module is used for rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and taking the single-sampling data as target scene rendering data;
and the output module is used for restoring the target scene rendering data to a logic size according to the mapping table of the rasterization ratio control parameter and outputting the rendering data according to the logic size.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a processor and a memory, where the memory stores at least one instruction, at least one program, a code set, or a set of instructions, and the at least one instruction, at least one program, a code set, or a set of instructions is loaded and executed by the processor to implement the image rendering method in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable medium, on which at least one instruction, at least one program, a set of codes, or a set of instructions is stored, which is loaded and executed by a processor to implement the image rendering method in the first aspect.
By the method provided by the embodiment of the invention, the target scene can be rendered according to the preset rasterization ratio control parameter, so that the unimportant area in the rendered image can be controlled to be rendered by using less pixels by controlling the rasterization ratio control parameter, the size of the rendered image can be reduced on the whole, and the calculation cost is saved. Meanwhile, anti-aliasing processing is performed in the process of rendering the target scene, so that the sawtooth texture in the rendered image is not obvious any more, and the image quality of the rendered image can be improved. Meanwhile, due to the fact that resources consumed in the anti-aliasing processing process are large, the size of an original image is reduced through linear scaling firstly and then through rasterization mapping, and after the two reductions are accumulated, the resources required to be consumed in the anti-aliasing processing process based on the reduced image size can be greatly reduced. Therefore, the invention can reduce the calculation cost required in the process of rendering the image and ensure the image quality of the rendered image.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a schematic flowchart of an image rendering method according to an embodiment of the present invention;
fig. 2 is a schematic diagram illustrating an enlarged rendered image according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an image rendering apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and "a plurality" typically includes at least two.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
In addition, the sequence of steps in each method embodiment described below is only an example and is not strictly limited.
Fig. 1 is a flowchart of an image rendering method according to an embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
101. memory resources for storing rendering data are created in the memory.
102. Carrying out linear scaling on the size of an original image to obtain a logic size; and scaling the logic size according to a preset rasterization ratio control parameter to obtain a physical size.
103. Rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and taking the single-sampling data as target scene rendering data.
104. And based on the target scene rendering data, restoring to a logic size according to a mapping table of the rasterization ratio control parameter, and outputting the rendering data according to the logic size.
The memory resources created in the memory may be used to store some parameters used in the process of rendering the image, intermediate data generated in the rendering process, a final rendering result, and the like.
The above parameter may be, for example, the original rendered image size, which may include OriginW and OriginH. The size of the original rendered image may be the size of an image to be displayed on a display, and the display may be a display on a mobile device, for example, a device equipped with an IOS (IOS is a mobile operating System developed by some equipment vendors, and the IOS is an iPhone Operation System).
Here, an example of the parameter stored in the memory resource is given, and other parameters stored in the memory resource, intermediate data generated in the rendering process, a final rendering result, and the like will be specifically described later when used, and will not be described herein again.
After the memory resources for storing rendering data are created, the target scene may be rendered. In rendering the target scene, anti-aliasing may be performed. Two parts of resources are involved in the anti-aliasing processing process, the first part of resources can be multi-sampling resources, the second part of resources can be non-multi-sampling resources, the non-multi-sampling resources can be used as target scene rendering data after anti-aliasing processing, the multi-sampling resources are intermediate data generated in the rendering process, and the non-multi-sampling resources can be determined based on the multi-sampling resources. Furthermore, it is noted that whether the resources are multisampling resources or non-multisampling resources, these resources may in turn be subdivided into color resources and depth resources. Therefore, in order to store the sampling results of different resources, a color multisampling rendering target resource MSColorTarget and a depth multisampling rendering target resource MSDepthTarget may be created in the memory; a non-multisampled color rendering target resource ColorTarget and a non-multisampled depth rendering target resource DepthTarget may also be created in memory.
During the anti-aliasing process, each sub-sample point may be individually colored. And calculating coverage information (coverage) and occlusion information (occlusion) for each sub-sampling point, writing the color value of the pixel into each sub-sampling point through the coverage information and the occlusion information, and finally performing down-sampling to generate a target image through a reconstruction filter according to the color value in the sub-sampling point. Each sub-pixel has its own color and depth template information, and each sub-sample point can go through depth and template tests to decide whether to finally write the color of the pixel to the position of the sub-sample point.
The overlay information is determined by determining whether a pattern overlaps a specified sample point. In the graphics card, the overlay is determined by testing whether a sample point is overlaid by the rasterized fragment. The occlusion information indicates whether a pixel covered by a graphic is covered by other pixels, which can be implemented by a depth test of zbuffer.
Since the multi-sampling resource is intermediate data generated in the rendering process, the MTLStorageMode parameter corresponding to the MSColorTarget and the MSDepthTarget may be set to memoryless. In addition, the number of sampling points may be set to n. In one possible application scenario, n may be equal to 2 or 4. The specific value of n may be set according to actual requirements, and the embodiment of the present invention is not limited.
Alternatively, the original rendered image size may be preset, and then the logical rendered image size may be determined based on the original rendered image size, where the logical rendered image size is smaller than the original rendered image size, so that the linear scaling process may be completed.
In practical application, because resources consumed in the anti-aliasing process are large, after the size of an original rendering image is reduced to the size of a logic rendering image, the resources required to be consumed in the anti-aliasing process based on the size of the logic rendering image are greatly reduced, so that the size of the original rendering image can be reduced to the size of the logic rendering image, and then the anti-aliasing process is performed based on the size of the logic rendering image.
In one possible application scenario, assuming the original rendered image sizes are OriginW and OriginH and the logical rendered image sizes are LogicW and LogicH, then LogicW may be set to 0.75 × OriginW and LogicH to 0.75 × OriginH.
After the logical rendering image size is determined, the physical rendering image size may be determined by a Rasterization Rate Map (RRM) technique according to the logical rendering image size. The rasterization ratio mapping technology is a method for reducing the sampling rate, and can reduce the number of pixels used actually by specifying the rasterization ratio, thereby achieving the purpose of rendering and reducing the sampling. The physically rendered image sizes may be expressed as PhysicalW and PhysicalH. The rasterization ratio mapping is a process of finally converting geometric data into pixels after a series of transformation so as to be presented on a display device, and the essence of the rasterization ratio mapping is coordinate transformation and geometric discretization.
Accordingly, the color multisampling rendering target resource MSColorTarget and the depth multisampling rendering target resource MSDepthTarget also have a certain size, and the size thereof may be the same as the physical w and the physical h, and thus, in creating the color multisampling rendering target resource MSColorTarget and the depth multisampling rendering target resource MSDepthTarget in the memory, the physical w may be used as the width and the physical h may be used as the height.
The non-multisampling color rendering target resource ColorTarget and the non-multisampling depth rendering target resource DepthTarget have a certain size, and the size of the non-multisampling color rendering target resource ColorTarget and the non-multisampling depth rendering target resource DepthTarget can be the same as that of the physical w and the physical h, so that the non-multisampling color rendering target resource ColorTarget and the non-multisampling depth rendering target resource DepthTarget can be created with the physical w as the width and the physical h as the height in the process of creating the non-multisampling color rendering target resource ColorTarget and the non-multisampling depth rendering target resource DepthTarget in the memory.
In the process of rendering the target scene, the multi-sampling color multi-sampling rendering result may be stored into the created MSColorTarget, and the depth multi-sampling rendering result may be stored into the created MSDepthTarget.
Meanwhile, the size of the rendering window may also be set to the logical rendering image size. The StoreAction attribute corresponding to the non-multisampling color rendering target resource ColorTarget and the non-multisampling depth rendering target resource deptthtarget may be set to MultisampleResolve. The ResolveTexture parameter corresponding to the color multisampling rendering target resource MSColorTarget may be set to ColorTarget, and the ResolveTexture parameter corresponding to the depth multisampling rendering target resource MSDepthTarget may be set to DepthTarget. Wherein, by setting the ResolveTexture parameter, the storage space of the non-multisampled rendering result can be specified.
Based on this, after it is specified by setting the ResolveTexture parameter that the non-multisampled color rendering result and the non-multisampled depth rendering result are sequentially stored to the non-multisampled color rendering target resource ColorTarget and the non-multisampled depth rendering target resource DepthTarget, the color rendering data of the antialiasing processed target scene and the depth rendering data of the target scene may be read from the non-multisampled color rendering target resource ColorTarget and the non-multisampled depth rendering target resource DepthTarget, respectively.
In the process of rendering a target scene, the size of an original image can be linearly scaled to obtain a logical size; and scaling the logic size according to a preset rasterization ratio control parameter to obtain a physical size. Wherein the rasterization ratio control parameters may include a preset number of rasterization ratio control points in a horizontal direction and a preset number of rasterization ratio control points in a vertical direction.
For example, assuming that the number of the rasterization ratio control points is 5, the rasterization ratio control parameters may include 5 rasterization ratio control points in the horizontal direction and 5 rasterization ratio control points in the vertical direction. In a possible implementation manner, the 5 rasterization ratio control points in the horizontal direction may be {0.3, 0.6, 1.0, 0.6, 0.3}, for example, and the values of the 5 rasterization ratio control points in the horizontal direction may be represented by an array, which may be denoted as ControlSet. The values of the 5 rasterization ratio control points in the vertical direction may also use the value of ControlSet.
Optionally, before rendering the target scene, an mtlrasterizeratitmap variable may be created according to the logical rendering image size and ControlSet, and then a rasterizationRateMap parameter in the MTLRenderPassDescriptor may be set to rateMap.
The aforementioned anti-aliasing target scene rendering data may include non-multisampled color rendering target resources and non-multisampled depth rendering target resources, based on which, in summary, a rectangle may be drawn having a width equal to the width of the logical rendering image and a height higher than the logical rendering image; for any pixel in the rectangle, acquiring the position of the any pixel in a screen space; determining the physical coordinates of any pixel through a map _ screen _ to _ physical _ coordinates interface function based on the position of any pixel in a screen space; and respectively sampling the non-multi-sampling color rendering target resource and the non-multi-sampling depth rendering target resource through the physical coordinate of any pixel, and respectively determining the sampling result as the color value and the depth value of any pixel.
In practical applications, after the antialiased target scene rendering data is obtained, they may be converted into a rendered image that can be presented on a display. Specifically, a Draw Call command may be called, where the Draw Call is a Graphics programming interface called by a Graphics Processing Unit (GPU) for commanding the GPU to perform a rendering operation. And establishing the MainColorTarget according to the width and the height of the logic size, and adopting the MainColorTarget established in the memory as a memory resource for storing pixel color values and adopting the MainDepthTarget as a memory resource for storing pixel depth values through a Draw Call command.
During the rendering operation, a RecTangle with a width of LogicW and a height of LogicH can be drawn, and the RecTangle is marked as RecTangle 1. During the operation of the Draw Call command, the data in the ColorTarget, the deptttarget and the rateMapDataBuffer can be read and read, and the data of the three resources are transmitted to the GPU. The data type of rateMap data buffer is id < MTLBuffer >, and parameter data in rateMap can be copied to rateMap data buffer.
The rectangle includes a plurality of pixels, and for any one of the pixels P, the position of the pixel P in the screen space can be represented as LogicPos. In the Metal coloring language, a map _ screen _ to _ physical _ coordinates interface function of ratemap data buffer is used, and LogicPos is used as a function input to obtain the physical coordinates of the pixel P, which are marked as PhysicPos. The Metal coloring language is a hardware acceleration application program interface which has both graphic and computing functions, faces to a bottom layer and has low overhead. After obtaining the physical coordinates of the pixel P, physical pos may be used as coordinates to respectively sample the non-multi-sampled color rendering target resource and the non-multi-sampled depth rendering target resource, and the sampling results are respectively determined as the color value and the depth value of any pixel.
The above describes a process of determining a color value and a depth value of any pixel, and in the same manner, a Metal rendering language is used to determine color values and depth values of all pixels included in a rectangle, the color values of all pixels included in the rectangle may be stored in a MainColorTarget, and the depth values of all pixels included in the rectangle may be stored in a maindeptttarget.
After the above process is performed, a color value and a depth value may be obtained. The color values and the depth values can be continuously used for subsequent rendering processes, and the color values and the depth values can also be used as texture resources for reading and using the subsequent rendering processes. After the rendering operation is completed, the MainColorTarget may store a rendered image of a logical size, which may be enlarged to an original size and then displayed on a display as shown in fig. 2.
By the method provided by the embodiment of the invention, the target scene can be rendered according to the preset rasterization ratio control parameter, so that the unimportant area in the rendered image can be controlled to be rendered by using less pixels by controlling the rasterization ratio control parameter, the size of the rendered image can be reduced on the whole, and the calculation cost is saved. Meanwhile, anti-aliasing processing is performed in the process of rendering the target scene, so that the sawtooth texture in the rendered image is not obvious any more, and the image quality of the rendered image can be improved. Meanwhile, due to the fact that resources consumed in the anti-aliasing processing process are large, the size of an original image is reduced through linear scaling firstly and then through rasterization mapping, and after the two reductions are accumulated, the resources required to be consumed in the anti-aliasing processing process based on the reduced image size can be greatly reduced. Therefore, the invention can reduce the calculation cost required in the process of rendering the image and ensure the image quality of the rendered image.
An image rendering apparatus according to one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these image rendering devices can each be configured using commercially available hardware components through the steps taught by the present solution.
Fig. 3 is a schematic structural diagram of an image rendering apparatus according to an embodiment of the present invention, and as shown in fig. 3, the apparatus includes: a creation module 11, a scaling module 12, a rendering module 13, an output module 14.
A creating module 11, configured to create, in an internal memory, an internal memory resource for storing rendering data;
a scaling module 12, configured to perform linear scaling on an original image size to obtain a logical size; zooming the logic size according to a preset rasterization ratio control parameter to obtain a physical size;
the rendering module 13 is configured to render a target scene according to the physical size, perform multisampling anti-aliasing processing on the target scene by combining a multisampling anti-aliasing technology to obtain multisampling data and single sampling data, and use the single sampling data as target scene rendering data;
and the output module 14 is configured to restore the target scene rendering data to a logical size according to a mapping table of the rasterization ratio control parameter, and output the rendering data of the logical size.
Optionally, the scaling module 12 is configured to:
carrying out linear scaling on the size of the original image to obtain a logic size;
and scaling the logic size according to a preset rasterization ratio control parameter to obtain a physical size.
Optionally, the creating module 11 is configured to:
creating a color multisampling rendering target resource and a depth multisampling rendering target resource in an internal memory;
creating non-multi-sampled color rendering target resources and non-multi-sampled depth rendering target resources in the memory;
the rendering module 13 is configured to:
rendering a target scene according to a preset rasterization ratio control parameter, and performing anti-aliasing processing in the process of rendering the target scene;
storing rendered color multisampling rendering data into the color multisampling rendering target resource, and storing rendered depth multisampling rendering data into the depth multisampling rendering target resource;
determining color rendering data of the antialiasing processed target scene based on the color multisampling rendering data, and determining depth rendering data of the antialiasing processed target scene based on the depth multisampling rendering data;
storing the color rendering data of the antialiased target scene into the non-multisampled color rendering target resource, and storing the depth rendering data of the antialiased target scene into the non-multisampled depth rendering target resource.
Optionally, the apparatus further comprises a setting module, configured to:
setting the non-multi-sampling color rendering target resource and the StoreAction attribute corresponding to the non-multi-sampling depth rendering target resource as multisampleResolve;
setting a resolution texture parameter corresponding to the color multisampling rendering target resource MSColorTarget as the non-multisampling color rendering target resource;
setting a ResolVeTexture parameter corresponding to the depth multisampling rendering target resource MSDepthTarget as the non-multisampling depth rendering target resource.
Optionally, the preset rasterization ratio control parameters include a preset number of rasterization ratio control points in a horizontal direction and the preset number of rasterization ratio control points in a vertical direction.
Optionally, the apparatus further comprises a setting module, configured to:
creating a target variable in the memory, wherein the target variable is used for storing the preset rasterization ratio control parameter;
setting a rasterizationRateMap parameter in the MTLRenderPassDescriptor as the target variable.
Optionally, the target scene rendering data includes non-multisampled color rendering target resources and non-multisampled depth rendering target resources, the determining module is configured to:
drawing a rectangle having a width equal to the width of the physical dimension and a height equal to the height of the physical dimension;
for any pixel in the rectangle, acquiring the position of the pixel in a screen space;
determining the physical coordinate of any pixel through a preset interface function based on the position of the any pixel in a screen space;
and respectively sampling the non-multi-sampling color rendering target resource and the non-multi-sampling depth rendering target resource through the physical coordinate of any pixel, and respectively determining a sampling result as the color value and the depth value of any pixel.
Optionally, the output module 14 is configured to:
the rendered image of the original size is shown on a display.
Fig. 3 shows that the apparatus can execute the image rendering method provided in the embodiments shown in fig. 1 to fig. 2, and the detailed execution process and technical effect refer to the description in the embodiments, which is not described herein again.
In one possible design, the structure of the image rendering apparatus shown in fig. 3 may be implemented as an electronic device, as shown in fig. 4, which may include: a processor 91, and a memory 92. Wherein the memory 92 has stored thereon executable code, which when executed by the processor 91, makes the processor 91 at least implement the image rendering method as provided in the foregoing embodiments shown in fig. 1 to 2.
Optionally, the electronic device may further include a communication interface 93 for communicating with other devices.
The system, method and apparatus of the embodiments of the present invention can be implemented as pure software (e.g., a software program written in Java), as pure hardware (e.g., a dedicated ASIC chip or FPGA chip), or as a system combining software and hardware (e.g., a firmware system storing fixed code or a system with a general-purpose memory and a processor), as desired.
Another aspect of the invention is a computer-readable medium having computer-readable instructions stored thereon that, when executed, perform a method of embodiments of the invention.
While various embodiments of the present invention have been described above, the above description is intended to be illustrative, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The scope of the claimed subject matter is limited only by the attached claims.
1. An image rendering method, comprising:
creating memory resources for storing rendering data in a memory;
determining the size of an original image, and zooming the size of the original image according to a preset rasterization ratio control parameter to obtain a physical size;
rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and taking the single-sampling data as target scene rendering data;
and based on the target scene rendering data, restoring to a logic size according to a mapping table of the rasterization ratio control parameter, and outputting rendering data according to the logic size.
2. The method according to clause 1, wherein the scaling the original image size according to the preset rasterization ratio control parameter to obtain the physical size comprises:
carrying out linear scaling on the size of the original image to obtain a logic size;
and scaling the logic size according to a preset rasterization ratio control parameter to obtain a physical size.
3. The method of clause 1, wherein creating memory resources in the memory for storing rendering data comprises:
creating a color multisampling rendering target resource and a depth multisampling rendering target resource in an internal memory;
creating non-multi-sampled color rendering target resources and non-multi-sampled depth rendering target resources in the memory;
rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and including:
storing rendered color multisampling rendering data into the color multisampling rendering target resource, and storing rendered depth multisampling rendering data into the depth multisampling rendering target resource;
determining color rendering data of the antialiasing processed target scene based on the color multisampling rendering data, and determining depth rendering data of the antialiasing processed target scene based on the depth multisampling rendering data;
storing the color rendering data of the antialiased target scene into the non-multisampled color rendering target resource, and storing the depth rendering data of the antialiased target scene into the non-multisampled depth rendering target resource.
4. The method of clause 3, further comprising:
setting the non-multi-sampling color rendering target resource and the StoreAction attribute corresponding to the non-multi-sampling depth rendering target resource as multisampleResolve;
setting a ResolveTexture parameter corresponding to the color multisampling rendering target resource as the non-multisampling color rendering target resource;
and setting a ResolveTexture parameter corresponding to the depth multisampling rendering target resource as the non-multisampling depth rendering target resource.
5. The method according to clause 1, wherein the preset rasterization ratio control parameters include a preset number of rasterization ratio control points in a horizontal direction and the preset number of rasterization ratio control points in a vertical direction.
6. The method of clause 1, further comprising:
creating a target variable in the memory, wherein the target variable is used for storing the preset rasterization ratio control parameter;
setting a rasterizationRateMap parameter in the MTLRenderPassDescriptor as the target variable.
7. The method of clause 1, wherein the target scene rendering data includes non-multisampled color rendering target resources and non-multisampled depth rendering target resources, and wherein rendering the target scene according to the physical dimensions comprises:
drawing a rectangle having a width equal to the width of the physical dimension and a height equal to the height of the physical dimension;
for any pixel in the rectangle, acquiring the position of the pixel in a screen space;
determining the physical coordinate of any pixel through a preset interface function based on the position of the any pixel in a screen space;
and respectively sampling the non-multi-sampling color rendering target resource and the non-multi-sampling depth rendering target resource through the physical coordinate of any pixel, and respectively determining a sampling result as the color value and the depth value of any pixel.
8. The method of clause 7, wherein outputting rendering data according to the logical dimensions comprises:
the rendered image of the original size is shown on the display.
9. An image rendering apparatus comprising:
the creating module is used for creating memory resources used for storing rendering data in the memory;
the scaling module is used for determining the size of an original image, scaling the size of the original image according to a preset rasterization ratio control parameter to obtain a physical size;
the rendering module is used for rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and taking the single-sampling data as target scene rendering data;
and the output module is used for restoring the target scene rendering data to a logic size according to the mapping table of the rasterization ratio control parameter and outputting the rendering data according to the logic size.
10. The apparatus of clause 9, the scaling module to:
carrying out linear scaling on the size of the original image to obtain a logic size;
and scaling the logic size according to a preset rasterization ratio control parameter to obtain a physical size.
11. The apparatus of clause 9, the creation module to:
creating a color multisampling rendering target resource and a depth multisampling rendering target resource in an internal memory;
creating non-multi-sampled color rendering target resources and non-multi-sampled depth rendering target resources in the memory;
the rendering module to:
rendering a target scene according to a preset rasterization ratio control parameter, and performing anti-aliasing processing in the process of rendering the target scene;
storing rendered color multisampling rendering data into the color multisampling rendering target resource, and storing rendered depth multisampling rendering data into the depth multisampling rendering target resource;
determining color rendering data of the antialiasing processed target scene based on the color multisampling rendering data, and determining depth rendering data of the antialiasing processed target scene based on the depth multisampling rendering data;
storing the color rendering data of the antialiased target scene into the non-multisampled color rendering target resource, and storing the depth rendering data of the antialiased target scene into the non-multisampled depth rendering target resource.
12. The apparatus of clause 11, further comprising a setup module to:
setting the non-multi-sampling color rendering target resource and the StoreAction attribute corresponding to the non-multi-sampling depth rendering target resource as multisampleResolve;
setting a resolution texture parameter corresponding to the color multisampling rendering target resource MSColorTarget as the non-multisampling color rendering target resource;
setting a ResolVeTexture parameter corresponding to the depth multisampling rendering target resource MSDepthTarget as the non-multisampling depth rendering target resource.
13. The apparatus according to clause 9, wherein the preset rasterization ratio control parameters include a preset number of rasterization ratio control points in a horizontal direction and the preset number of rasterization ratio control points in a vertical direction.
14. The apparatus of clause 9, further comprising a setup module to:
creating a target variable in the memory, wherein the target variable is used for storing the preset rasterization ratio control parameter;
setting a rasterizationRateMap parameter in the MTLRenderPassDescriptor as the target variable.
15. The apparatus of clause 9, the target scene rendering data comprising non-multisampled color rendering target resources and non-multisampled depth rendering target resources, the determining module to:
drawing a rectangle having a width equal to the width of the physical dimension and a height equal to the height of the physical dimension;
for any pixel in the rectangle, acquiring the position of the pixel in a screen space;
determining the physical coordinate of any pixel through a preset interface function based on the position of the any pixel in a screen space;
and respectively sampling the non-multi-sampling color rendering target resource and the non-multi-sampling depth rendering target resource through the physical coordinate of any pixel, and respectively determining a sampling result as the color value and the depth value of any pixel.
16. The apparatus of clause 15, the output module to:
the rendered image of the original size is shown on a display.
17. An electronic device comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by the processor to implement the method according to any of clauses 1-8.
18. A computer readable medium having stored thereon at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by a processor to implement the method according to any of clauses 1-8.
Claims (10)
1. An image rendering method, comprising:
creating memory resources for storing rendering data in a memory;
determining the size of an original image, and zooming the size of the original image according to a preset rasterization ratio control parameter to obtain a physical size;
rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and taking the single-sampling data as target scene rendering data;
and based on the target scene rendering data, restoring to a logic size according to a mapping table of the rasterization ratio control parameter, and outputting rendering data according to the logic size.
2. The method of claim 1, wherein the scaling the original image size according to the preset rasterization ratio control parameter to obtain the physical size comprises:
carrying out linear scaling on the size of the original image to obtain a logic size;
and scaling the logic size according to a preset rasterization ratio control parameter to obtain a physical size.
3. The method of claim 1, wherein creating memory resources in the memory for storing rendering data comprises:
creating a color multisampling rendering target resource and a depth multisampling rendering target resource in an internal memory;
creating non-multi-sampled color rendering target resources and non-multi-sampled depth rendering target resources in the memory;
rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and including:
storing rendered color multisampling rendering data into the color multisampling rendering target resource, and storing rendered depth multisampling rendering data into the depth multisampling rendering target resource;
determining color rendering data of the antialiasing processed target scene based on the color multisampling rendering data, and determining depth rendering data of the antialiasing processed target scene based on the depth multisampling rendering data;
storing the color rendering data of the antialiased target scene into the non-multisampled color rendering target resource, and storing the depth rendering data of the antialiased target scene into the non-multisampled depth rendering target resource.
4. The method of claim 3, further comprising:
setting the non-multi-sampling color rendering target resource and the StoreAction attribute corresponding to the non-multi-sampling depth rendering target resource as multisampleResolve;
setting a ResolveTexture parameter corresponding to the color multisampling rendering target resource as the non-multisampling color rendering target resource;
and setting a ResolveTexture parameter corresponding to the depth multisampling rendering target resource as the non-multisampling depth rendering target resource.
5. The method according to claim 1, wherein the preset rasterization ratio control parameters comprise a preset number of rasterization ratio control points in a horizontal direction and the preset number of rasterization ratio control points in a vertical direction.
6. The method of claim 1, further comprising:
creating a target variable in the memory, wherein the target variable is used for storing the preset rasterization ratio control parameter;
setting a rasterizationRateMap parameter in the MTLRenderPassDescriptor as the target variable.
7. The method of claim 1, wherein the target scene rendering data comprises non-multisampled color rendering target resources and non-multisampled depth rendering target resources, and wherein rendering the target scene according to the physical dimensions comprises:
drawing a rectangle having a width equal to the width of the physical dimension and a height equal to the height of the physical dimension;
for any pixel in the rectangle, acquiring the position of the pixel in a screen space;
determining the physical coordinate of any pixel through a preset interface function based on the position of the any pixel in a screen space;
and respectively sampling the non-multi-sampling color rendering target resource and the non-multi-sampling depth rendering target resource through the physical coordinate of any pixel, and respectively determining a sampling result as the color value and the depth value of any pixel.
8. An image rendering apparatus, comprising:
the creating module is used for creating memory resources used for storing rendering data in the memory;
the scaling module is used for determining the size of an original image, scaling the size of the original image according to a preset rasterization ratio control parameter to obtain a physical size;
the rendering module is used for rendering a target scene according to the physical size, performing multi-sampling anti-aliasing processing on the target scene by combining a multi-sampling anti-aliasing technology to obtain multi-sampling data and single-sampling data, and taking the single-sampling data as target scene rendering data;
and the output module is used for restoring the target scene rendering data to a logic size according to the mapping table of the rasterization ratio control parameter and outputting the rendering data according to the logic size.
9. An electronic device comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, set of codes, or set of instructions, the at least one instruction, at least one program, set of codes, or set of instructions being loaded and executed by the processor to implement the method according to any one of claims 1-7.
10. A computer readable medium having stored thereon at least one instruction, at least one program, set of codes or set of instructions, which is loaded and executed by a processor to implement the method according to any one of claims 1 to 7.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010524844.1A CN111798372B (en) | 2020-06-10 | 2020-06-10 | Image rendering method, device, equipment and readable medium |
PCT/CN2020/112543 WO2021248705A1 (en) | 2020-06-10 | 2020-08-31 | Image rendering method and apparatus, computer program and readable medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010524844.1A CN111798372B (en) | 2020-06-10 | 2020-06-10 | Image rendering method, device, equipment and readable medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111798372A true CN111798372A (en) | 2020-10-20 |
CN111798372B CN111798372B (en) | 2021-07-13 |
Family
ID=72803176
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010524844.1A Active CN111798372B (en) | 2020-06-10 | 2020-06-10 | Image rendering method, device, equipment and readable medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111798372B (en) |
WO (1) | WO2021248705A1 (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112652025A (en) * | 2020-12-18 | 2021-04-13 | 完美世界(北京)软件科技发展有限公司 | Image rendering method and device, computer equipment and readable storage medium |
CN112700507A (en) * | 2020-12-28 | 2021-04-23 | 统信软件技术有限公司 | Picture display method, computing device and storage medium |
CN113012025A (en) * | 2021-03-23 | 2021-06-22 | 格兰菲智能科技有限公司 | Graphics processor and method of operating the same |
CN115841433A (en) * | 2023-02-20 | 2023-03-24 | 摩尔线程智能科技(北京)有限责任公司 | Grating method and device based on image blocks and image rendering method and device |
WO2023070291A1 (en) * | 2021-10-25 | 2023-05-04 | Shanghaitech University | Systems and methods for image rendering |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101620725A (en) * | 2008-07-03 | 2010-01-06 | 辉达公司 | Hybrid multisample/supersample antialiasing |
CN102722861A (en) * | 2011-05-06 | 2012-10-10 | 新奥特(北京)视频技术有限公司 | CPU-based graphic rendering engine and realization method |
CN102722902A (en) * | 2011-05-06 | 2012-10-10 | 新奥特(北京)视频技术有限公司 | Method for anti-aliasing improvement at rasterization phase in graphic rendering pipeline |
CN106296565A (en) * | 2015-06-23 | 2017-01-04 | 三星电子株式会社 | Graphic pipeline method and equipment |
US20190347757A1 (en) * | 2018-05-09 | 2019-11-14 | Arm Limited | Graphics processing |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9971551B2 (en) * | 2010-11-01 | 2018-05-15 | Electronics For Imaging, Inc. | Previsualization for large format print jobs |
US20120229460A1 (en) * | 2011-03-12 | 2012-09-13 | Sensio Technologies Inc. | Method and System for Optimizing Resource Usage in a Graphics Pipeline |
US11004178B2 (en) * | 2018-03-01 | 2021-05-11 | Nvidia Corporation | Enhancing high-resolution images with data from low-resolution images |
-
2020
- 2020-06-10 CN CN202010524844.1A patent/CN111798372B/en active Active
- 2020-08-31 WO PCT/CN2020/112543 patent/WO2021248705A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101620725A (en) * | 2008-07-03 | 2010-01-06 | 辉达公司 | Hybrid multisample/supersample antialiasing |
CN102722861A (en) * | 2011-05-06 | 2012-10-10 | 新奥特(北京)视频技术有限公司 | CPU-based graphic rendering engine and realization method |
CN102722902A (en) * | 2011-05-06 | 2012-10-10 | 新奥特(北京)视频技术有限公司 | Method for anti-aliasing improvement at rasterization phase in graphic rendering pipeline |
CN106296565A (en) * | 2015-06-23 | 2017-01-04 | 三星电子株式会社 | Graphic pipeline method and equipment |
US20190347757A1 (en) * | 2018-05-09 | 2019-11-14 | Arm Limited | Graphics processing |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112652025A (en) * | 2020-12-18 | 2021-04-13 | 完美世界(北京)软件科技发展有限公司 | Image rendering method and device, computer equipment and readable storage medium |
CN112652025B (en) * | 2020-12-18 | 2022-03-22 | 完美世界(北京)软件科技发展有限公司 | Image rendering method and device, computer equipment and readable storage medium |
CN112700507A (en) * | 2020-12-28 | 2021-04-23 | 统信软件技术有限公司 | Picture display method, computing device and storage medium |
CN113012025A (en) * | 2021-03-23 | 2021-06-22 | 格兰菲智能科技有限公司 | Graphics processor and method of operating the same |
CN113012025B (en) * | 2021-03-23 | 2023-09-05 | 格兰菲智能科技有限公司 | Graphics processor and method of operation thereof |
WO2023070291A1 (en) * | 2021-10-25 | 2023-05-04 | Shanghaitech University | Systems and methods for image rendering |
CN115841433A (en) * | 2023-02-20 | 2023-03-24 | 摩尔线程智能科技(北京)有限责任公司 | Grating method and device based on image blocks and image rendering method and device |
Also Published As
Publication number | Publication date |
---|---|
CN111798372B (en) | 2021-07-13 |
WO2021248705A1 (en) | 2021-12-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111798372B (en) | Image rendering method, device, equipment and readable medium | |
EP3559914B1 (en) | Foveated rendering in tiled architectures | |
CN111192356B (en) | Method, device, equipment and storage medium for displaying region of interest | |
EP0380459A2 (en) | Interactive computer graphics display system processing method for identifying an operator selected displayed object | |
JP2003084744A (en) | Emulator, emulation method and program for executing the method and recording medium with the program recorded thereon | |
JPWO2009090726A1 (en) | Graphic drawing apparatus and graphic drawing method | |
CN110599564A (en) | Image display method and device, computer equipment and storage medium | |
CN115439609B (en) | Three-dimensional model rendering method, system, equipment and medium based on map service | |
CN111798365B (en) | Deep antialiasing data reading method, device, equipment and storage medium | |
CN109643441B (en) | Image processing apparatus, image processing method, computer-readable storage medium, and image processing system | |
US20110122140A1 (en) | Drawing device and drawing method | |
CN110134319A (en) | A kind of image display method and apparatus based on Android system | |
JP2012108825A (en) | Information processing device, information processing method and program | |
CN109710122B (en) | Method and device for displaying information | |
JP4325812B2 (en) | Vector image drawing circuit and vector image drawing method | |
JPH09106460A (en) | Adjacent relation discriminating method for image parts | |
CN112233206B (en) | Character image generation method, device, equipment and storage medium | |
JP7471512B2 (en) | Drawing processing device, drawing processing system, drawing processing method, and drawing processing program | |
JP3129717B2 (en) | Image processing apparatus and image processing method | |
JP2787497B2 (en) | Graphic drawing method and apparatus | |
JP2010009271A (en) | Image processor | |
JPH0581948B2 (en) | ||
CN115984409A (en) | Method and device for drawing vector data of geographic information system and electronic equipment | |
CN116266340A (en) | Method, device, computer equipment and storage medium for enhanced display of graphic elements | |
CN117523067A (en) | Data rendering method, device, processor and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
EE01 | Entry into force of recordation of patent licensing contract | ||
EE01 | Entry into force of recordation of patent licensing contract |
Application publication date: 20201020 Assignee: Beijing Xuanguang Technology Co.,Ltd. Assignor: Perfect world (Beijing) software technology development Co.,Ltd. Contract record no.: X2022990000254 Denomination of invention: Image rendering method, apparatus, device and readable medium Granted publication date: 20210713 License type: Exclusive License Record date: 20220610 |