[go: up one dir, main page]

CN114638925A - A rendering method and device based on screen space - Google Patents

A rendering method and device based on screen space Download PDF

Info

Publication number
CN114638925A
CN114638925A CN202011484514.0A CN202011484514A CN114638925A CN 114638925 A CN114638925 A CN 114638925A CN 202011484514 A CN202011484514 A CN 202011484514A CN 114638925 A CN114638925 A CN 114638925A
Authority
CN
China
Prior art keywords
mode
ssao
rendering
pixel
pixel point
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.)
Pending
Application number
CN202011484514.0A
Other languages
Chinese (zh)
Inventor
陈军
朱敬芳
时绍壮
李俊涛
刘保权
王锐
白霖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Zhejiang University ZJU
Original Assignee
Huawei Technologies Co Ltd
Zhejiang University ZJU
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd, Zhejiang University ZJU filed Critical Huawei Technologies Co Ltd
Priority to CN202011484514.0A priority Critical patent/CN114638925A/en
Publication of CN114638925A publication Critical patent/CN114638925A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Image Generation (AREA)

Abstract

本申请提供了一种基于屏幕空间的渲染方法及装置,用以提升系统性能。该方法包括:获取触发指令;获取至少一帧图像的图像数据;响应于所述触发指令,以指定模式对所述图像数据进行渲染以得到至少一帧渲染后的图像,所述指定模式包括以下模式中的一种:第一模式、第二模式、和第三模式,所述第一模式为屏幕空间反射SSR模式,所述第二模式为屏幕空间环境光遮蔽SSAO模式,所述第三模式为SSR和SSAO结合模式;输出所述至少一帧渲染后的图像。

Figure 202011484514

The present application provides a screen space-based rendering method and device to improve system performance. The method includes: acquiring a trigger instruction; acquiring image data of at least one frame of image; in response to the trigger instruction, rendering the image data in a specified mode to obtain at least one frame of rendered image, and the specified mode includes the following One of the modes: a first mode, a second mode, and a third mode, the first mode is a screen space reflective SSR mode, the second mode is a screen space ambient light occlusion SSAO mode, and the third mode It is a combination mode of SSR and SSAO; the rendered image of the at least one frame is output.

Figure 202011484514

Description

一种基于屏幕空间的渲染方法及装置A rendering method and device based on screen space

技术领域technical field

本申请涉及计算机图形学技术领域,尤其涉及一种基于屏幕空间的渲染方法及装置。The present application relates to the technical field of computer graphics, and in particular, to a screen space-based rendering method and device.

背景技术Background technique

目前,在实时渲染领域中存在基于屏幕空间的一些技术,这些技术是为了提供精度较低但是可以实现实时计算的全局光照效果。例如,屏幕空间反射(screen spacereflection,SSR)是一种利用屏幕空间来进行反射光照的渲染技术;屏幕空间环境光遮蔽(screen space ambient occlusion,SSAO)是一种基于屏幕空间来进行环境光遮蔽的渲染技术。Currently, there are some technologies based on screen space in the field of real-time rendering, these technologies are to provide global illumination effects with lower precision but can realize real-time calculation. For example, screen space reflection (SSR) is a rendering technique that uses screen space for reflected lighting; screen space ambient occlusion (SSAO) is a screen space-based ambient light occlusion rendering technology.

随着电子设备系统性能的不断提升,为了得到更真实的图像显示效果,现有技术中会对图像分别进行一次SSAO渲染和SSR渲染,例如对图像先进行一次SSAO渲染,然后再基于进行了SSAO渲染的图像再进行一次SSR渲染。然而,由于需要对每帧图像进行实时渲染,如果分别采用SSAO和SSR技术依次对图像进行实时渲染,会存在消耗系统性能、增大系统功耗的缺陷。因此,现有的基于屏幕空间的渲染技术有待进一步优化。With the continuous improvement of the performance of electronic equipment systems, in order to obtain a more realistic image display effect, SSAO rendering and SSR rendering are respectively performed on the image in the prior art. For example, the image is first rendered SSAO, and then based on the SSAO rendering The rendered image undergoes another SSR rendering. However, since each frame of image needs to be rendered in real time, if SSAO and SSR technologies are used to render images in real time in sequence, there will be defects of consuming system performance and increasing system power consumption. Therefore, the existing screen space-based rendering technology needs to be further optimized.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种基于屏幕空间的渲染方法及装置,用于在对显示的图像采用SSAO和/或SSR技术进行实时渲染的场景下,优化系统性能。Embodiments of the present application provide a screen space-based rendering method and device, which are used to optimize system performance in a scenario where SSAO and/or SSR technology is used to render a displayed image in real time.

第一方面,本申请实施例提供一种基于屏幕空间的渲染方法,该方法包括:获取触发指令;获取至少一帧图像的图像数据;响应于所述触发指令,以指定模式对所述图像数据进行渲染以得到至少一帧渲染后的图像,所述指定模式包括以下模式中的一种:第一模式、第二模式、和第三模式,所述第一模式为屏幕空间反射SSR模式,所述第二模式为屏幕空间环境光遮蔽SSAO模式,所述第三模式为SSR和SSAO结合模式;输出所述至少一帧渲染后的图像。In a first aspect, an embodiment of the present application provides a screen space-based rendering method, the method includes: acquiring a trigger instruction; acquiring image data of at least one frame of image; Rendering is performed to obtain at least one frame of rendered images, the specified mode includes one of the following modes: a first mode, a second mode, and a third mode, the first mode is a screen space reflection SSR mode, so The second mode is a screen space ambient light occlusion SSAO mode, and the third mode is a combined mode of SSR and SSAO; the at least one frame of the rendered image is output.

相较于现有技术中通常对待渲染的图像数据分别进行一次SSR渲染和SSAO渲染的方式,本申请实施例提供的方法,可以对需要渲染的图像数据实现SSR和SSAO结合模式的渲染;并且,还可以响应于配置指令,确定对图像数据以SSR和/或SSAO模式进行渲染。这样,通过本申请实施例提供的方法,相比于现有技术提高了灵活性,优化了系统性能。Compared with the way of performing SSR rendering and SSAO rendering for the image data to be rendered once in the prior art, the method provided by the embodiment of the present application can realize the rendering of the combined mode of SSR and SSAO for the image data to be rendered; and, It may also be determined to render the image data in SSR and/or SSAO mode in response to the configuration instructions. In this way, compared with the prior art, the method provided by the embodiments of the present application improves flexibility and optimizes system performance.

在一种可能的设计中,所述指定模式为所述第三模式,所述图像数据包含所述至少一帧图像中多个像素点;所述以指定模式对所述图像数据进行渲染以得到至少一帧渲染后的图像,包括:在所述多个像素点中为所述多个像素点中每个像素点分别选择对应所述每个像素点的第一像素点集合;基于所述第一像素点集合进行SSR计算,得到颜色值;基于所述第一像素点集合进行SSAO计算,得到遮蔽值;根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像。In a possible design, the specified mode is the third mode, the image data includes a plurality of pixels in the at least one frame of image; the image data is rendered in the specified mode to obtain The rendered image of at least one frame includes: selecting a first pixel point set corresponding to each pixel point in the plurality of pixel points for each pixel point of the plurality of pixel points; based on the first pixel point Perform SSR calculation on a set of pixels to obtain a color value; perform SSAO calculation based on the first set of pixels to obtain an occlusion value; render each pixel according to the color value and the occlusion value to obtain at least A frame of the rendered image.

在上述设计中,通过进行SSAO计算的过程中,复用进行SSR计算过程中得到的为每个像素点选择的第一像素点集合,从而使得进行SSR计算过程中得到的每个像素点的第一像素点集合不仅可以用于继续进行SSR计算,还可以用于进行SSAO计算,因此通过该设计减少了进行SSAO计算过程中为每个像素点选择第一像素点集合的计算过程,从而减少了计算量,降低了功耗。In the above design, in the process of SSAO calculation, the first set of pixels selected for each pixel point obtained in the process of SSR calculation is multiplexed, so that the first pixel point set of each pixel point obtained in the process of SSR calculation is made. A set of pixels can be used not only for continuing SSR calculation, but also for SSAO calculation. Therefore, this design reduces the calculation process of selecting the first set of pixels for each pixel in the process of SSAO calculation, thereby reducing the need for The amount of calculation is reduced, and the power consumption is reduced.

在一种可能的设计中,所述图像数据还包含所述每个像素点的视线向量和法线;所述在所述多个像素点中为所述多个像素点中每个像素点分别选择对应所述每个像素点的第一像素点集合,包括:基于所述每个像素点的视线向量和法线确定反射光方向;在所述反射光方向上自所述多个像素点中选择所述第一像素点集合。In a possible design, the image data further includes the line-of-sight vector and the normal of each pixel point; the multiple pixel points are each pixel point of the multiple pixel points respectively Selecting a first set of pixel points corresponding to each pixel point includes: determining a reflected light direction based on a line of sight vector and a normal of each pixel point; selecting from the plurality of pixel points in the reflected light direction Select the first set of pixels.

在上述设计中,给出了为每个像素点选择第一像素点集合的实现方式,通过为每个像素点确定反射光方向,进一步在反射光方向上选择第一像素点集合,从而可以基于在反射光方向上选择的第一像素点集合得到与反射光方向相交的像素点的颜色值,进而通过每个像素点对应的与反射光方向相交的像素点实现SSR渲染。In the above design, an implementation method of selecting the first pixel point set for each pixel point is given. By determining the reflected light direction for each pixel point, and further selecting the first pixel point set in the reflected light direction, the first pixel point set can be selected based on the reflected light direction. The first set of pixels selected in the reflected light direction obtains the color value of the pixel points intersecting with the reflected light direction, and then SSR rendering is implemented through the pixels corresponding to each pixel point intersecting with the reflected light direction.

在一种可能的设计中,所述基于所述第一像素点集合进行SSAO计算,包括:以所述反射光方向为基准,选择至少一个其他环境光方向;在所述其他环境光方向上自所述多个像素点中选择至少一个第二像素点集合;基于所述第一像素点集合和所述至少一个第二像素点集合进行SSAO计算。In a possible design, the performing the SSAO calculation based on the first set of pixels includes: selecting at least one other ambient light direction based on the reflected light direction; At least one second pixel point set is selected from the plurality of pixel points; SSAO calculation is performed based on the first pixel point set and the at least one second pixel point set.

在上述设计中,基于进行SSAO计算过程中可以复用进行SSR计算过程中的得到的为每个像素点选择的第一像素点集合,并且进行SSAO计算时,可能选择至少一个环境光方向进行SSAO计算,因此可以考虑将进行SSR计算过程中采用的反射光方向作为其中一个环境光方向,并以此为基准,选择其他环境光方向,进而实现了相比于现有技术中进行SSAO计算过程中需要根据每个环境光方向分别选择第二像素点集合来说,本申请实施时,减少了在其中一个环境光方向上选择采样点集合的计算量,从而可以降低系统功耗。In the above design, based on the first pixel point set selected for each pixel point obtained in the SSR calculation process, the first pixel point set obtained in the SSR calculation process can be reused, and when the SSAO calculation is performed, at least one ambient light direction may be selected for SSAO Therefore, it can be considered that the reflected light direction used in the SSR calculation process is used as one of the ambient light directions, and based on this, other ambient light directions are selected, thereby realizing the SSAO calculation process compared with the prior art. In terms of the need to select the second pixel point set according to each ambient light direction, when the present application is implemented, the calculation amount of selecting the sampling point set in one of the ambient light directions is reduced, thereby reducing system power consumption.

在一种可能的设计中,在根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像之前,所述方法还包括:对所述颜色值和所述遮蔽值进行时域滤波。In a possible design, before rendering each pixel point according to the color value and the occlusion value to obtain at least one frame of rendered image, the method further includes: and performing time domain filtering with the masking value.

在上述设计中,相比于现有技术中,对图像数据进行SSR渲染之前需要对得到的颜色值进行一次时域滤波,并且进行SSAO渲染之前需要对得到的遮蔽值进行一次时域滤波,本申请实施例,可以对得到的颜色值和遮蔽值共同进行滤波,从而减少了时域滤波的处理过程,进而降低了系统消耗。In the above design, compared with the prior art, it is necessary to perform temporal filtering on the obtained color values before performing SSR rendering on the image data, and it is necessary to perform temporal filtering on the obtained occlusion values before performing SSAO rendering. In the embodiment of the application, the obtained color value and occlusion value can be filtered together, thereby reducing the processing process of time domain filtering, thereby reducing system consumption.

在一种可能的设计中,所述图像数据属于具有反射能力的材质,所述指定模式为所述第三模式。In a possible design, the image data belongs to a material with reflective ability, and the specified mode is the third mode.

在上述设计中,由于进行SSR渲染对于待渲染场景中的具有反射能力的材质才是有必要的,因此在以SSR和SSAO结合模式进行渲染之前,确定待渲染的图像数据为属于反射能力的材质,然后基于这一部分的图像数据进行SSR和SSAO结合模式的渲染,避免了不必要的计算量,进而降低了系统功耗,提升了系统性能。In the above design, since SSR rendering is necessary for the materials with reflective ability in the scene to be rendered, before rendering in the combined mode of SSR and SSAO, it is determined that the image data to be rendered is a material with reflective ability. , and then perform SSR and SSAO combined mode rendering based on this part of the image data, avoiding unnecessary calculations, thereby reducing system power consumption and improving system performance.

第二方面,本申请实施例还提供一种基于屏幕空间的渲染装置,该装置包括获取单元,处理单元,输出单元;其中,所述获取单元,用于获取触发指令;获取至少一帧图像的图像数据;所述处理单元,用于响应于所述触发指令,以指定模式对所述图像数据进行渲染以得到至少一帧渲染后的图像,所述指定模式包括以下模式中的一种:第一模式、第二模式、和第三模式,所述第一模式为屏幕空间反射SSR模式,所述第二模式为屏幕空间环境光遮蔽SSAO模式,所述第三模式为SSR和SSAO结合模式;所述输出单元,用于输出所述至少一帧渲染后的图像。In a second aspect, an embodiment of the present application further provides a screen space-based rendering device, the device includes an acquisition unit, a processing unit, and an output unit; wherein, the acquisition unit is used to acquire a trigger instruction; image data; the processing unit, configured to render the image data in a specified mode in response to the trigger instruction to obtain at least one frame of rendered image, where the specified mode includes one of the following modes: A mode, a second mode, and a third mode, the first mode is a screen space reflective SSR mode, the second mode is a screen space ambient light occlusion SSAO mode, and the third mode is a combined SSR and SSAO mode; The output unit is configured to output the at least one frame of the rendered image.

在一种可能的设计中,所述指定模式为所述第三模式,所述图像数据包含所述至少一帧图像中多个像素点;所述处理单元,具体用于:在所述多个像素点中为所述多个像素点中每个像素点分别选择对应所述每个像素点的第一像素点集合;基于所述第一像素点集合进行SSR计算,得到颜色值;基于所述第一像素点集合进行SSAO计算,得到遮蔽值;根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像。In a possible design, the specified mode is the third mode, and the image data includes multiple pixels in the at least one frame of image; the processing unit is specifically configured to: In the pixel points, a first pixel point set corresponding to each pixel point is respectively selected for each pixel point in the plurality of pixel points; SSR calculation is performed based on the first pixel point set to obtain a color value; SSAO calculation is performed on the first pixel point set to obtain an occlusion value; and each pixel point is rendered according to the color value and the occlusion value to obtain at least one frame of rendered image.

在一种可能的设计中,所述图像数据还包含所述每个像素点的视线向量和法线;所述处理单元,具体用于:基于所述每个像素点的视线向量和法线确定反射光方向;在所述反射光方向上自所述多个像素点中选择所述第一像素点集合。In a possible design, the image data further includes the line of sight vector and normal of each pixel; the processing unit is specifically configured to: determine based on the line of sight vector and normal of each pixel Reflecting light direction; selecting the first pixel point set from the plurality of pixel points in the reflected light direction.

在一种可能的设计中,所述处理单元,具体用于:以所述反射光方向为基准,选择至少一个其他环境光方向;在所述其他环境光方向上自所述多个像素点中选择至少一个第二像素点集合;基于所述第一像素点集合和所述至少一个第二像素点集合进行SSAO计算。In a possible design, the processing unit is specifically configured to: select at least one other ambient light direction based on the reflected light direction; select at least one other ambient light direction from among the plurality of pixels in the other ambient light direction Selecting at least one second pixel point set; and performing SSAO calculation based on the first pixel point set and the at least one second pixel point set.

在一种可能的设计中,所述处理单元,还用于在根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像之前,对所述颜色值和所述遮蔽值进行时域滤波。In a possible design, the processing unit is further configured to, before rendering each pixel point according to the color value and the occlusion value to obtain at least one frame of rendered image, The color values and the occlusion values are temporally filtered.

在一种可能的设计中,所述图像数据属于具有反射能力的材质,所述指定模式为所述第三模式。In a possible design, the image data belongs to a material with reflective ability, and the specified mode is the third mode.

第三方面,本申请实施例还提供了一种计算设备,所述计算设备包括处理器和存储器,所述存储器与所述处理器耦合,可选的还包括显示屏。所述处理器执行所述存储器中的程序指令以执行上述第一方面或第一方面任一可能的设计提供的方法。所述显示屏用于在所述处理器的触发下向用户显示信息。In a third aspect, an embodiment of the present application further provides a computing device, where the computing device includes a processor and a memory, the memory is coupled to the processor, and optionally further includes a display screen. The processor executes the program instructions in the memory to perform the method provided by the first aspect or any possible design of the first aspect. The display screen is used for displaying information to the user under the triggering of the processor.

第四方面,本申请提供了一种计算设备集群,该计算设备集群包括至少一个如第三方面所提供的计算设备。In a fourth aspect, the present application provides a computing device cluster, where the computing device cluster includes at least one computing device as provided in the third aspect.

第五方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质用于存储计算机指令,当所述计算机指令在计算机上运行时,使得所述计算机执行上述第一方面或任意一种可能的设计所述的方法。In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium is used to store computer instructions, and when the computer instructions are executed on a computer, the computer is made to execute the above-mentioned first aspect or any of the possible designs described.

第六方面,本申请实施例提供一种计算机程序产品,所述计算机程序产品用于存储计算机指令,当所述计算机指令在计算机上运行时,使得所述计算机执行上述第一方面或任意一种可能的设计所述的方法。In a sixth aspect, an embodiment of the present application provides a computer program product, where the computer program product is used to store computer instructions, and when the computer instructions are executed on a computer, the computer can execute the first aspect or any one of the above possible designs of the method described.

第七方面,本申请实施例提供一种芯片系统,该芯片系统包括处理器,还可以包括存储器,用于实现第一方面或任意一种可能的设计所述的方法。该芯片系统可以由芯片构成,也可以包含芯片和其他分立器件。In a seventh aspect, an embodiment of the present application provides a chip system, where the chip system includes a processor, and may further include a memory, for implementing the method described in the first aspect or any possible design. The chip system can be composed of chips, and can also include chips and other discrete devices.

上述第二方面至第七方面及其实现方式的有益效果可以参考对第一方面的方法及其实现方式的有益效果的描述。For the beneficial effects of the second to seventh aspects and implementations thereof, reference may be made to the description of the method of the first aspect and the beneficial effects of the implementations thereof.

附图说明Description of drawings

图1为本申请实施例提供的一种计算机系统的结构示意图;1 is a schematic structural diagram of a computer system according to an embodiment of the present application;

图2a为本申请实施例提供的一种基于屏幕空间的渲染方法的流程示意图;2a is a schematic flowchart of a screen space-based rendering method provided by an embodiment of the present application;

图2b为本申请实施例提供的一种基于屏幕空间的渲染方法的另一流程示意图;2b is another schematic flowchart of a screen space-based rendering method provided by an embodiment of the present application;

图3a为本申请实施例提供的用于介绍反射原理的示意图;FIG. 3a is a schematic diagram for introducing the reflection principle provided by an embodiment of the present application;

图3b为本申请实施例提供的一种计算反射交点的示意图;FIG. 3b is a schematic diagram of calculating a reflection intersection according to an embodiment of the present application;

图4a为本申请实施例提供的选择环境光方向的示意图;4a is a schematic diagram of selecting an ambient light direction according to an embodiment of the present application;

图4b为本申请实施例提供的一种计算遮蔽值的示意图;FIG. 4b is a schematic diagram of calculating an occlusion value according to an embodiment of the present application;

图5a为本申请实施例提供的进行SSR渲染之后的一个示例图;FIG. 5a is an example diagram after SSR rendering provided by an embodiment of the present application;

图5b为本申请实施例提供的进行SSAO渲染之后的一个示例图;FIG. 5b is an example diagram after SSAO rendering provided by an embodiment of the present application;

图6为本申请实施例提供的一种电子设备的结构图;FIG. 6 is a structural diagram of an electronic device provided by an embodiment of the present application;

图7为本申请实施例提供的一种基于屏幕空间的渲染装置的结构示意图。FIG. 7 is a schematic structural diagram of a screen space-based rendering apparatus according to an embodiment of the present application.

具体实施方式Detailed ways

为了使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施例作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.

下面介绍本申请的一种可能的应用场景。A possible application scenario of the present application is described below.

参阅图1,为本申请实施例提供的一种计算机系统的结构示意图,适用于计算机图形学领域,计算机系统中至少包含中央处理器(central processing unit,CPU)、图形处理器(graphics processing unit,GPU)与显示设备,通过CPU、GPU与显示设备之间的协同工作,来实现通过计算机绘制图像并在显示设备上进行显示。其中,Referring to FIG. 1, which is a schematic structural diagram of a computer system according to an embodiment of the present application, applicable to the field of computer graphics, the computer system at least includes a central processing unit (CPU) and a graphics processing unit (graphics processing unit, GPU) and the display device, through the cooperative work between the CPU, the GPU and the display device, to realize the drawing of the image by the computer and display on the display device. in,

CPU用于进行三维(three-dimensional,3D)建模,进而得到3D场景。例如,常见的3D场景有游戏场景等。The CPU is used to perform three-dimensional (3D) modeling, thereby obtaining a 3D scene. For example, common 3D scenes include game scenes and the like.

GPU用于对CPU得到的3D场景进行渲染,从而得到可以在显示设备上输出的图像数据,也可以理解为屏幕空间中的图像数据。通过GPU的渲染还可以得到对3D场景更加真实的显示效果,例如,背景技术中涉及到的SSR渲染用于在3D场景中增加反射效果,提升了3D场景的色彩感;SSAO渲染用于在3D场景中增加环境光遮蔽效果,提高了3D场景的层次感。The GPU is used to render the 3D scene obtained by the CPU, thereby obtaining image data that can be output on the display device, which can also be understood as image data in the screen space. A more realistic display effect of 3D scenes can also be obtained through GPU rendering. For example, the SSR rendering involved in the background art is used to increase the reflection effect in the 3D scene, which improves the color sense of the 3D scene; SSAO rendering is used for the 3D scene. The ambient light occlusion effect is added to the scene, which improves the layering of the 3D scene.

显示设备用于对GPU进行渲染之后的3D场景进行显示。The display device is used to display the 3D scene after rendering on the GPU.

基于背景技术中的描述,目前对待渲染场景的图像数据进行SSR渲染和SSAO渲染一般基于多通道渲染技术,即在一个渲染通道(PASS)进行SSAO计算,在另一个PASS中进行SSR计算;然后,分别对两个PASS的计算结果进行时域滤波之后,对待渲染场景的图像进行两次渲染;最后得到渲染之后的效果图。并且,由于SSAO渲染和SSR渲染为基于屏幕空间的后处理效果,为了实现SSAO渲染和SSR渲染,在每个PASS中都会进行一次将待渲染场景中的采样点转换为屏幕空间中的像素点、根据待渲染场景的深度贴图得到像素点在屏幕空间中的深度值、获取像素点的法线信息等的处理。然而,对待渲染场景的图像分别进行SSAO渲染和SSR渲染,存在计算量大的缺点,从而会导致消耗系统性能、增大系统功耗,进而导致用户体验差的问题。Based on the description in the background art, currently, SSR rendering and SSAO rendering of the image data of the scene to be rendered are generally based on multi-pass rendering technology, that is, SSAO calculation is performed in one rendering pass (PASS), and SSR calculation is performed in another PASS; then, After performing temporal filtering on the calculation results of the two PASS respectively, the image of the scene to be rendered is rendered twice; finally, the rendered rendering is obtained. Moreover, since SSAO rendering and SSR rendering are post-processing effects based on screen space, in order to achieve SSAO rendering and SSR rendering, in each PASS, the sampling points in the scene to be rendered are converted into pixels in the screen space, The processing of obtaining the depth value of the pixel in the screen space, obtaining the normal information of the pixel, etc. according to the depth map of the scene to be rendered. However, separately performing SSAO rendering and SSR rendering on the images of the scene to be rendered has the disadvantage of a large amount of computation, which will consume system performance, increase system power consumption, and lead to poor user experience.

有鉴于此,本申请提供了一种基于屏幕空间的渲染方法,提供了可以从SSAO模式渲染、SSR模式渲染或者考虑对SSAO渲染和SSR渲染过程进行合并处理,在一个PASS中实现SSAO和SSR结合模式的渲染中选择一种模式进行渲染,使得渲染技术有了更多的可选方案,相比于现有技术提高了灵活性,优化了系统性能。以下通过多个实施例对本申请提供的一种基于屏幕空间的渲染方法的实现过程进行介绍。In view of this, the present application provides a rendering method based on screen space, which can be rendered from SSAO mode, SSR mode rendering, or consider combining SSAO rendering and SSR rendering process, and realize the combination of SSAO and SSR in one PASS. Selecting a mode for rendering in the mode rendering enables the rendering technology to have more options, which improves flexibility and optimizes system performance compared with the prior art. The following describes an implementation process of a screen space-based rendering method provided by the present application through multiple embodiments.

下述本申请实施例中“多个”是指两个或两个以上,本申请实施例中也可以将“多个”理解为“至少两个”。“至少一个”,可理解为一个或多个,例如理解为一个、两个或更多个。例如,包括至少一个,是指包括一个、两个或更多个,而且不限制包括的是哪几个,例如,包括A、B和C中的至少一个,那么包括的可以是A、B、C、A和B、A和C、B和C、或A和B和C。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,字符“/”,如无特殊说明,一般表示前后关联对象是一种“或”的关系。除非有相反的说明,本申请实施例提及“第一”、“第二”等序数词用于对多个对象进行区分,不用于限定多个对象的顺序、时序、优先级或者重要程度。In the following embodiments of the present application, "plurality" refers to two or more than two, and in the embodiments of the present application, "plurality" may also be understood as "at least two". "At least one" can be understood as one or more, such as one, two or more. For example, including at least one refers to including one, two or more, and does not limit which ones are included. For example, including at least one of A, B, and C, then including A, B, C, A and B, A and C, B and C, or A and B and C. "And/or", which describes the association relationship of the associated objects, means that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone. In addition, the character "/", unless otherwise specified, generally indicates that the related objects are an "or" relationship. Unless stated to the contrary, ordinal numbers such as "first" and "second" mentioned in the embodiments of the present application are used to distinguish multiple objects, and are not used to limit the order, sequence, priority, or importance of multiple objects.

为了更清楚地理解以下实施例介绍的内容,对后续可能涉及的术语、名词进行说明,包括:In order to more clearly understand the contents introduced in the following embodiments, the terms and nouns that may be involved in the following are described, including:

1)屏幕空间,通常是一个二维空间,是对在三维的物体空间中建立的3D场景进行多次坐标转换之后得到的对3D场景的二维表示,进而实现在显示设备上显示为二维图像。其中,将建立的3D场景从物体空间进行多次坐标转换得到屏幕空间的图像数据的实现方式可以参阅现有技术的实现方式,本申请提供的方法是基于得到的屏幕空间的图像数据的后处理方式,因此本申请对坐标转换不再详述。1) The screen space, usually a two-dimensional space, is a two-dimensional representation of the 3D scene obtained by performing multiple coordinate transformations on the 3D scene established in the three-dimensional object space, thereby realizing the display on the display device as two-dimensional. image. Wherein, the implementation method of performing multiple coordinate transformations of the created 3D scene from the object space to obtain the image data in the screen space can refer to the implementation methods in the prior art, and the method provided by the present application is based on the post-processing of the obtained image data in the screen space. Therefore, the present application will not describe the coordinate transformation in detail.

其中,屏幕空间的图像数据是由多个像素点为单位构成的,并且在帧缓冲(G-buffer)中存储有每个像素点对应的视线向量、颜色值、法线、深度值等信息。基于屏幕空间进行渲染的过程中,首先获取待渲染场景在屏幕空间中至少一帧图像的图像数据,对一帧图像数据中包含的多个像素点进行渲染时,可以结合屏幕空间中该像素点周围的其他像素点实现,从而方便地实现渲染,例如,SSR渲染、SSAO渲染均是基于屏幕空间实现渲染的技术。Among them, the image data in the screen space is composed of multiple pixel points, and the frame buffer (G-buffer) stores the line of sight vector, color value, normal, depth value and other information corresponding to each pixel point. In the process of rendering based on screen space, first obtain image data of at least one frame of image of the scene to be rendered in screen space, and when rendering multiple pixels included in one frame of image data, you can combine the pixels in screen space Other surrounding pixels are implemented to facilitate rendering. For example, SSR rendering and SSAO rendering are technologies that implement rendering based on screen space.

参阅图2a所示,为本申请实施例提供的一种屏幕空间中的渲染方法的流程示意图,包括:步骤S201:获取触发指令。其中,触发指令用于确定进行渲染的模式。一种可选的示例,触发指令由电子设备基于芯片的处理能力生成的,例如,若芯片的处理能力较强,则生成的触发指令用于确定对图像数据进行第三模式的渲染,即实现以SSR和SSAO结合模式进行渲染;若芯片的处理能力较弱,则生成的触发指令用于确定对图像数据进行SSR渲染或者SSAO渲染。或者,另一种可选的示例,触发指令也可以是根据用户的配置生成的,例如,若用户想要得到更真实的游戏画面,选择了高渲染的模式,则对应生成的触发指令用于确定对图像数据进行第三模式的渲染;若用户对于渲染模式的需求一般,但更加关心系统功耗,选择了第一模式或者第二模式的渲染,则对应生成的触发指令用于确定对图像数据进行SSR渲染或者是SSAO渲染。Referring to FIG. 2a , a schematic flowchart of a rendering method in a screen space provided by an embodiment of the present application includes: Step S201 : obtaining a trigger instruction. Among them, the trigger instruction is used to determine the mode of rendering. An optional example, the trigger instruction is generated by the electronic device based on the processing capability of the chip. For example, if the processing capability of the chip is relatively strong, the generated trigger instruction is used to determine the rendering of the image data in the third mode, that is, to achieve Rendering is performed in the combined mode of SSR and SSAO; if the processing capability of the chip is weak, the generated trigger instruction is used to determine whether to perform SSR rendering or SSAO rendering on the image data. Or, in another optional example, the trigger instruction can also be generated according to the user's configuration. For example, if the user wants to get a more realistic game screen and selects the high-rendering mode, the corresponding generated trigger instruction is used for Determine the rendering of the image data in the third mode; if the user has a general demand for the rendering mode, but is more concerned about the system power consumption, and selects the rendering in the first mode or the second mode, the corresponding generated trigger command is used to determine the image data. The data is rendered by SSR or SSAO.

步骤S202:获取待渲染场景在屏幕空间中的至少一帧图像的图像数据。示例性的,假设待渲染场景为游戏场景,在进行游戏过程中,需要对组成游戏动态画面的多帧图像进行实时渲染,并且,基于前述内容的介绍可以得到SSR渲染和SSAO渲染为基于屏幕空间的后处理效果,因此为了实现对待渲染场景的渲染,获取待渲染场景在屏幕空间中的至少一帧图像的图像数据。具体实施为,从G-buffer中读取需要的图像数据,获取的图像数据是未进行SSR和/或SSAO渲染的图像数据。Step S202: Acquire image data of at least one frame of images of the scene to be rendered in the screen space. Exemplarily, assuming that the scene to be rendered is a game scene, in the process of playing the game, it is necessary to perform real-time rendering on the multi-frame images that constitute the dynamic picture of the game, and based on the introduction of the foregoing content, it can be obtained that SSR rendering and SSAO rendering are based on screen space. Therefore, in order to realize the rendering of the scene to be rendered, image data of at least one frame of image of the scene to be rendered in the screen space is acquired. Specifically, the required image data is read from the G-buffer, and the acquired image data is image data without SSR and/or SSAO rendering.

步骤S203:响应于所述触发指令,以指定模式对所述图像数据进行渲染以得到至少一帧渲染后的图像,所述指定模式包括以下模式中的一种:第一模式、第二模式、和第三模式,所述第一模式为屏幕空间反射SSR模式,所述第二模式为屏幕空间环境光遮蔽SSAO模式,所述第三模式为SSR和SSAO结合模式。示例性的,以指定模式基于每帧图像的图像数据对每帧图像进行渲染,得到渲染之后的每帧图像。Step S203: In response to the trigger instruction, render the image data in a specified mode to obtain at least one frame of rendered image, where the specified mode includes one of the following modes: a first mode, a second mode, and a third mode, the first mode is a screen space reflective SSR mode, the second mode is a screen space ambient light occlusion SSAO mode, and the third mode is a combined SSR and SSAO mode. Exemplarily, each frame of image is rendered in a specified mode based on image data of each frame of image, to obtain each frame of image after rendering.

步骤S204:输出所述至少一帧渲染后的图像。示例性的,在得到渲染后的图像之后,可以通过如图1所示的计算机系统中包含的显示设备读取所述渲染后的图像数据进行显示。示例性的,对至少一帧渲染后的图像进行动态播放等。Step S204: Output the at least one frame of the rendered image. Exemplarily, after the rendered image is obtained, the rendered image data may be read and displayed by the display device included in the computer system as shown in FIG. 1 . Exemplarily, at least one frame of the rendered image is dynamically played, and the like.

通过响应于触发指令,从第一模式、第二模式、第三模式中根据所述触发指令通过其中一种模式对图像数据进行渲染,从而输出渲染之后的图像。这样,可以基于对芯片性能的判断或者对于业务需求的判断等,选择合适的渲染模式对待渲染的图像数据进行渲染,优化了系统性能,进而提升用户体验。By responding to the trigger instruction, the image data is rendered in one of the first mode, the second mode, and the third mode according to the trigger instruction, thereby outputting the rendered image. In this way, an appropriate rendering mode can be selected to render the image data to be rendered based on the judgment of the chip performance or the judgment of the business requirements, which optimizes the system performance and further improves the user experience.

为了更好的理解本申请实施例提供的以SSR和SSAO结合模式进行渲染的实现过程,参阅图2b,为本申请实施例提供的一种基于屏幕空间的渲染方法的另一流程示意图,本申请实施时,基于将SSR渲染和SSAO渲染合并PASS的设计思想进行渲染,例如通过图2b中的SSAO_SSR PASS实现SSR和SSAO结合模式的渲染,实现过程包括以下步骤:In order to better understand the implementation process of rendering in the combination mode of SSR and SSAO provided by the embodiment of the present application, referring to FIG. 2b, another schematic flowchart of a screen space-based rendering method provided by the embodiment of the present application, the present application During implementation, the rendering is performed based on the design idea of combining SSR rendering and SSAO rendering with PASS. For example, the rendering of the combined mode of SSR and SSAO is realized through SSAO_SSR PASS in Figure 2b. The implementation process includes the following steps:

步骤S1:获取图像数据中的多个像素点以及像素点的深度值、法线等。示例性的,本申请进行SSR和/或SSAO渲染是基于屏幕空间实现的,因此首先获取待渲染场景在屏幕空间的图像数据。具体实施为,在待渲染场景中确定转换到屏幕空间的采样点之后,将确定的采样点转换到屏幕空间中的像素点,在屏幕空间中通过二维坐标来表示像素点的显示位置,例如可以通过(x,y)表示;并且,为了表示采样点在待渲染场景中的准确位置,在屏幕空间还可以通过深度值来体现,例如可以通过z来表示。Step S1: Acquire a plurality of pixels in the image data and the depth values, normals, etc. of the pixels. Exemplarily, the SSR and/or SSAO rendering in the present application is implemented based on the screen space, so the image data of the scene to be rendered in the screen space is obtained first. Specifically, after determining the sampling points converted to the screen space in the scene to be rendered, the determined sampling points are converted to pixels in the screen space, and the display positions of the pixels are represented by two-dimensional coordinates in the screen space, for example It can be represented by (x, y); and, in order to represent the exact position of the sampling point in the scene to be rendered, it can also be represented by a depth value in the screen space, for example, it can be represented by z.

步骤S2:在图像数据包含的多个像素点中为所述多个像素点中的每个像素点分别选择对应所述每个像素点的第一像素点集合。示例性的,为每个像素点分别选择对应的第一像素点集合是在进行SSR计算过程中得到的。为了便于更好地理解SSR计算,首先结合图3a所示的内容对进行SSR计算涉及到的反射原理进行介绍,基于光线反向追踪的方式(即以眼睛作为起始点的光线追踪,光线正向追踪与光线反向追踪方向相反,是以物体为起点的光线追踪),眼睛从任意一个视线看向反射平面之后,可以在反射平面上的B点处看到视线的反射光方向上与物体相交的像素点(以下实施例中称作反射交点),例如为物体上的像素点A。通过介绍到的反射原理可以得到,在反射平面上可以看到一些由于反射光的存在而产生的反射效果,例如镜子中的成像效果、水面中的倒影等。可选的,针对图像数据中包含的每个像素点,通过以下步骤选择第一像素点集合,包括:步骤S21:基于所述每个像素点的视线向量和法线确定反射光方向。步骤S22:在所述反射光方向上自所述多个像素点中选择所述第一像素点集合。Step S2: For each pixel point in the plurality of pixel points, a first pixel point set corresponding to each pixel point is respectively selected from the plurality of pixel points included in the image data. Exemplarily, selecting the corresponding first pixel point set for each pixel point is obtained during the SSR calculation process. In order to better understand the SSR calculation, the reflection principle involved in the SSR calculation is first introduced in combination with the content shown in Figure 3a. Tracing is opposite to ray reverse tracing, which is ray tracing with the object as the starting point). After the eye looks at the reflection plane from any line of sight, it can be seen at point B on the reflection plane that the line of sight intersects the object in the direction of the reflected light. The pixel point (referred to as the reflection intersection point in the following embodiments) is, for example, the pixel point A on the object. According to the reflection principle introduced, some reflection effects due to the existence of reflected light can be seen on the reflection plane, such as the imaging effect in the mirror, the reflection in the water surface, etc. Optionally, for each pixel included in the image data, select a first set of pixels through the following steps, including: Step S21: Determine the reflected light direction based on the line of sight vector and normal of each pixel. Step S22: Selecting the first pixel point set from the plurality of pixel points in the reflected light direction.

示例性的,获取反射光转换到屏幕空间中的反射光数据,其中反射光数据包括在反射光上步进时选择的多个采样点的二维坐标和所述多个采样点的深度值;从所述像素点在屏幕的位置开始,依次在反射光方向上选择的采样点;确定图像数据中与反射光上选择的采样点具有相同的二维坐标的像素点;比较具有相同二维坐标的采样点与像素点的深度值;若像素点的深度值小于反射光上采样点的深度值,则返回依次在反射光方向上选择的采样点的步骤,直到反射光上采样点的深度值小于或等于像素点的深度值,即得到反射交点。这样,在确定反射交点过程中所涉及到的像素点,即为该像素点选择的第一像素点集合。Exemplarily, acquiring reflected light data converted from the reflected light into the screen space, where the reflected light data includes two-dimensional coordinates of multiple sampling points selected when stepping on the reflected light and depth values of the multiple sampling points; Starting from the position of the pixel point on the screen, select sampling points in the direction of the reflected light in sequence; determine the pixel points in the image data that have the same two-dimensional coordinates as the sampling point selected on the reflected light; compare the pixels with the same two-dimensional coordinates The sampling point and the depth value of the pixel point; if the depth value of the pixel point is less than the depth value of the sampling point on the reflected light, return to the steps of selecting sampling points in the direction of the reflected light in turn, until the depth value of the sampling point on the reflected light Less than or equal to the depth value of the pixel, the reflection intersection is obtained. In this way, the pixel points involved in the process of determining the reflection intersection point are the first pixel point set selected for the pixel point.

参阅图3b,举例来说,图像数据中存在待渲染的像素点L0,确定L0的反射光方向,从L0开始沿反射光方向依次选择采样点,然后在图像数据中与采样点具有相同位置的像素点,如图3b中的L1~L7,比较相同位置上的反射光上采样点与图像中像素点的深度值,像素点L1的深度值小于相同位置上反射光上采样点的深度值,则继续比较像素点L2、L3……依次类推,直到确定像素点L7的深度值等于相同位置上反射光采样点的深度值,则将像素点L7作为反射交点。其中,像素点L1~L7即为像素点L0选择的第一像素点集合。Referring to Fig. 3b, for example, there is a pixel point L0 to be rendered in the image data, the direction of the reflected light of L0 is determined, and the sampling points are selected in sequence along the reflected light direction from L0, and then the image data has the same position as the sampling point. Pixel points, such as L1-L7 in Figure 3b, compare the depth value of the up-sampling point of the reflected light at the same position with the depth value of the pixel point in the image, the depth value of the pixel point L1 is smaller than the depth value of the up-sampling point of the reflected light at the same position, Continue to compare pixel points L2, L3 . . . and so on, until it is determined that the depth value of pixel point L7 is equal to the depth value of the reflected light sampling point at the same position, then use pixel point L7 as the reflection intersection. The pixel points L1-L7 are the first pixel point set selected by the pixel point L0.

步骤S2’:基于所述第一像素点集合进行SSAO计算,确定所述第一像素点集合中深度值最大的像素点。示例性的,SSAO计算与SSR计算类似,也是以图像数据中包含的像素点为单位进行处理的,且对图像数据中包含的每个像素点进行SSAO计算过程中,需要依靠每个像素点周围的多个其他像素点作为采样点进行处理。以图像数据中的任一像素点作为示例,该像素点在显示屏幕上的明暗效果是根据该像素点周围其他深度值更高的像素点对该待渲染像素点的遮挡来决定的,可以理解为凹进去的地方的亮度值比较暗,凸起来的地方的亮度值比较亮,因此进行SSAO计算过程中,为每个像素点选择像素点集合,通过像素点集合中深度值最大的像素点计算得到该像素点的遮蔽值,然后通过遮蔽值来确定该像素点的环境光的光照强度。Step S2': Perform SSAO calculation based on the first pixel point set, and determine the pixel point with the largest depth value in the first pixel point set. Exemplarily, the SSAO calculation is similar to the SSR calculation, and is also processed in units of pixels included in the image data, and in the process of performing the SSAO calculation for each pixel included in the image data, it is necessary to rely on the surrounding area of each pixel. A number of other pixels are processed as sampling points. Taking any pixel in the image data as an example, the light and dark effect of the pixel on the display screen is determined according to the occlusion of the pixel to be rendered by other pixels with higher depth values around the pixel. It is understandable The brightness value of the concave place is relatively dark, and the brightness value of the convex place is relatively bright. Therefore, in the process of SSAO calculation, a set of pixel points is selected for each pixel point, and the pixel point with the largest depth value in the set of pixel points is calculated. The occlusion value of the pixel is obtained, and then the illumination intensity of the ambient light of the pixel is determined by the occlusion value.

具体实施为,一般情况下,为每个像素点选择像素点集合的一种可能的实施方式为,首先以每个像素点为基础点,选择多个环境光方向,其中多个环境光方向围绕该待渲染像素点平均分布,例如可以选择具有一定角度(一般为180°)的2个环境光方向、互相垂直的4个环境光方向(即每两个环境光方向之间的夹角为90°)、8个环境光方向(每两个环境光方向之间的夹角为45°)等多个环境光方向。其中,选择的环境光方向越多,则进行SSAO计算之后得到的环境光遮蔽效果越贴合真实场景,但基于系统性能和功耗方面的考虑,可以根据系统芯片的计算能力确定选择的环境光方向的数量。其次在为每个像素点选择的每个环境光方向从该像素点开始选择多个其他像素点,作为每个环境光方向上的像素点集合。其中,像素点集合中选择的像素点数量同样也可以根据系统芯片的计算能力确定,例如可以在每个环境光方向上选择4个、8个或更多数量的像素点得到像素点集合;同理,每个环境光方向上选择的像素点越多,则进行SSAO计算之后得到的环境光遮蔽效果越贴合真实场景。The specific implementation is that, in general, a possible implementation of selecting a pixel point set for each pixel point is to first select multiple ambient light directions based on each pixel point, wherein the multiple ambient light directions surround The pixels to be rendered are evenly distributed. For example, two ambient light directions with a certain angle (usually 180°) and four ambient light directions that are perpendicular to each other (that is, the angle between each two ambient light directions is 90°) can be selected. °), 8 ambient light directions (the angle between each two ambient light directions is 45°) and other ambient light directions. Among them, the more ambient light directions are selected, the more suitable the ambient light shading effect obtained after SSAO calculation is to the real scene. However, based on the consideration of system performance and power consumption, the selected ambient light can be determined according to the computing power of the system chip. the number of directions. Secondly, in each ambient light direction selected for each pixel point, multiple other pixel points are selected from the pixel point as a set of pixel points in each ambient light direction. The number of pixels selected in the pixel set can also be determined according to the computing capability of the system chip, for example, 4, 8 or more pixels can be selected in each ambient light direction to obtain the pixel set; the same Therefore, the more pixels selected in each ambient light direction, the more suitable the ambient light occlusion effect obtained after SSAO calculation is to fit the real scene.

通过上述介绍到的内容,可以得到如果采用SSR和SSAO结合模式对图像数据进行渲染,基于步骤S2中进行SSR计算过程中在每个像素点的反射光方向上选择了第一像素点集合,并且环境光具有散射的特性,故而在对每个像素点进行SSAO计算时,选择的多个环境光的条件满足均匀分布于每个像素点的四周即可。一种可选的示例,进行SSAO计算过程中可以复用进行SSR过程中选择的第一像素点集合,本申请实施时,将每个像素点的反射光方向作为第一环境光方向,并将所述第一像素点集合作为每个像素点在第一环境光方向上选择的像素点集合,例如步骤S2’直接基于步骤S2得到的像素点集合继续进行SSAO计算,从而无需像现有技术一样,在进行SSR计算过程中,选择一次像素点集合,在进行SSAO计算过程中,再选择一次像素点集合,因此通过本申请实施方式减少了SSR和SSAO计算过程中的计算量,从而降低了系统功耗。From the content introduced above, it can be obtained that if the image data is rendered in the combined mode of SSR and SSAO, the first set of pixels is selected in the reflected light direction of each pixel during the SSR calculation in step S2, and Ambient light has the characteristics of scattering, so when performing SSAO calculation for each pixel point, the conditions of the selected multiple ambient light points can be uniformly distributed around each pixel point. An optional example, the first pixel point set selected in the SSR process can be reused during the SSAO calculation process. When the application is implemented, the reflected light direction of each pixel point is used as the first ambient light direction, and the The first set of pixels is used as the set of pixels selected by each pixel in the direction of the first ambient light. For example, step S2' directly continues the SSAO calculation based on the set of pixels obtained in step S2, so that it is not necessary to perform the SSAO calculation as in the prior art. , in the process of SSR calculation, a set of pixel points is selected once, and in the process of SSAO calculation, a set of pixel points is selected again, so the calculation amount in the calculation process of SSR and SSAO is reduced by the embodiment of the present application, thereby reducing the system power consumption.

此外,由于进行SSAO计算过程中,可以选择多个环境光方向进行处理,本申请实施时,基于SSR计算得到将反射光方向第一环境光方向之后,一种可选的实施方式,还可以通过以下步骤继续进行SSAO计算,包括:步骤S2’1:以所述反射光方向为基准,选择至少一个其他环境光方向。In addition, during the SSAO calculation process, multiple ambient light directions can be selected for processing. During the implementation of this application, after the first ambient light direction of the reflected light direction is obtained based on the SSR calculation, an optional implementation can also be performed through The following steps continue to perform SSAO calculation, including: Step S2'1: Select at least one other ambient light direction based on the reflected light direction.

示例性的,参阅图4a,沿用图3a中的介绍内容,假设为像素点B选择4个环境光方向进行SSAO计算,实施时,将反射光方向作为像素点B的第一环境光方向,然后基于第一环境光方向选择第二环境光方向、第三环境光方向、第四环境光方向,其中选择的四个环境光方向在屏幕空间中可以呈两个相邻的环境光方向互相垂直的关系。Exemplarily, referring to Fig. 4a, following the introduction in Fig. 3a, it is assumed that 4 ambient light directions are selected for pixel B for SSAO calculation. During implementation, the reflected light direction is taken as the first ambient light direction of pixel B, and then The second ambient light direction, the third ambient light direction, and the fourth ambient light direction are selected based on the first ambient light direction, wherein the four selected ambient light directions may be two adjacent ambient light directions perpendicular to each other in the screen space relation.

步骤S2’2:在所述其他环境光方向上自所述多个像素点中选择至少一个第二像素点集合。示例性的,在其他环境光方向选择第二像素点的实施方式可以为,自每个像素点开始,在每个其他环境光方向上依次选择指定数量的像素点作为每个其他环境光方向上的第二像素点集合。其中,指定数量可以是预先设定的,例如选择4个、8个像素点等。Step S2'2: Select at least one second pixel point set from the plurality of pixel points in the other ambient light directions. Exemplarily, the implementation of selecting the second pixel point in other ambient light directions may be, starting from each pixel point, sequentially selecting a specified number of pixel points in each other ambient light direction as each other ambient light direction. The second set of pixels. The specified number may be preset, for example, 4 or 8 pixels are selected.

步骤S2’3:基于所述第一像素点集合和所述至少一个第二像素点集合进行SSAO计算。示例性的,在得到第一像素点集合和至少一个第二像素点集合之后,分别确定每个像素点集合中具有最大深度值的像素点。举例来说,参阅图4b,假设选择一个其他环境光方向作为第二环境光方向,针对待渲染的像素点A来说,在第一环境光方向上的第一像素点集合包括B1、B2、B3、B4,其中B4具有最大深度值;在第二环境光方向上的第二像素点集合包括C1、C2、C3、C4,其中C4具有最大深度值。Step S2'3: Perform SSAO calculation based on the first pixel point set and the at least one second pixel point set. Exemplarily, after obtaining the first pixel point set and at least one second pixel point set, the pixel point with the largest depth value in each pixel point set is respectively determined. For example, referring to FIG. 4b, assuming that another ambient light direction is selected as the second ambient light direction, for the pixel A to be rendered, the first set of pixels in the first ambient light direction includes B1, B2, B3, B4, where B4 has the maximum depth value; the second set of pixel points in the second ambient light direction includes C1, C2, C3, and C4, where C4 has the maximum depth value.

通过本申请提供基于第一像素点集合进行SSR计算和基于第一像素点集合进行SSAO计算的实施方式,实现了SSR计算和SSAO计算过程中像素点集合以及像素点信息的共享,从而在需要以SSR和SSAO结合模式进行渲染的场景下,减少了部分计算量,从而无需像现有技术一样,在进行SSR计算的过程中为每个像素点选择一个像素点集合,并获取像素点存储于G-buffer中的像素点信息,进行一次计算;在进行SSAO计算的过程中,再为每个像素点逐一在选择的每个环境光方向上选择像素点集合,并获取像素点存储于G-buffer中的像素点信息,进行多次计算。例如,假设进行SSAO计算选择2个环境光方向,现有技术中,在进行SSAO计算时需要获取两次像素点集合,且在进行SSR计算时也需要获取一次像素点集合,因此共需要进行获取三次像素点集合的处理;而通过本申请提供的方法,在进行SSR计算时获取一次像素点集合,而在进行SSAO计算时可以基于SSR计算中获取的像素点集合进行处理,因此只需要再获取一次像素点集合即可,因此本申请实施时通过获取两次像素点集合可以实现SSAO计算和SSR计算,从而减少了计算量。需要说明的是,由于图像数据中包含多个像素点,并且待渲染场景包含多帧图像的图像数据,若一个像素点可以减少一部分计算量,则在对待渲染场景包含的多帧图像进行渲染过程中,则会减少较多的计算量,从而可以降低系统功耗,提升用户体验。The present application provides an embodiment of performing SSR calculation based on the first pixel point set and performing SSAO calculation based on the first pixel point set, so as to realize the sharing of pixel point sets and pixel point information in the process of SSR calculation and SSAO calculation, so that the In the scenario where SSR and SSAO are combined for rendering, part of the calculation amount is reduced, so it is not necessary to select a set of pixels for each pixel in the process of SSR calculation as in the prior art, and obtain the pixel points and store them in G - The pixel information in the buffer is calculated once; in the process of SSAO calculation, a set of pixels is selected for each pixel in each selected ambient light direction one by one, and the obtained pixels are stored in the G-buffer The pixel information in the , and perform multiple calculations. For example, assuming that 2 ambient light directions are selected for SSAO calculation, in the prior art, the pixel point set needs to be acquired twice when SSAO calculation is performed, and the pixel point set needs to be acquired once when SSR calculation is performed, so it is necessary to obtain a total of Processing of pixel point sets three times; and through the method provided in this application, a pixel point set is obtained when performing SSR calculation, and when performing SSAO calculation, it can be processed based on the pixel point set obtained in the SSR calculation, so it is only necessary to obtain a second set of pixel points. Only one set of pixel points is required. Therefore, in the implementation of the present application, SSAO calculation and SSR calculation can be realized by acquiring the set of pixel points twice, thereby reducing the amount of calculation. It should be noted that since the image data contains multiple pixels, and the scene to be rendered contains image data of multiple frames of images, if one pixel can reduce a part of the calculation amount, the rendering process of the multiple frames of images contained in the scene to be rendered is performed. , it will reduce the amount of calculation, which can reduce the power consumption of the system and improve the user experience.

此外,通过SSAO计算复用SSR计算过程中选择的第一像素点集合,还可以达到更真实、准确的渲染效果。原因在于,若物体表面的粗糙度越大,由于在进行SSR计算过程中,在反射光方向上自每个像素点开始依次选择像素点,直到计算得到与反射光相交的像素点为止,因此在进行SSR计算过程中的像素点集合中包含的像素点数量根据待渲染场景中像素点所在物体的粗糙度决定,若粗糙度越大,则选择的像素点数量越多;在此基础上,本申请实施时,将SSR计算过程中选择的像素点集合继续用于进行SSAO计算,相比于现有技术中实现SSAO单独计算时的选择的像素点集合中包含的像素点数量可能更多。举例来说,在进行SSR计算过程中,在反射光方向上可能获取了7个像素点之后,才得到反射交点,而原本进行SSAO计算时要求在每个环境光方向上选择4个像素点作为像素点集合,因此将在反射光方向上选择的第一像素点集合作为SSAO计算过程中的第一环境光方向上的像素点集合时,进行SSAO计算的像素点集合中包含的像素点为7个,故而增大了选择的像素点数量,从而可以得到更真实的遮蔽效果,越符合真实场景。In addition, by SSAO calculation and multiplexing of the first set of pixels selected in the SSR calculation process, a more realistic and accurate rendering effect can also be achieved. The reason is that if the roughness of the surface of the object is larger, since in the process of SSR calculation, the pixels are selected sequentially from each pixel in the direction of the reflected light until the pixel that intersects with the reflected light is calculated. The number of pixels included in the pixel point set in the SSR calculation process is determined according to the roughness of the object where the pixel points are located in the scene to be rendered. When the application is implemented, the pixel point set selected in the SSR calculation process is continued to be used for SSAO calculation, which may contain more pixels than the pixel point set selected when SSAO independent calculation is implemented in the prior art. For example, in the process of SSR calculation, 7 pixels may be obtained in the direction of reflected light, and then the reflection intersection point is obtained, while the original calculation of SSAO requires that 4 pixels be selected in each ambient light direction as Pixel point set, so when the first pixel point set selected in the reflected light direction is used as the pixel point set in the first ambient light direction in the SSAO calculation process, the number of pixels included in the pixel point set for SSAO calculation is 7 Therefore, the number of selected pixels is increased, so that a more realistic shading effect can be obtained, which is more in line with the real scene.

步骤S3:获取步骤S2中得到的反射交点的颜色值。步骤S3’:基于步骤S2’中得到的具有最大深度值的像素点,计算用于SSAO的遮蔽值。其中,不限定步骤S3、S3’的执行顺序,可以是通过不同的线程并行处理的,也可以的是依照随机先后顺序执行的。Step S3: Acquire the color value of the reflection intersection obtained in Step S2. Step S3': Calculate the occlusion value for SSAO based on the pixel with the maximum depth value obtained in Step S2'. Wherein, the execution order of steps S3 and S3' is not limited, and may be processed in parallel by different threads, or may be executed in random order.

示例性的,得到为每个像素点选择的多个环境光方向上的具有最大深度值的多个像素点之后,假设以h1、h2、…、hn来表示,然后可以针对每个像素点根据h1、h2、…、hn值和法线等信息通过现有的计算用于SSAO渲染的遮蔽值公式计算得到每个像素点的遮蔽值。其中,遮蔽值用于对每个像素点显示的环境光的光照强度进行调整,遮蔽值越大,表示像素点周围的其他像素点对该像素点的遮挡能力越强,则像素点处显示的环境光的光照强度越小。Exemplarily, after obtaining multiple pixels with the maximum depth value in multiple ambient light directions selected for each pixel, it is assumed that they are represented by h1, h2, ..., hn, and then for each pixel, according to Information such as h1, h2, ..., hn values, and normals are calculated to obtain the occlusion value of each pixel through the existing occlusion value formula used for SSAO rendering. Among them, the occlusion value is used to adjust the illumination intensity of the ambient light displayed by each pixel point. The light intensity of the ambient light is smaller.

步骤S4:将遮蔽值和颜色值合并输出。一种可选的示例,基于进行SSR计算之后得到颜色值,一般可以通过三个变量来表示,例如R(红色)、G(绿色)、B(蓝色),并且一般颜色值的信息可以通过RGBA(alpha,alpha通道一般用作不透明度参数)的四通道色彩空间来承载,因此可以得到在基于颜色值对图像数据进行SSR渲染时对于A通道的利用率较低。因此本申请实施时,可以将进行SSAO计算之后得到的遮蔽值合并到用于承载进行SSR计算之后的颜色值的四通道色彩空间的A通道中。即,SSAO_SSR PASS的输出结果为包含用于进行SSR渲染的颜色值和用于进行SSAO渲染的遮蔽值的四维变量,例如,四维变量的表现形式可以为(R,G,B,O),其中,所述R,G,B分别表示颜色值,所述O表示遮蔽值。Step S4: Combine and output the occlusion value and the color value. An optional example, based on the color value obtained after the SSR calculation, can generally be represented by three variables, such as R (red), G (green), B (blue), and the general color value information can be represented by RGBA (alpha, the alpha channel is generally used as an opacity parameter) is carried in the four-channel color space, so it can be obtained that the utilization of the A channel is low when performing SSR rendering on image data based on color values. Therefore, when the present application is implemented, the occlusion value obtained after the SSAO calculation can be merged into the A channel of the four-channel color space used to carry the color value after the SSR calculation. That is, the output result of SSAO_SSR PASS is a four-dimensional variable containing the color value for SSR rendering and the occlusion value for SSAO rendering. For example, the expression form of the four-dimensional variable can be (R, G, B, O), where , the R, G, B represent the color value respectively, and the O represents the occlusion value.

通过对用于SSAO渲染的遮蔽值和用于SSR渲染的颜色值的合并输出,可以实现在显示设备上进行显示时,通过一次渲染可以得到进行了SSR和SSAO结合模式渲染的场景效果图,而无需像现有技术中一样,需要在待渲染场景上分别进行一次SSAO渲染和SSR渲染,从而通过两次渲染处理之后才得到场景效果图。By combining the output of the occlusion value used for SSAO rendering and the color value used for SSR rendering, it can be achieved that when displayed on a display device, a scene rendering with SSR and SSAO combined mode rendering can be obtained through one rendering. There is no need to separately perform SSAO rendering and SSR rendering on the scene to be rendered as in the prior art, so that the scene rendering process can be obtained only after two rendering processes.

步骤S5:将步骤S4输出的遮蔽值和颜色值作为输入,进行时域滤波。为了使得最后得到的渲染场景效果图更加平滑,现有技术中,在得到遮蔽值和颜色值之后,还需要分别对遮蔽值和颜色值各进行一次时域滤波,从而对SSAO渲染和SSR渲染得到的渲染结果进行优化。本申请实施时,基于颜色值和遮蔽值合并输出为一个四维变量,因此可以将四维变量作为输入,将其输入到用于进行时域滤波的滤波器中来实现平滑操作。因此,本申请提供的实施方式通过一次输入滤波器的操作可以实现对用于进行SSR渲染的颜色值和用于进行SSAO渲染的遮蔽值进行滤波操作,从而减少了进行时域滤波的操作次数,从而提高系统性能,减少了系统消耗,进而提高用户体验。Step S5: The occlusion value and the color value output in step S4 are used as input, and time domain filtering is performed. In order to make the final rendering scene rendering smoother, in the prior art, after obtaining the occlusion value and the color value, it is necessary to perform temporal filtering on the occlusion value and the color value respectively, so that the SSAO rendering and SSR rendering obtain Rendering results are optimized. When the application is implemented, the combined output based on the color value and the occlusion value is a four-dimensional variable, so the four-dimensional variable can be used as an input and input into a filter for temporal filtering to implement a smoothing operation. Therefore, the embodiments provided by the present application can implement the filtering operation on the color value used for SSR rendering and the occlusion value used for SSAO rendering through one input filter operation, thereby reducing the number of operations for temporal filtering. Thus, system performance is improved, system consumption is reduced, and user experience is improved.

步骤S6:输出进行SSAO和SSR渲染之后的场景效果图。示例性的,通过步骤S5得到每帧图像数据进行了时域滤波之后的SSR和SSAO的计算结果,将该计算结果叠加到原图像数据上,从而可以输出进行了SSAO和SSR渲染之后的场景效果图。Step S6: Output the scene rendering after SSAO and SSR rendering. Exemplarily, the calculation results of SSR and SSAO after each frame of image data is subjected to temporal filtering are obtained by step S5, and the calculation results are superimposed on the original image data, so that the scene effect after SSAO and SSR rendering can be output. picture.

此外,由于进行SSR渲染是针对具有反射能力的物体所包含的多个像素点来说的,因此一种可能的实施方式为,在通过SSAO_SSR PASS进行SSR和SSAO计算之前,可以根据待渲染场景中关联的各个物体的材质(其中,一些物体的材质具有反射能力,例如镜面、水面等)确定该物体转换到屏幕空间之后所对应的像素点,将属于具有发射能力的材质的图像数据作为输入的图像数据,进行SSR和SSAO结合模式的渲染。In addition, since SSR rendering is performed for multiple pixels contained in an object with reflective capability, a possible implementation is that, before performing SSR and SSAO calculations through SSAO_SSR PASS, you can The material of each associated object (the material of some objects has reflective ability, such as mirror surface, water surface, etc.) determines the corresponding pixel point after the object is converted to the screen space, and uses the image data belonging to the material with emissive ability as input. Image data for rendering in the combined mode of SSR and SSAO.

为了更好的理解进行SSR渲染和SSAO渲染之后在显示设备中显示的场景效果图,以下通过图5a、5b来分别说明进行SSR渲染和SSAO渲染之后的界面显示效果。In order to better understand the scene renderings displayed on the display device after SSR rendering and SSAO rendering, the following describes the interface display effects after SSR rendering and SSAO rendering through Figures 5a and 5b, respectively.

结合图5a来说明进行SSR渲染之后的效果,以镜子作为示例来说明,在没有进行SSR渲染之前,则只能从显示设备屏幕显示的图像中看到镜子的基本形状和颜色信息,如图5a中的1所示,在镜面中看不到任何反射效果,缺乏色彩感。在通过进行了SSR渲染之后,基于对镜面中包含的多个像素点进行了SSR计算,获取了其反射光方向上相交的像素点的颜色值,因此将反射交点的颜色值显示在对应的像素点上,从而实现可以在镜面中看到对反射光相交物体的显示,进而得到更真实的镜子观感,提升图像的色彩感,如图5a中的2所示。The effect after SSR rendering is described in conjunction with Figure 5a, and the mirror is used as an example to illustrate. Before SSR rendering is not performed, the basic shape and color information of the mirror can only be seen from the image displayed on the screen of the display device, as shown in Figure 5a As shown in 1 in the mirror, no reflection can be seen in the mirror, and the sense of color is lacking. After SSR rendering is performed, based on the SSR calculation of multiple pixels included in the mirror surface, the color values of the pixels intersecting in the reflected light direction are obtained, so the color values of the reflected intersections are displayed in the corresponding pixels. In this way, the display of objects intersecting with reflected light can be seen in the mirror surface, so as to obtain a more realistic mirror look and feel, and improve the color sense of the image, as shown in 2 in Figure 5a.

结合图5b来说明进行SSAO渲染之后的效果,以窗帘作为示例来说明,在没有进行SSAO渲染之前,只能从显示设备屏幕显示的图像中看到窗帘的基本形状和颜色信息,如图5b中的1所示,仅可以看到窗帘的基本形状,窗帘杆、窗帘边等。在进行了SSAO渲染之后,基于不同的像素点计算有不同的遮蔽值,通过遮蔽值对像素点的环境光的光照强度进行遮蔽调整之后,可以通过不同像素点具有不同的环境光的光照强度来体现层次感,即可以看到窗帘的褶皱形状,进而得到更真实的窗帘观感,如图5b中的2所示。Combined with Figure 5b to illustrate the effect after SSAO rendering, the curtain is used as an example to illustrate. Before SSAO rendering is not performed, the basic shape and color information of the curtain can only be seen from the image displayed on the screen of the display device, as shown in Figure 5b As shown in 1, only the basic shape of the curtain can be seen, curtain rod, curtain edge, etc. After SSAO rendering is performed, different occlusion values are calculated based on different pixel points. After shading and adjusting the illumination intensity of the ambient light of the pixel points through the occlusion value, the illumination intensity of the ambient light of different pixels can be adjusted by different pixels. To reflect the sense of hierarchy, that is, you can see the folded shape of the curtain, and then obtain a more realistic appearance of the curtain, as shown in 2 in Figure 5b.

通过前述介绍的内容,本申请实施时主要通过三个方面来达到降低计算资源的占用,减少了计算量,从而降低系统功耗,提升系统性能的目的。其中,三个方面包括:第一方面:SSAO计算复用SSR计算选择的第一像素点集合。第二方面:将SSAO渲染的遮蔽值与SSR渲染的颜色值合并输出。第三方面:对SSAO渲染的遮蔽值与SSR渲染的颜色值同时进行时域滤波。Based on the content introduced above, the present application mainly uses three aspects to achieve the purpose of reducing the occupation of computing resources, reducing the amount of calculation, thereby reducing the power consumption of the system and improving the performance of the system. The three aspects include: the first aspect: the SSAO calculation multiplexes the first pixel point set selected by the SSR calculation. The second aspect: Combine the occlusion value of SSAO rendering with the color value of SSR rendering and output. The third aspect: time-domain filtering is performed on the occlusion value rendered by SSAO and the color value rendered by SSR at the same time.

以下结合测试结果来更加准确地说明采用本申请提供的一种基于屏幕空间的渲染方法对系统性能的提升情况,以下结合表1说明,如下:The following is a more accurate description of the improvement of system performance by using a screen space-based rendering method provided by the present application in conjunction with the test results. The following description is combined with Table 1, as follows:

表1Table 1

采样点数量Number of sampling points 现有技术current technology 第一方面first 第二方面the second aspect 第三方面the third aspect 总收益Total revenue 3232 18.718.7 21.2(+13.3%)21.2 (+13.3%) 22.4(+5.6%)22.4 (+5.6%) 23.7(+5.8%)23.7 (+5.8%) +23.1%+23.1% 1616 21.221.2 23.7(+11.7%)23.7 (+11.7%) 24.6(+4.1%)24.6 (+4.1%) 25.7(+4.4%)25.7 (+4.4%) +20.2%+20.2% 88 24.524.5 27.1(+10.6%)27.1 (+10.6%) 27.2(+0.1%)27.2 (+0.1%) 28.3(+4%)28.3 (+4%) +14.7%+14.7% 22 26.326.3 27.8(+5.7%)27.8 (+5.7%) 26.1(-6.1%)26.1 (-6.1%) 27.5(+5.2%)27.5 (+5.2%) +4.8%+4.8%

根据以上表1可以得到,相比于现有技术中采用的技术实现方案来说,本申请中主要可以通过三个方面实现对系统性能的提升,采用其中至少一个方面的实施方式可以提升系统性能,若同时采用三个方面的实施方式,则可以对提升系统性能达到最大的收益。例如,表1中采样点数量为32时,通过第一方面(即SSAO计算复用SSR计算选择的第一像素点集合)对系统性能可以提升13.3%,通过第二方面(即将SSAO渲染的遮蔽值与SSR渲染的颜色值合并输出)对系统性能可以提升5.6%,而通过第三方面(即对SSAO渲染的遮蔽值与SSR渲染的颜色值同时进行时域滤波)对系统性能可以提升5.8%,如果同时采用三个方面的实施方式进行渲染,则对系统性能总收益可以提升达到23.1%。According to the above Table 1, compared with the technical implementation scheme adopted in the prior art, the system performance can be improved in three aspects in this application, and the system performance can be improved by adopting at least one aspect of the implementation. , if the implementation of the three aspects is adopted at the same time, the maximum benefit can be achieved in improving the system performance. For example, when the number of sampling points in Table 1 is 32, the system performance can be improved by 13.3% through the first aspect (that is, the SSAO calculation reuses the first set of pixels selected by the SSR calculation), and the second aspect (that is, the shading of the SSAO rendering) can be improved by 13.3%. value and the color value of SSR rendering) can improve the system performance by 5.6%, and through the third aspect (that is, temporal filtering of the occlusion value of SSAO rendering and the color value of SSR rendering at the same time), the system performance can be improved by 5.8% , if the three aspects are used for rendering at the same time, the total benefit of the system performance can be improved by 23.1%.

以上本申请实施例提供的基于屏幕空间的渲染方法可通过各种计算设备执行,该计算设备可以是电子设备。其中电子设备可以包括但不限于个人计算机、服务器计算机、手持式或膝上型设备、移动设备(比如手机、移动电话、平板电脑、个人数字助理、媒体播放器等)、消费型电子设备、小型计算机、大型计算机、移动机器人、无人机等。The rendering method based on the screen space provided by the above embodiments of the present application may be executed by various computing devices, and the computing device may be an electronic device. The electronic devices may include, but are not limited to, personal computers, server computers, handheld or laptop devices, mobile devices (such as cell phones, mobile phones, tablet computers, personal digital assistants, media players, etc.), consumer electronic devices, small Computers, mainframe computers, mobile robots, drones, etc.

以下实施例中,以计算设备是电子设备为例,对本申请实施例中提供的基于屏幕空间的渲染方法进行介绍。本申请实施例提供的一种基于屏幕空间的渲染方法,适用于如图6所示的电子设备,下面先简单介绍电子设备的具体结构。参考图6所示,为本申请实施例提供的一种电子设备的硬件结构示意图。如图6所示,电子设备600可以包括处理器610以及采集装置620。处理器610对采集装置620获取的数据进行处理。本申请实施例中,采集装置620获取的数据例如是待渲染场景的数据。In the following embodiments, taking the computing device as an electronic device as an example, the screen space-based rendering method provided in the embodiment of the present application is introduced. A screen space-based rendering method provided by an embodiment of the present application is applicable to the electronic device as shown in FIG. 6 , and the specific structure of the electronic device is briefly introduced below. Referring to FIG. 6 , a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application is shown. As shown in FIG. 6 , the electronic device 600 may include a processor 610 and a collection device 620 . The processor 610 processes the data acquired by the collection device 620 . In this embodiment of the present application, the data acquired by the collection device 620 is, for example, the data of the scene to be rendered.

处理器610是电子设备600的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器内的软件程序和/或数据,执行电子设备600的各种功能和处理数据。处理器610可以包括一个或多个处理单元,例如:处理器610包括的处理单元可以是前述实施例中涉及到的CPU,GPU,还可以是应用处理器(applicationprocessor,AP),调制解调处理器,图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,神经网络处理器(neural-network processing unit,NPU)等中的一项或多项。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。其中,NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备600的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。The processor 610 is the control center of the electronic device 600, uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions and/or functions of the electronic device 600 by running or executing the software programs and/or data stored in the memory. Data processing. The processor 610 may include one or more processing units. For example, the processing units included in the processor 610 may be the CPU and GPU involved in the foregoing embodiments, and may also be an application processor (application processor, AP), which performs modulation and demodulation processing. device, image signal processor (ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, neural-network processing unit (neural-network processing unit) , NPU), etc. one or more. Wherein, different processing units may be independent devices, or may be integrated in one or more processors. Among them, the NPU is a neural-network (NN) computing processor. By borrowing the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process the input information and can continuously learn by itself. Applications such as intelligent cognition of the electronic device 600 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.

采集装置620可以包括用于拍摄图像或视频的摄像头621。摄像头621可以是普通摄像头,也可以是对焦摄像头。进一步地,摄像头621可以用于采集RGB图像。采集装置620还可以包括一个或多个传感器622,例如图像传感器、红外传感器、激光传感器、压力传感器、陀螺仪传感器、气压传感器、磁传感器、加速度传感器、速度传感器、距离传感器、接近光传感器、环境光传感器、指纹传感器、触摸传感器、温度传感器、或骨传导传感器等传感器中的一种或多种。其中,图像传感器例如为飞行时间(time of flight,TOF)传感器或结构光传感器等。加速度传感器和速度传感器可以组成一个惯性测量单元(inertial measurementunit,IMU),IMU可以测量物体三轴姿态角(或角速率)以及加速度。The capturing device 620 may include a camera 621 for capturing images or videos. The camera 621 may be a common camera or a focusing camera. Further, the camera 621 can be used to capture RGB images. The acquisition device 620 may also include one or more sensors 622, such as image sensors, infrared sensors, laser sensors, pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, acceleration sensors, speed sensors, distance sensors, proximity light sensors, environmental sensors One or more of sensors such as light sensor, fingerprint sensor, touch sensor, temperature sensor, or bone conduction sensor. The image sensor is, for example, a time of flight (TOF) sensor or a structured light sensor. The acceleration sensor and the speed sensor can form an inertial measurement unit (IMU), and the IMU can measure the three-axis attitude angle (or angular rate) and acceleration of the object.

电子设备还可以包括存储器630。其中,存储器630可用于存储软件程序以及数据,处理器610可以通过运行存储在存储器630的软件程序以及数据,执行电子设备600的各种功能应用以及数据处理。存储器630可以主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如图像采集功能、图像识别功能等)等;存储数据区可存储根据电子设备600的使用所创建的数据(比如音频数据、文本信息、图像数据、语义地图等)等。此外,存储器630可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The electronic device may also include memory 630 . The memory 630 may be used to store software programs and data, and the processor 610 may execute various functional applications and data processing of the electronic device 600 by running the software programs and data stored in the memory 630 . The memory 630 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as an image acquisition function, an image recognition function, etc.), etc.; The use of the electronic device 600 creates data (such as audio data, textual information, image data, semantic maps, etc.), and the like. Additionally, memory 630 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.

电子设备还可以包括显示设备640,显示设备640包括的显示面板641,用于显示由用户输入的信息、提供给用户的信息或电子设备600的各种菜单界面中的一项或多项。在本申请实施例中,显示设备640主要用于显示基于本申请实施例进行实时渲染之后的显示界面效果。可选的,显示面板641可以包括液晶显示器(liquid crystal display,LCD)或有机发光二极管(organic light-emitting diode,OLED)等。The electronic device may also include a display device 640 including a display panel 641 for displaying information input by the user, information provided to the user, or one or more of various menu interfaces of the electronic device 600 . In the embodiment of the present application, the display device 640 is mainly used to display the display interface effect after real-time rendering based on the embodiment of the present application. Optionally, the display panel 641 may include a liquid crystal display (liquid crystal display, LCD) or an organic light-emitting diode (organic light-emitting diode, OLED) or the like.

电子设备600还可以包括输入设备650,用于接收输入的数字信息、字符信息或接触式触摸操作/非接触式手势,以及产生与电子设备600的用户设置以及功能控制有关的信号输入等。本申请实施例中,通过所述输入设备650可以接收用户对显示设备640显示的显示界面的用户操作,从而结合用户操作对渲染场景进行渲染,例如根据用户对游戏界面的操作,对游戏场景进行渲染,输出用户操作对应的特效等。The electronic device 600 may further include an input device 650 for receiving input numerical information, character information or contact touch operations/non-contact gestures, and generating signal inputs related to user settings and function control of the electronic device 600 . In this embodiment of the present application, the input device 650 can receive a user operation on the display interface displayed by the display device 640, so as to render the rendering scene in combination with the user operation, for example, according to the user's operation on the game interface, the game scene can be rendered Rendering, outputting special effects corresponding to user operations, etc.

在一些实施例中,处理器610可以包括一个或多个接口。接口可以包括移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 610 may include one or more interfaces. The interface may include a mobile industry processor interface (MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (SIM) interface, and/or a general-purpose serial interface bus (universal serial bus, USB) interface and so on.

MIPI接口可以被用于连接处理器610与显示设备640、摄像头621等外围器件。MIPI接口包括摄像头621串行接口(camera serial interface,CSI),显示屏串行接口(displayserial interface,DSI)等。在一些实施例中,处理器610和摄像头621通过CSI接口通信,实现电子设备600的拍摄功能。处理器610和显示设备640通过DSI接口通信,实现电子设备600的显示功能。The MIPI interface can be used to connect the processor 610 with peripheral devices such as the display device 640 and the camera 621 . The MIPI interface includes a camera 621 serial interface (camera serial interface, CSI), a display serial interface (displayserial interface, DSI), and the like. In some embodiments, the processor 610 communicates with the camera 621 through a CSI interface to implement the photographing function of the electronic device 600 . The processor 610 communicates with the display device 640 through the DSI interface to implement the display function of the electronic device 600 .

GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器610与摄像头621,显示设备640,传感器622等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface may be used to connect the processor 610 with the camera 621, the display device 640, the sensor 622, and the like.

USB接口是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口可以用于连接充电器为电子设备600充电,也可以用于电子设备600与外围设备之间传输数据。该接口可以用于连接其他电子设备,例如增强现实(augmented reality,AR)设备等。The USB interface is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like. The USB interface can be used to connect a charger to charge the electronic device 600, and can also be used to transmit data between the electronic device 600 and peripheral devices. The interface can be used to connect other electronic devices, such as augmented reality (AR) devices and the like.

可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备600的结构限定。在本申请另一些实施例中,电子设备600也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration, and does not constitute a structural limitation of the electronic device 600 . In other embodiments of the present application, the electronic device 600 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.

尽管并未在图6中示出,电子设备600还可以包括无线射频(radio frequency,RF)电路、电源、闪光灯、外部接口、按键、马达等其他可能的功能模块,在此不再赘述。Although not shown in FIG. 6 , the electronic device 600 may also include other possible functional modules such as a radio frequency (RF) circuit, a power supply, a flash, an external interface, a key, a motor, etc., which will not be described herein again.

基于上述介绍,本申请实施例提供一种基于屏幕空间的渲染方法及装置,可以应用于图6所示的电子设备架构中。其中的方法可以提供一种优化系统功能的基于屏幕空间的渲染方案。本申请实施例中,方法和装置是基于同一技术构思的,由于方法及装置解决问题的原理相似,因此装置与方法的实施例可以相互参见,重复之处不再赘述。Based on the above introduction, the embodiments of the present application provide a screen space-based rendering method and apparatus, which can be applied to the electronic device architecture shown in FIG. 6 . The method therein can provide a screen space-based rendering scheme that optimizes system functions. In the embodiments of the present application, the method and the device are based on the same technical concept. Since the principles of the method and the device for solving problems are similar, the embodiments of the device and the method can be referred to each other, and repeated descriptions will not be repeated.

在本申请实施例中,以计算设备是电子设备600为例进行描述,但是并不限制本申请实施例通过其他类型的计算设备执行。本申请实施例提供的一种基于屏幕空间的渲染方法可以由图6所示的电子设备600执行,例如可以通过电子设备600中的处理器610来执行。In the embodiments of the present application, the computing device is the electronic device 600 as an example for description, but the embodiments of the present application are not limited to be executed by other types of computing devices. The screen space-based rendering method provided by the embodiment of the present application may be executed by the electronic device 600 shown in FIG. 6 , for example, by the processor 610 in the electronic device 600 .

针对上述方法流程,本申请实施例还提供一种基于屏幕空间的渲染装置,该装置的具体实现可参见上述方法流程。基于相同发明构思,本申请实施例还提供一种基于屏幕空间的渲染装置,该装置可以为图6所示的处理器610或应用于处理器610的软件装置,该装置可以用于执行图2a-图4b所示的流程。参见图7,该装置700包括获取单元701,处理单元702,输出单元703;其中,所述获取单元701,用于获取触发指令;获取至少一帧图像的图像数据;所述处理单元702,用于响应于所述触发指令,以指定模式对所述图像数据进行渲染以得到至少一帧渲染后的图像,所述指定模式包括以下模式中的一种:第一模式、第二模式、和第三模式,所述第一模式为屏幕空间反射SSR模式,所述第二模式为屏幕空间环境光遮蔽SSAO模式,所述第三模式为SSR和SSAO结合模式;所述输出单元703,用于输出所述至少一帧渲染后的图像。For the above method flow, an embodiment of the present application further provides a screen space-based rendering apparatus, and the specific implementation of the apparatus may refer to the above method flow. Based on the same inventive concept, an embodiment of the present application further provides a screen space-based rendering device, which may be the processor 610 shown in FIG. 6 or a software device applied to the processor 610, and the device may be used to execute FIG. 2a - The flow shown in Figure 4b. 7, the device 700 includes an acquisition unit 701, a processing unit 702, and an output unit 703; wherein, the acquisition unit 701 is used to acquire a trigger instruction; acquire image data of at least one frame of image; the processing unit 702, use In response to the trigger instruction, the image data is rendered in a specified mode to obtain at least one frame of rendered image, and the specified mode includes one of the following modes: a first mode, a second mode, and a first mode. Three modes, the first mode is the screen space reflection SSR mode, the second mode is the screen space ambient light occlusion SSAO mode, and the third mode is the combined SSR and SSAO mode; the output unit 703 is used for outputting The at least one frame of the rendered image.

在一种可能的设计中,所述指定模式为所述第三模式,所述图像数据包含所述至少一帧图像中多个像素点;所述处理单元702,具体用于:在所述多个像素点中为所述多个像素点中每个像素点分别选择对应所述每个像素点的第一像素点集合;基于所述第一像素点集合进行SSR计算,得到颜色值;基于所述第一像素点集合进行SSAO计算,得到遮蔽值;根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像。In a possible design, the specified mode is the third mode, and the image data includes multiple pixels in the at least one frame of image; the processing unit 702 is specifically configured to: in the multiple For each pixel point in the plurality of pixel points, select a first pixel point set corresponding to each pixel point respectively; perform SSR calculation based on the first pixel point set to obtain a color value; SSAO calculation is performed on the first pixel point set to obtain an occlusion value; and each pixel point is rendered according to the color value and the occlusion value to obtain at least one frame of rendered image.

在一种可能的设计中,所述图像数据还包含所述每个像素点的视线向量和法线;所述处理单元702,具体用于:基于所述每个像素点的视线向量和法线确定反射光方向;在所述反射光方向上自所述多个像素点中选择所述第一像素点集合。In a possible design, the image data further includes the line of sight vector and normal of each pixel; the processing unit 702 is specifically configured to: based on the line of sight vector and normal of each pixel determining the reflected light direction; and selecting the first pixel point set from the plurality of pixel points in the reflected light direction.

在一种可能的设计中,所述处理单元702,具体用于:以所述反射光方向为基准,选择至少一个其他环境光方向;在所述其他环境光方向上自所述多个像素点中选择至少一个第二像素点集合;基于所述第一像素点集合和所述至少一个第二像素点集合进行SSAO计算。In a possible design, the processing unit 702 is specifically configured to: select at least one other ambient light direction based on the reflected light direction; select at least one other ambient light direction from the multiple pixel points in the other ambient light direction At least one second set of pixels is selected from among the set; SSAO calculation is performed based on the first set of pixels and the at least one set of second pixels.

在一种可能的设计中,所述处理单元702,还用于在根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像之前,对所述颜色值和所述遮蔽值进行时域滤波。In a possible design, the processing unit 702 is further configured to, before rendering each pixel point according to the color value and the occlusion value to obtain at least one frame of rendered image, The color value and the occlusion value are temporally filtered.

在一种可能的设计中,所述图像数据属于具有反射能力的材质,所述指定模式为所述第三模式。In a possible design, the image data belongs to a material with reflective ability, and the specified mode is the third mode.

需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。在本申请的实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现,或者采用软件和硬件结合的形式实现。It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and other division methods may be used in actual implementation. Each functional unit in the embodiments of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units, or may be implemented in the form of a combination of software and hardware.

根据本申请实施例提供的方法,本申请还提供一种计算机可读存储介质,该计算机可读介质存储有程序代码,当该程序代码在计算机上运行时,使得该计算机执行图2a至图4b所示实施例中任意一个实施例的方法。According to the method provided by the embodiments of the present application, the present application further provides a computer-readable storage medium, where the computer-readable medium stores program codes, and when the program codes are run on a computer, the computer is made to execute FIGS. 2 a to 4 b The method of any one of the illustrated embodiments.

根据本申请实施例提供的方法,本申请还提供一种系统,其包括前述的一个或多个终端显示设备以及一个或多个网络设备。According to the method provided by the embodiment of the present application, the present application further provides a system, which includes the aforementioned one or more terminal display devices and one or more network devices.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,高密度数字视频光盘(digital video disc,DVD))、或者半导体介质(例如,固态硬盘(solid state disc,SSD))等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in 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 instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server, or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media. The available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, high-density digital video discs (DVDs)), or semiconductor media (eg, solid state discs, SSD)) etc.

上述各个装置实施例中电子设备和方法实施例中的电子设备对应,由相应的模块或单元执行相应的步骤,例如通信单元(收发器)执行方法实施例中接收或发送的步骤,除发送、接收外的其它步骤可以由处理单元(处理器)执行。具体单元的功能可以参考相应的方法实施例。其中,处理器可以为一个或多个。The electronic equipment in the above-mentioned apparatus embodiments corresponds to the electronic equipment in the method embodiments, and corresponding steps are performed by corresponding modules or units, for example, the communication unit (transceiver) performs the steps of receiving or sending in the method embodiments, except for sending, Steps other than receiving may be performed by a processing unit (processor). For functions of specific units, reference may be made to corresponding method embodiments. The number of processors may be one or more.

在本说明书中使用的术语“部件”、“模块”、“系统”等用于表示计算机相关的实体、硬件、固件、硬件和软件的组合、软件、或执行中的软件。例如,部件可以是但不限于,在处理器上运行的进程、处理器、对象、可执行文件、执行线程、程序和/或计算机。通过图示,在计算设备上运行的应用和计算设备都可以是部件。一个或多个部件可驻留在进程和/或执行线程中,部件可位于一个计算机上和/或分布在两个或更多个计算机之间。此外,这些部件可从在上面存储有各种数据结构的各种计算机可读介质执行。部件可例如根据具有一个或多个数据分组(例如来自与本地系统、分布式系统和/或网络间的另一部件交互的二个部件的数据,例如通过信号与其它系统交互的互联网)的信号通过本地和/或远程进程来通信。The terms "component", "module", "system" and the like are used in this specification to refer to a computer-related entity, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component may be, but is not limited to, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or a computer. By way of illustration, both an application running on a computing device and the computing device may be components. One or more components may reside within a process and/or thread of execution, and a component may be localized on one computer and/or distributed between two or more computers. In addition, these components can execute from various computer readable media having various data structures stored thereon. A component may, for example, be based on a signal having one or more data packets (eg, data from two components interacting with another component between a local system, a distributed system, and/or a network, such as the Internet interacting with other systems via signals) Communicate through local and/or remote processes.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各种说明性逻辑块(illustrative logical block)和步骤(step),能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the various illustrative logical blocks and steps described in connection with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware accomplish. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, removable hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .

以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. should be covered within the scope of protection of this application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (15)

1.一种基于屏幕空间的渲染方法,其特征在于,包括:1. a rendering method based on screen space, is characterized in that, comprises: 获取触发指令;Get trigger command; 获取至少一帧图像的图像数据;Obtain image data of at least one frame of image; 响应于所述触发指令,以指定模式对所述图像数据进行渲染以得到至少一帧渲染后的图像,所述指定模式包括以下模式中的一种:第一模式、第二模式、和第三模式,所述第一模式为屏幕空间反射SSR模式,所述第二模式为屏幕空间环境光遮蔽SSAO模式,所述第三模式为SSR和SSAO结合模式;In response to the trigger instruction, the image data is rendered in a specified mode to obtain at least one frame of rendered image, and the specified mode includes one of the following modes: a first mode, a second mode, and a third mode mode, the first mode is a screen space reflection SSR mode, the second mode is a screen space ambient light occlusion SSAO mode, and the third mode is a combined SSR and SSAO mode; 输出所述至少一帧渲染后的图像。The at least one frame of the rendered image is output. 2.根据权利要求1所述的方法,其特征在于,所述指定模式为所述第三模式,所述图像数据包含所述至少一帧图像中多个像素点;2. The method according to claim 1, wherein the specified mode is the third mode, and the image data comprises a plurality of pixels in the at least one frame of image; 所述以指定模式对所述图像数据进行渲染以得到至少一帧渲染后的图像,包括:The rendering of the image data in a specified mode to obtain at least one frame of rendered image includes: 在所述多个像素点中为所述多个像素点中每个像素点分别选择对应所述每个像素点的第一像素点集合;selecting a first pixel point set corresponding to each pixel point for each pixel point in the plurality of pixel points from the plurality of pixel points; 基于所述第一像素点集合进行SSR计算,得到颜色值;Perform SSR calculation based on the first set of pixel points to obtain a color value; 基于所述第一像素点集合进行SSAO计算,得到遮蔽值;SSAO calculation is performed based on the first set of pixel points to obtain an occlusion value; 根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像。Render each pixel point according to the color value and the occlusion value to obtain at least one frame of rendered image. 3.根据权利要求2所述的方法,其特征在于,所述图像数据还包含所述每个像素点的视线向量和法线;3. The method according to claim 2, wherein the image data further comprises the line-of-sight vector and the normal of each pixel point; 所述在所述多个像素点中为所述多个像素点中每个像素点分别选择对应所述每个像素点的第一像素点集合,包括:The selecting the first pixel point set corresponding to each pixel point in the plurality of pixel points for each pixel point in the plurality of pixel points respectively includes: 基于所述每个像素点的视线向量和法线确定反射光方向;Determine the reflected light direction based on the line-of-sight vector and the normal of each pixel; 在所述反射光方向上自所述多个像素点中选择所述第一像素点集合。The first set of pixel points is selected from the plurality of pixel points in the reflected light direction. 4.根据权利要求3所述的方法,其特征在于,所述基于所述第一像素点集合进行SSAO计算,包括:4. The method according to claim 3, wherein the performing SSAO calculation based on the first set of pixel points comprises: 以所述反射光方向为基准,选择至少一个其他环境光方向;Selecting at least one other ambient light direction based on the reflected light direction; 在所述其他环境光方向上自所述多个像素点中选择至少一个第二像素点集合;selecting at least one second set of pixels from the plurality of pixels in the other ambient light directions; 基于所述第一像素点集合和所述至少一个第二像素点集合进行SSAO计算。SSAO calculation is performed based on the first set of pixels and the at least one second set of pixels. 5.根据权利要求2至4任一所述的方法,其特征在于,在根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像之前,所述方法还包括:5. The method according to any one of claims 2 to 4, wherein before rendering each pixel point according to the color value and the occlusion value to obtain at least one frame of rendered image, The method also includes: 对所述颜色值和所述遮蔽值进行时域滤波。Temporal filtering is performed on the color value and the occlusion value. 6.根据权利要求1至5任一所述的方法,其特征在于,所述图像数据属于具有反射能力的材质,所述指定模式为所述第三模式。6 . The method according to claim 1 , wherein the image data belongs to a material with reflective ability, and the specified mode is the third mode. 7 . 7.一种基于屏幕空间的渲染装置,其特征在于,所述装置包括获取单元,处理单元,输出单元;7. A screen space-based rendering device, wherein the device comprises an acquisition unit, a processing unit, and an output unit; 其中,所述获取单元,用于获取触发指令;Wherein, the obtaining unit is used to obtain the trigger instruction; 获取至少一帧图像的图像数据;Obtain image data of at least one frame of image; 所述处理单元,用于响应于所述触发指令,以指定模式对所述图像数据进行渲染以得到至少一帧渲染后的图像,所述指定模式包括以下模式中的一种:第一模式、第二模式、和第三模式,所述第一模式为屏幕空间反射SSR模式,所述第二模式为屏幕空间环境光遮蔽SSAO模式,所述第三模式为SSR和SSAO结合模式;The processing unit is configured to, in response to the trigger instruction, render the image data in a specified mode to obtain at least one frame of rendered image, where the specified mode includes one of the following modes: a first mode, a The second mode and the third mode, the first mode is a screen space reflection SSR mode, the second mode is a screen space ambient light occlusion SSAO mode, and the third mode is a combination of SSR and SSAO mode; 所述输出单元,用于输出所述至少一帧渲染后的图像。The output unit is configured to output the at least one frame of the rendered image. 8.根据权利要求7所述的装置,其特征在于,所述指定模式为所述第三模式,所述图像数据包含所述至少一帧图像中多个像素点;8. The device according to claim 7, wherein the specified mode is the third mode, and the image data comprises a plurality of pixels in the at least one frame of image; 所述处理单元,具体用于:The processing unit is specifically used for: 在所述多个像素点中为所述多个像素点中每个像素点分别选择对应所述每个像素点的第一像素点集合;selecting a first pixel point set corresponding to each pixel point for each pixel point in the plurality of pixel points from the plurality of pixel points; 基于所述第一像素点集合进行SSR计算,得到颜色值;Perform SSR calculation based on the first set of pixel points to obtain a color value; 基于所述第一像素点集合进行SSAO计算,得到遮蔽值;SSAO calculation is performed based on the first set of pixel points to obtain an occlusion value; 根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像。Render each pixel point according to the color value and the occlusion value to obtain at least one frame of rendered image. 9.根据权利要求8所述的装置,其特征在于,所述图像数据还包含所述每个像素点的视线向量和法线;9. The apparatus according to claim 8, wherein the image data further comprises a line of sight vector and a normal of each pixel; 所述处理单元,具体用于:The processing unit is specifically used for: 基于所述每个像素点的视线向量和法线确定反射光方向;Determine the reflected light direction based on the line-of-sight vector and the normal of each pixel; 在所述反射光方向上自所述多个像素点中选择所述第一像素点集合。The first set of pixel points is selected from the plurality of pixel points in the reflected light direction. 10.根据权利要求9所述的装置,其特征在于,所述处理单元,具体用于:10. The apparatus according to claim 9, wherein the processing unit is specifically configured to: 以所述反射光方向为基准,选择至少一个其他环境光方向;Selecting at least one other ambient light direction based on the reflected light direction; 在所述其他环境光方向上自所述多个像素点中选择至少一个第二像素点集合;selecting at least one second set of pixels from the plurality of pixels in the other ambient light directions; 基于所述第一像素点集合和所述至少一个第二像素点集合进行SSAO计算。SSAO calculation is performed based on the first set of pixels and the at least one second set of pixels. 11.根据权利要求8至10任一所述的装置,其特征在于,所述处理单元,还用于在根据所述颜色值和所述遮蔽值对所述每个像素点进行渲染以得到至少一帧渲染后的图像之前,对所述颜色值和所述遮蔽值进行时域滤波。11. The apparatus according to any one of claims 8 to 10, wherein the processing unit is further configured to render each pixel point according to the color value and the occlusion value to obtain at least the occlusion value. Temporal filtering is performed on the color value and the occlusion value before a frame of rendered image. 12.根据权利要求7至11任一所述的装置,其特征在于,所述图像数据属于具有反射能力的材质,所述指定模式为所述第三模式。12 . The device according to claim 7 , wherein the image data belongs to a material with reflective ability, and the specified mode is the third mode. 13 . 13.一种计算设备,其特征在于,所述计算设备包括处理器和存储器;13. A computing device, characterized in that the computing device comprises a processor and a memory; 所述存储器,存储计算机程序指令;the memory, storing computer program instructions; 所述处理器调用所述存储器中的计算机程序指令以执行如权利要求1至6中任一项所述的方法。The processor invokes computer program instructions in the memory to perform the method of any of claims 1-6. 14.一种计算设备集群,其特征在于,包括多个如权利要求13所述的计算设备。14. A computing device cluster, comprising a plurality of computing devices as claimed in claim 13. 15.一种计算机程序产品,其特征在于,包括计算机指令,当所述计算机指令在计算设备上运行时,使得所述计算机执行如权利要求1至6中任一项所述的方法。15. A computer program product comprising computer instructions which, when executed on a computing device, cause the computer to perform the method of any one of claims 1 to 6.
CN202011484514.0A 2020-12-15 2020-12-15 A rendering method and device based on screen space Pending CN114638925A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011484514.0A CN114638925A (en) 2020-12-15 2020-12-15 A rendering method and device based on screen space

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011484514.0A CN114638925A (en) 2020-12-15 2020-12-15 A rendering method and device based on screen space

Publications (1)

Publication Number Publication Date
CN114638925A true CN114638925A (en) 2022-06-17

Family

ID=81944733

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011484514.0A Pending CN114638925A (en) 2020-12-15 2020-12-15 A rendering method and device based on screen space

Country Status (1)

Country Link
CN (1) CN114638925A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118038771A (en) * 2024-02-09 2024-05-14 保利文化传播有限公司 Three-dimensional holographic interaction system and method for digital showcase
WO2024221929A1 (en) * 2023-04-27 2024-10-31 荣耀终端有限公司 Display method and electronic device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923727A (en) * 2009-06-10 2010-12-22 三星电子株式会社 Hybrid rendering apparatus and method
CN102592305A (en) * 2011-09-06 2012-07-18 浙江大学 Adaptive Screen Space Ambient Occlusion Method
CN104134230A (en) * 2014-01-22 2014-11-05 腾讯科技(深圳)有限公司 Image processing method, image processing device and computer equipment
CN104240286A (en) * 2014-09-03 2014-12-24 无锡梵天信息技术股份有限公司 Real-time reflection method based on screen space
US20180210715A1 (en) * 2017-01-25 2018-07-26 Wal-Mart Stores, Inc. Systems, method, and non-transitory computer-readable storage media for generating code for displaying a webpage
CN110152291A (en) * 2018-12-13 2019-08-23 腾讯科技(深圳)有限公司 Rendering method, device, terminal and the storage medium of game picture
CN111210497A (en) * 2020-01-16 2020-05-29 网易(杭州)网络有限公司 Model rendering method and device, computer readable medium and electronic equipment
CN111643901A (en) * 2020-06-02 2020-09-11 三星电子(中国)研发中心 Method and device for intelligently rendering cloud game interface

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923727A (en) * 2009-06-10 2010-12-22 三星电子株式会社 Hybrid rendering apparatus and method
CN102592305A (en) * 2011-09-06 2012-07-18 浙江大学 Adaptive Screen Space Ambient Occlusion Method
CN104134230A (en) * 2014-01-22 2014-11-05 腾讯科技(深圳)有限公司 Image processing method, image processing device and computer equipment
CN104240286A (en) * 2014-09-03 2014-12-24 无锡梵天信息技术股份有限公司 Real-time reflection method based on screen space
US20180210715A1 (en) * 2017-01-25 2018-07-26 Wal-Mart Stores, Inc. Systems, method, and non-transitory computer-readable storage media for generating code for displaying a webpage
CN110152291A (en) * 2018-12-13 2019-08-23 腾讯科技(深圳)有限公司 Rendering method, device, terminal and the storage medium of game picture
CN111210497A (en) * 2020-01-16 2020-05-29 网易(杭州)网络有限公司 Model rendering method and device, computer readable medium and electronic equipment
CN111643901A (en) * 2020-06-02 2020-09-11 三星电子(中国)研发中心 Method and device for intelligently rendering cloud game interface

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
赵锴源;: "基于RTX的实时环境光遮蔽技术", 现代计算机, no. 36, 25 December 2019 (2019-12-25) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024221929A1 (en) * 2023-04-27 2024-10-31 荣耀终端有限公司 Display method and electronic device
CN118038771A (en) * 2024-02-09 2024-05-14 保利文化传播有限公司 Three-dimensional holographic interaction system and method for digital showcase

Similar Documents

Publication Publication Date Title
US12354228B2 (en) Generating 3D data in a messaging system
US11961189B2 (en) Providing 3D data for messages in a messaging system
US11825065B2 (en) Effects for 3D data in a messaging system
US20210065464A1 (en) Beautification techniques for 3d data in a messaging system
WO2021042134A1 (en) Generating 3d data in a messaging system
US20240087219A1 (en) Method and apparatus for generating lighting image, device, and medium
CN105550973B (en) Graphics processing unit, graphics processing system and anti-aliasing processing method
US11120591B2 (en) Variable rasterization rate
WO2021146930A1 (en) Display processing method, display processing apparatus, electronic device and storage medium
WO2023066121A1 (en) Rendering of three-dimensional model
CN114638950A (en) Method and device for drawing shadows of virtual objects
CN114638925A (en) A rendering method and device based on screen space
US10212406B2 (en) Image generation of a three-dimensional scene using multiple focal lengths
CN110069125B (en) Virtual object control method and device
US11748911B2 (en) Shader function based pixel count determination
US11836437B2 (en) Character display method and apparatus, electronic device, and storage medium
WO2023185476A1 (en) Object rendering method and apparatus, electronic device, storage medium, and program product
WO2023051590A1 (en) Render format selection method and device related thereto
CN116152412A (en) Model rendering method, device and equipment
US20130342553A1 (en) Texture mapping techniques
CN116645449A (en) Expression package generation method and equipment
CN115619924A (en) Method and apparatus for light estimation
WO2022000347A1 (en) Image processing method, display processing apparatus, and computer readable storage medium
CN114367105A (en) Model shading methods, apparatus, devices, media and procedural products
CN116934941A (en) Object rendering methods, devices, electronic devices, storage media and program products

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