WO2022111400A1 - Light source sampling weight determination method for multiple light source scenario rendering, and related device - Google Patents

Light source sampling weight determination method for multiple light source scenario rendering, and related device Download PDF

Info

Publication number
WO2022111400A1
WO2022111400A1 PCT/CN2021/131989 CN2021131989W WO2022111400A1 WO 2022111400 A1 WO2022111400 A1 WO 2022111400A1 CN 2021131989 W CN2021131989 W CN 2021131989W WO 2022111400 A1 WO2022111400 A1 WO 2022111400A1
Authority
WO
WIPO (PCT)
Prior art keywords
light source
rendering
rendered
scene
target
Prior art date
Application number
PCT/CN2021/131989
Other languages
French (fr)
Chinese (zh)
Inventor
周鹏
舒思超
徐维超
马杨军
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022111400A1 publication Critical patent/WO2022111400A1/en

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
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/06Ray-tracing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/55Radiosity

Definitions

  • the present application relates to the technical field of image processing, in particular to a method for determining a light source sampling weight for multi-light source scene rendering and related devices.
  • Rendering is the process of using software to generate images from models, which can be widely used in games, film and television, animation and other fields.
  • Rendering can include ray tracing rendering, which is a special rendering algorithm in 3D computer graphics that traces the rendering rays emitted from the virtual rendering camera, calculates the process of rendering rays propagating in the rendering scene, and finally renders the mathematics of the scene. Models are rendered as images.
  • multiple light sources are generally set in the rendering scene, and each light source is correspondingly set with its own light source sampling weight. The light source sampling weight determines whether to select the light source as an effective light source to participate in the calculation of ray tracing rendering.
  • the light source sampling weight corresponding to each of the above-mentioned light sources in the above-mentioned target rendering perspective is determined, and the light source sampling weight is used to perform multi-light source ray tracing rendering on the above-mentioned scene to be rendered.
  • the irradiation information in each of the above-mentioned first rendered images is determined based on the brightness information corresponding to each of the above-mentioned first rendered images, wherein the The luminance information is obtained by conversion based on the color information in each of the first rendered images.
  • the plurality of light sources include a first light source; the scene to be rendered includes a first intersection and at least one second intersection, the first The intersection is the intersection of the first rendering ray and the first object in the scene to be rendered on the surface of the first object, and the second intersection is the reflected ray of the first intersection and the second object in the scene to be rendered.
  • Performing ray tracing rendering of a single light source on the scene to be rendered from the perspective of target rendering, and obtaining each first rendered image corresponding to the scene to be rendered under the illumination of each light source is specifically implemented as follows:
  • each illumination sampling corresponds to selecting each target light source from the above-mentioned plurality of light sources, and each target light source is used to perform multiple illumination operations on the above-mentioned target intersection points.
  • the ray tracing rendering of the light source is to obtain the second irradiance of the target intersection point projected by the target rendering light on the second rendering image under each illumination sampling; wherein, the probability of selecting each target light source is proportional to the above The light source sampling weight of the light source in the above-mentioned target rendering perspective;
  • the intersection of other objects in the scene means that light 5 is visible.
  • light source 1 can illuminate the first intersection i through light 3 and light 5, and the second intersection k is illuminated by light source 1 alone by the first rendering light A1
  • the second radiance L3 projected on the first rendered image can be expressed as:
  • ⁇ 3 is the angle between the ray 6 and the normal of the second intersection j; is the third probability density function, related to ⁇ 3.
  • the irradiance L is (regardless of object luminescence):
  • the calculation of the irradiance of each first intersection point Similar to the irradiance calculation of the first intersection i, the irradiances of all the first intersections in the scene to be rendered are multiplied by the object attributes of their respective objects, respectively, and all the first intersections in the scene to be rendered are obtained.
  • the rendering display information includes color information (ie, RGB representation). The RGB representations of the multiple first intersection points under the single illumination of the light source 1 are added and the average is taken as the RGB representation of the pixel x.
  • the RGB of the multiple pixels x may be represented. Addition is made as the RGB representation of the first rendered image.
  • the RGB representations of multiple pixels x may also be added and then averaged, and used as the RGB representation of the first rendered image.
  • the first rendered image can be obtained from the RGB representation of the first rendered image.
  • S203 The processor determines, according to the irradiation information in each first rendered image, the light source sampling weight corresponding to each light source in the target rendering perspective.
  • the irradiation information in each first rendered image is determined based on brightness information corresponding to each first rendered image, wherein the brightness information of each first rendered image is determined based on the brightness information in each first rendered image obtained from the color information.
  • the processor may acquire the RGB representation of each first rendered image, convert the RGB representation of each first rendered image into a YUV representation, and use the brightness information (ie, the Y value) of each first rendered image as each light source in the The corresponding light source sampling weight in the target rendering perspective.
  • the brightness information of each first rendered image is in one-to-one correspondence with each light source, and the brightness information of each first rendered image is used as the light source sampling weight of the corresponding light source.
  • multiple light sources in the multi-light source scene are in an on state.
  • the virtual rendering camera emits a target rendering ray to the scene to be rendered, and the intersection of the target rendering ray and any object in the to-be-rendered scene on the surface of any object is the target intersection point. From the target rendering perspective, multiple lighting samples are performed on each light source based on the target intersection, and the irradiance of the target intersection under each lighting sampling is obtained. It can be understood that, unlike the single light source illumination sampling performed on the first light source based on the first intersection point, more than one light source is turned on at this time, and each light source is subjected to multiple illumination sampling based on the target intersection point.
  • the rendering display information (such as RGB representation) of all target intersections in the scene to be rendered under the illumination of multiple light sources is added and averaged to obtain the RGB representation of the second rendered image.
  • the RGB representation of the second rendered image can be Get the second rendered image.
  • the probability of selecting a light source corresponding to a larger light source sampling weight increases during the ray tracing rendering process, which can speed up the convergence speed of multi-light source scene rendering.
  • the light source sampling weight of each target light source in the target rendering perspective is greater than the preset threshold.
  • the processor culls each light source by setting a preset threshold.
  • the preset threshold is 0.3
  • the light source whose light source sampling weight is not greater than 0.3 is not rendered by ray tracing.
  • the light source selection range that is, light source 1 does not participate in the calculation of ray tracing rendering.
  • the electronic device may be set with a rendering preprocessing mode, and the user may enable the rendering preprocessing mode as required.
  • Turning on the rendering preprocessing mode is to implement the light source sampling weight method for multi-light source scene rendering provided by the embodiment of the present application. After the electronic device enables the rendering preprocessing mode, the convergence speed of the multi-light source scene rendering can be accelerated.
  • the electronic device may acquire the placement position of the virtual rendering camera in response to the user's click operation, drag operation, etc. on the virtual rendering camera in the setting interface 41 .
  • the target rendering angle of view is determined.
  • the processor obtains the scene to be rendered in the multi-light source scene 40 from the target rendering perspective.
  • the placement position of the virtual rendering camera is a room in a residential building, and the screen of the electronic device can display the scene to be rendered 50 as shown in FIG. 5 .
  • the setting interface 41 may further include other information, such as shape information, attributes, rendering time, etc. of each object in the multi-light source scene.
  • the electronic device After the rendering preprocessing mode is turned on, the electronic device will first perform ray tracing rendering of a single light source on the scene 50 to be rendered. Exemplarily, the electronic device turns on the single light source in turn, and respectively performs bidirectional path tracing rendering on the scene to be rendered 50 to obtain the scene to be rendered. 50 Determine the light source sampling weight of each light source based on the irradiation information in each first rendered image (eg, the Y value of each first rendered image) for each first rendered image corresponding to each light source individually illuminated.
  • the electronic device After the electronic device obtains the light source sampling weight of each light source, it turns on all the light sources in the multi-light source scene 40, and performs ray tracing rendering of the multi-light source in the scene to be rendered 50, for example, bidirectional path tracing rendering, and obtains the scene to be rendered under the illumination of multiple light sources. of the second rendered image.
  • the electronic device may respond to the rendering time set by the user, for example, the rendering time is 60s. Or, based on the default rendering time, the electronic device performs ray tracing rendering of multiple light sources on the scene 50 to be rendered, and obtains the rendering result diagram (ie, the second rendered image) as shown in FIG. 6 .
  • the inventor of the present application has conducted a comparative experiment, turning off the rendering preprocessing mode (that is, not checking light source sampling weight options).
  • the rendering time is also 60s. All light sources in the multi-light source scene 40 are turned on, and the electronic device performs ray tracing rendering of the multi-light source in the scene 50 to be rendered based on the default light source sampling weight, and the rendering result diagram as shown in FIG. 7 is obtained.
  • the rendering preprocessing mode can be turned off, but when the rendering time is long enough, for example, the rendering time is 2h, the electronic device turns on all the light sources in the multi-light source scene 40 based on the default light source sampling weight, and executes multiple functions in the scene 50 to be rendered.
  • the ray tracing rendering of the light source, the rendering result shown in Figure 8 is obtained.
  • the rendering result graph shown in FIG. 8 is an effect close to the real image, that is, FIG. 8 can be used as a reference rendering result graph of the scene to be rendered.
  • the present application also provides a schematic diagram of rendering details of the rendering result graph. See Figures 9 to 14.
  • Figures 9 and 12 are schematic diagrams of rendering details of the rendering result diagram shown in Figure 6; Figures 10 and 13 are schematic diagrams of rendering details of the rendering result diagram shown in Figure 7; Figures 11 and 14 It is a schematic diagram of rendering details of the rendering result graph shown in FIG. 8 .
  • Figure 9, Figure 10, and Figure 11 constitute a set of comparison combinations, and Figures 12, 13, and 14 constitute another set of comparison combinations. It can be understood that a set of comparison combinations indicates that all the rendering results shown in the combination are Rendered for the same detail (ie the same object).
  • the second rendered image obtained by implementing the embodiment of the present application is more realistic.
  • the rendering result obtained by implementing the present application is not much different from the reference rendering result graph. to achieve the same rendering effect as the reference rendering result image within the time. That is, by implementing the embodiments of the present application, the convergence speed of multi-light source scene rendering can be accelerated.
  • the quantized data may include but not limited to peak signal-to-noise ratio (peak signal-to-noise ratio, PSNR), structural similarity (structural similarity, SSIM), root-mean-square error (root-mean-square error, RMSE) and the like.
  • peak signal-to-noise ratio peak signal-to-noise ratio, PSNR
  • structural similarity structural similarity
  • SSIM structural similarity
  • root-mean-square error root-mean-square error
  • RMSE root-mean-square error
  • the reference rendering images are shown in Figure 8, Figure 11, and Figure 14, respectively, which can be obtained from the quantified data in Table 3.
  • the rendered image obtained by enabling the rendering preprocessing mode is closer to the reference rendering than the rendered image obtained by not enabling the rendering preprocessing mode. image. That is, by implementing the embodiments of the present application, the convergence speed of multi-light source scene rendering can be accelerated.
  • the device 150 for determining the light source sampling weight for multi-light source scene rendering further includes a processing module 1503;
  • the plurality of light sources include a first light source;
  • the scene to be rendered includes a first intersection and at least one second intersection, where the first intersection is the first rendering ray and the first object in the scene to be rendered The intersection point on the surface of the first object, the second intersection point is the intersection point where the reflected ray of the first intersection point and the second object in the scene to be rendered intersect on the surface of the second object and/or the above-mentioned light sources emit The ray of light intersects each third object in the scene to be rendered at the intersection on the surface of each third object; the first rendering ray is sent by the virtual rendering camera to the above scene to be rendered, and the virtual rendering camera is used to determine the above target rendering perspective;
  • the obtaining module 1500 is further configured to obtain, according to the sum of the first radiance and each second radiance, the first irradiance of the first intersection point projected on the above-mentioned first rendered image by the first rendering light under the single illumination of the first light source Spend;
  • the determining module 1502 is further configured to determine the rendering display information of the first intersection under the single illumination of the first light source based on the above-mentioned first irradiance and the object attribute of the object where the first intersection is located;
  • the obtaining module 1500 is further configured to obtain the second irradiance of the target intersection point projected by the target rendering light on the above-mentioned second rendered image under each illumination sampling;

Landscapes

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

Abstract

A light source sampling weight determination method for multiple light source scenario rendering, and a related device. The method comprises: obtaining a scenario to be rendered in a multiple light source scenario and using a target rendering angle, and obtaining a plurality of light sources arranged in the multiple light source scenario (S201); executing single light source ray tracing rendering on the scenario to be rendered at the target rendering angle, and obtaining first rendering images corresponding to the scenario to be rendered under the sole illumination of each light source (S202); and determining a light source sampling weight corresponding to each light source at the target rendering angle according to irradiation information in each first rendering image (S203), where the light source sampling weights are used for executing multiple light source ray tracing rendering on the scenario to be rendered. The present method can accelerate the convergence speed of multiple light source scenario rendering.

Description

多光源场景渲染的光源采样权重确定方法及相关设备Light source sampling weight determination method and related equipment for multi-light source scene rendering
本申请要求于2020年11月27日提交中国专利局、申请号为202011360803.X、申请名称为“多光源场景渲染的光源采样权重确定方法及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on November 27, 2020, with the application number 202011360803.X, and the application title is "Method for Determining Light Source Sampling Weights for Multi-Light Source Scene Rendering and Related Equipment", all of which are The contents are incorporated herein by reference.
技术领域technical field
本申请涉及图像处理技术领域,尤其是一种多光源场景渲染的光源采样权重确定方法及相关设备。The present application relates to the technical field of image processing, in particular to a method for determining a light source sampling weight for multi-light source scene rendering and related devices.
背景技术Background technique
渲染是用软件将模型生成图像的过程,可以广泛应用于游戏、影视、动画等领域。渲染可以包括光线追踪渲染,光线追踪渲染是一种三维计算机图形学中的特殊渲染算法,跟踪从虚拟渲染相机发出的渲染光线,计算渲染光线在渲染场景中传播的过程,最终将渲染场景的数学模型呈现为图像。为了实现逼真的渲染效果,一般在渲染场景中设置多个光源,每个光源均对应设置有自身的光源采样权重,光源采样权重决定是否选择该光源作为有效光源参与光线追踪渲染的运算中。Rendering is the process of using software to generate images from models, which can be widely used in games, film and television, animation and other fields. Rendering can include ray tracing rendering, which is a special rendering algorithm in 3D computer graphics that traces the rendering rays emitted from the virtual rendering camera, calculates the process of rendering rays propagating in the rendering scene, and finally renders the mathematics of the scene. Models are rendered as images. In order to achieve realistic rendering effects, multiple light sources are generally set in the rendering scene, and each light source is correspondingly set with its own light source sampling weight. The light source sampling weight determines whether to select the light source as an effective light source to participate in the calculation of ray tracing rendering.
现有技术中,对多个光源的光源采样权重采用随机确定法,即各个光源的光源渲染权重是一样的。各个光源的光源渲染权重一样使得多光源场景渲染的收敛速度慢。In the prior art, a random determination method is adopted for the light source sampling weight of multiple light sources, that is, the light source rendering weight of each light source is the same. The light source rendering weight of each light source is the same, which makes the convergence speed of multi-light source scene rendering slow.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种多光源场景渲染的光源采样权重确定方法及相关,可以加快多光源场景渲染的收敛速度。The present application provides a method for determining a light source sampling weight for multi-light source scene rendering and the correlation, which can speed up the convergence speed of multi-light source scene rendering.
第一方面,本申请实施例公开了一种多光源场景渲染的光源采样权重确定方法。该方法包括:In a first aspect, an embodiment of the present application discloses a method for determining a light source sampling weight for multi-light source scene rendering. The method includes:
以目标渲染视角在多光源场景中获取待渲染场景,并获取该多光源场景中设置的多个光源;Obtain the scene to be rendered in the multi-light source scene from the target rendering perspective, and obtain the multiple light sources set in the multi-light source scene;
在目标渲染视角下,对上述待渲染场景执行单光源的光线追踪渲染,得到该待渲染场景在各个光源单独光照下对应的各个第一渲染图像;From the target rendering perspective, perform ray tracing rendering of a single light source on the scene to be rendered, to obtain each first rendered image corresponding to the scene to be rendered under the lighting of each light source alone;
根据该各个第一渲染图像中的辐照信息,确定上述各个光源在上述目标渲染视角下对应的光源采样权重,该光源采样权重用于对上述待渲染场景执行多光源的光线追踪渲染。According to the irradiance information in each first rendered image, the light source sampling weight corresponding to each of the above-mentioned light sources in the above-mentioned target rendering perspective is determined, and the light source sampling weight is used to perform multi-light source ray tracing rendering on the above-mentioned scene to be rendered.
本申请实施例根据各个光源对待渲染场景进行单光源光线追踪渲染后得到的各个第一渲染图像的辐照信息,确定对应各个光源的光源采样权重,该光源采样权重可以使得多光源光线追踪渲染过程中选择到光源采样权重较大对应的光源的概率变大。实施本申请实施例,可以在多光源光线追踪渲染过程中选择到更合适的光源,从而加快多光源场景渲染的收敛速度。In this embodiment of the present application, the light source sampling weight corresponding to each light source is determined according to the irradiance information of each first rendered image obtained after each light source performs single light source ray tracing rendering on the scene to be rendered, and the light source sampling weight can make the multi-light source ray tracing rendering process The probability of selecting a light source corresponding to a larger light source sampling weight increases. By implementing the embodiments of the present application, a more suitable light source can be selected during the multi-light source ray tracing rendering process, thereby accelerating the convergence speed of multi-light source scene rendering.
结合第一方面,在第一种可能的实现方式中,上述方法还包括:在上述目标渲染视角下,基于上述各个光源在上述目标渲染视角下对应的光源采样权重,对上述待渲染场景执行多光源的光线追踪渲染,得到该待渲染场景在多光源光照下的第二渲染图像。实施本申 请实施例,基于各个光源的光源采样权重,在光线追踪渲染过程中选择到光源采样权重较大对应的光源的概率变大,可以加快多光源场景渲染的收敛速度。With reference to the first aspect, in a first possible implementation manner, the above method further includes: in the above-mentioned target rendering perspective, based on the light source sampling weights corresponding to the above-mentioned light sources in the above-mentioned target rendering perspective, performing multiple executions on the above-mentioned scene to be rendered. The ray tracing rendering of the light source obtains a second rendered image of the scene to be rendered under the illumination of multiple light sources. Implementing the embodiments of the present application, based on the light source sampling weight of each light source, increases the probability of selecting a light source corresponding to a larger light source sampling weight during the ray tracing rendering process, which can speed up the convergence speed of multi-light source scene rendering.
结合第一方面第一种可能的实现方式,在第二种可能的实现方式中,上述各个第一渲染图像的分辨率均小于上述第二渲染图像的分辨率。实施本申请实施例,在单光源光线追踪渲染过程中设置第一渲染图像为较小分辨率图像,计算各个光源的光源采样权重,可以减少运算量,提高渲染速度。With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the resolution of each of the foregoing first rendered images is smaller than the resolution of the foregoing second rendered images. By implementing the embodiment of the present application, in the single light source ray tracing rendering process, the first rendered image is set as a smaller resolution image, and the light source sampling weight of each light source is calculated, which can reduce the amount of calculation and improve the rendering speed.
结合第一方面上述任意一种可能的实现方式,在第三种可能的实现方式中,上述光线追踪渲染包括双向路径追踪渲染。实施本申请,可以快速产生多条光线,进一步加快收敛速度。With reference to any one of the above possible implementation manners of the first aspect, in a third possible implementation manner, the foregoing ray tracing rendering includes bidirectional path tracing rendering. By implementing the present application, multiple rays can be quickly generated, and the convergence speed can be further accelerated.
结合第一方面,在第四种可能的实现方式中,上述各个第一渲染图像中的辐照信息为基于上述各个第一渲染图像对应的亮度信息而确定的,其中该各个第一渲染图像的亮度信息为基于该各个第一渲染图像中的色彩信息转换得到。With reference to the first aspect, in a fourth possible implementation manner, the irradiation information in each of the above-mentioned first rendered images is determined based on the brightness information corresponding to each of the above-mentioned first rendered images, wherein the The luminance information is obtained by conversion based on the color information in each of the first rendered images.
结合第一方面上述任意一种可能的实现方式,在第五种可能的实现方式中,上述多个光源包括第一光源;上述待渲染场景包括第一交点和至少一个第二交点,该第一交点为第一渲染光线与上述待渲染场景中的第一物体相交于该第一物体的表面上的交点,该第二交点为该第一交点的反射光线与上述待渲染场景中的第二物体相交于该第二物体表面上的交点和/或上述各个光源发出的光线分别与上述待渲染场景中的各个第三物体相交于该各个第三物体表面上的交点;该第一渲染光线为虚拟渲染相机向上述待渲染场景发出的,该虚拟渲染相机用于确定上述目标渲染视角;In combination with any one of the possible implementation manners of the first aspect, in a fifth possible implementation manner, the plurality of light sources include a first light source; the scene to be rendered includes a first intersection and at least one second intersection, the first The intersection is the intersection of the first rendering ray and the first object in the scene to be rendered on the surface of the first object, and the second intersection is the reflected ray of the first intersection and the second object in the scene to be rendered. The intersection point on the surface of the second object and/or the light emitted by each of the above-mentioned light sources and each of the third objects in the scene to be rendered are intersected on the surface of each of the third objects; the first rendering ray is a virtual Sent from the rendering camera to the scene to be rendered, the virtual rendering camera is used to determine the target rendering angle of view;
上述在目标渲染视角下,对上述待渲染场景执行单光源的光线追踪渲染,得到该待渲染场景在各个光源单独光照下对应的各个第一渲染图像具体实现为:Performing ray tracing rendering of a single light source on the scene to be rendered from the perspective of target rendering, and obtaining each first rendered image corresponding to the scene to be rendered under the illumination of each light source is specifically implemented as follows:
在上述目标渲染视角下,基于上述第一交点对上述第一光源进行光照采样,得到该第一交点在该第一光源单独光照下由上述第一渲染光线投影在上述第一渲染图像上的第一辐射度;Under the above-mentioned target rendering perspective, lighting sampling is performed on the above-mentioned first light source based on the above-mentioned first intersection point, so as to obtain the first intersection point of the first intersection point projected on the above-mentioned first rendered image by the above-mentioned first rendering light ray under the single illumination of the first light source. a radiance;
在上述目标渲染视角下,基于各个第二交点对上述第一光源进行光照采样,得到上述各个第二交点在该第一光源单独光照下由上述第一渲染光线投影在上述第一渲染图像上的各个第二辐射度;Under the above target rendering perspective, lighting sampling is performed on the first light source based on each second intersection point to obtain the projection of each second intersection point on the first rendered image by the first rendering light under the single illumination of the first light source. each second radiance;
根据上述第一辐射度与上述各个第二辐射度之和,获取上述第一交点在上述第一光源单独光照下由上述第一渲染光线投影在上述第一渲染图像上的第一辐照度;According to the sum of the first radiance and each of the second radiances, obtain the first irradiance of the first intersection point projected on the first rendered image by the first rendering light under the single illumination of the first light source;
基于上述第一辐照度以及上述第一交点所在物体的物体属性,确定该第一交点在上述第一光源单独光照下的渲染显示信息;Based on the first irradiance and the object attribute of the object where the first intersection is located, determining the rendering display information of the first intersection under the single illumination of the first light source;
基于上述待渲染场景中的所有第一交点在上述第一光源光照下的渲染显示信息,获取待渲染场景在该第一光源单独光照下对应的第一渲染图像。Based on the rendering display information of all the first intersection points in the scene to be rendered under the illumination of the first light source, a first rendered image corresponding to the scene to be rendered under the single illumination of the first light source is acquired.
结合第一方面第一种可能的实现方式,在第六种可能的实现方式中,上述待渲染场景包括目标交点,该目标交点为目标渲染光线与上述待渲染场景中的任一物体相交于该任一物体的表面上的交点;该目标渲染光线为虚拟渲染相机向上述待渲染场景发出的,该虚拟渲染相机用于确定上述目标渲染视角;In combination with the first possible implementation manner of the first aspect, in a sixth possible implementation manner, the above-mentioned scene to be rendered includes a target intersection point, and the target intersection point is the intersection of the target rendering ray and any object in the above-mentioned scene to be rendered. An intersection point on the surface of any object; the target rendering light is sent by a virtual rendering camera to the scene to be rendered, and the virtual rendering camera is used to determine the target rendering angle of view;
上述在上述目标渲染视角下,基于上述各个光源在上述目标渲染视角下对应的光源采 样权重,对上述待渲染场景执行多光源的光线追踪渲染,得到该待渲染场景在多光源光照下的第二渲染图像具体实现为:In the above-mentioned target rendering perspective, based on the light source sampling weights corresponding to the above-mentioned respective light sources in the above-mentioned target rendering perspective, ray tracing rendering of multiple light sources is performed on the above-mentioned scene to be rendered, and a second ray tracing rendering of the to-be-rendered scene under the illumination of multiple light sources is obtained. The rendered image is specifically implemented as:
在上述目标渲染视角下,基于上述目标交点对上述各个光源进行多次光照采样,其中每次光照采样对应从上述多个光源中选择各个目标光源,该各个目标光源用于对上述目标交点执行多光源的光线追踪渲染,以获取该目标交点在每次光照采样下由上述目标渲染光线投影在上述第二渲染图像上的第二辐照度;其中,选择上述各个目标光源的概率正比于上述各个光源在上述目标渲染视角下的光源采样权重;In the above-mentioned target rendering perspective, multiple illumination samplings are performed on the above-mentioned light sources based on the above-mentioned target intersection points, wherein each illumination sampling corresponds to selecting each target light source from the above-mentioned plurality of light sources, and each target light source is used to perform multiple illumination operations on the above-mentioned target intersection points. The ray tracing rendering of the light source is to obtain the second irradiance of the target intersection point projected by the target rendering light on the second rendering image under each illumination sampling; wherein, the probability of selecting each target light source is proportional to the above The light source sampling weight of the light source in the above-mentioned target rendering perspective;
根据上述目标交点在上述多次光照采样下的各个第二辐照度以及上述目标交点所在物体的物体属性,确定该目标交点在多光源光照下的渲染显示信息;According to each second irradiance of the target intersection under the multiple illumination sampling and the object attribute of the object where the target intersection is located, determine the rendering display information of the target intersection under the illumination of multiple light sources;
根据上述待渲染场景中的所有目标交点在多光源光照下的渲染显示信息,获取上述第二渲染图像。The second rendered image is acquired according to the rendering display information of all target intersections in the scene to be rendered under the illumination of multiple light sources.
结合第一方面第六种可能的实现方式,在第七种可能的实现方式中,上述各个目标光源在上述目标渲染视角下的光源采样权重大于预设阈值。本申请实施例通过设置光源采样权重阈值,可以减少光源的采样数量,从而减少运算量。With reference to the sixth possible implementation manner of the first aspect, in a seventh possible implementation manner, the light source sampling weight of each of the above target light sources in the above target rendering perspective is greater than a preset threshold. By setting the light source sampling weight threshold in the embodiments of the present application, the number of light source samples can be reduced, thereby reducing the amount of computation.
第二方面,本申请实施例提供了一种多光源场景渲染的光源采样权重的确定装置,该装置包括:In a second aspect, an embodiment of the present application provides an apparatus for determining a light source sampling weight for multi-light source scene rendering, the apparatus including:
获取模块,用于以目标渲染视角在多光源场景中获取待渲染场景,并获取上述多光源场景中设置的多个光源;an acquisition module, configured to acquire the scene to be rendered in the multi-light source scene from the target rendering perspective, and acquire the multiple light sources set in the above-mentioned multi-light source scene;
预处理模块,用于在上述目标渲染视角下,对上述获取模块获取到的上述待渲染场景执行单光源的光线追踪渲染,得到上述待渲染场景在各个光源单独光照下对应的各个第一渲染图像;A preprocessing module, configured to perform ray tracing rendering of a single light source on the scene to be rendered acquired by the acquisition module from the perspective of the target rendering, and obtain each first rendered image corresponding to the scene to be rendered under the separate illumination of each light source ;
确定模块,用于根据上述预处理模块得到的上述各个第一渲染图像中的辐照信息,确定上述各个光源在上述目标渲染视角下对应的光源采样权重,上述光源采样权重用于对上述待渲染场景执行多光源的光线追踪渲染。A determination module, configured to determine the light source sampling weights corresponding to the above-mentioned light sources in the above-mentioned target rendering perspective according to the irradiation information in the above-mentioned first rendered images obtained by the above-mentioned preprocessing module, and the above-mentioned light source sampling weights are used for the above-mentioned to-be-rendered. The scene performs ray-traced rendering of multiple lights.
第三方面,本申请实施例提供了一种电子设备,该电子设备包括:处理器和存储器,该处理器和该存储器通过总线系统相连;In a third aspect, an embodiment of the present application provides an electronic device, the electronic device includes: a processor and a memory, the processor and the memory are connected through a bus system;
该存储器用于存储指令;the memory is used to store instructions;
该处理器用于调用上述存储器中存储的指令,执行第一方面或执行结合第一方面任意一种可能实现方式中的方法步骤。The processor is configured to invoke the instructions stored in the above-mentioned memory to execute the first aspect or to execute the method steps in any possible implementation manner in combination with the first aspect.
第四方面,本申请实施例提供了一种计算机程序产品,包括计算机可读指令,当所述计算机可读指令被一个或多个处理器运行时执行上述第一方面或执行结合第一方面任意一种可能实现方式中的方法步骤。In a fourth aspect, the embodiments of the present application provide a computer program product, including computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the above-mentioned first aspect or any combination of the first aspect is performed. Method steps in one possible implementation.
第五方面,本申请实施例提供了一种计算机存储介质,包括计算机可读指令,当所述计算机可读指令被一个或多个处理器运行时执行第一方面或执行结合第一方面任意一种可能实现方式中的方法步骤。In a fifth aspect, embodiments of the present application provide a computer storage medium, including computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the first aspect is executed or any one of the first aspects is executed in combination method steps in a possible implementation.
应理解的是,本申请上述多个方面的实现和有益效果可互相参考。It should be understood that the implementation and beneficial effects of the above-mentioned aspects of the present application may refer to each other.
附图说明Description of drawings
图1为本申请实施例提供的电子设备的一结构框图;FIG. 1 is a structural block diagram of an electronic device provided by an embodiment of the present application;
图2为本申请实施例提供的多光源场景渲染的光源采样权重确定方法的一流程示意图;2 is a schematic flowchart of a method for determining a light source sampling weight for multi-light source scene rendering according to an embodiment of the present application;
图3为双向路径追踪渲染的一光线示意图;3 is a schematic diagram of a ray of bidirectional path tracing rendering;
图4-图5为本申请实施例提供的人机交互示意图;4-5 are schematic diagrams of human-computer interaction provided by the embodiments of the present application;
图6-图8为本申请实施例提供的渲染结果图的示意图;6-8 are schematic diagrams of rendering result diagrams provided by embodiments of the present application;
图9-图14为本申请实施例提供的渲染结果图的渲染细节示意图;9-14 are schematic diagrams of rendering details of rendering result graphs provided by embodiments of the present application;
图15为本申请实施例提供的多光源场景渲染的光源采样权重确定装置的一结构示意图。FIG. 15 is a schematic structural diagram of an apparatus for determining a light source sampling weight for rendering a multi-light source scene according to an embodiment of the present application.
具体实施方式Detailed ways
下面结合附图来对本申请的技术方案的实施作进一步的详细描述。The implementation of the technical solutions of the present application will be further described in detail below with reference to the accompanying drawings.
本申请实施例中提供的多光源场景渲染的光源采样权重确定方法可以由电子设备来执行。该电子设备可以是移动终端(例如智能手机、笔记本、平板电脑等)、车载设备、物联网设备或者其他能够对场景进行渲染的设备。该电子设备可以是运行安卓系统、IOS系统、windows系统以及其他系统的设备。The method for determining the light source sampling weight for multi-light source scene rendering provided in the embodiments of the present application may be executed by an electronic device. The electronic device may be a mobile terminal (for example, a smart phone, a notebook, a tablet computer, etc.), a vehicle-mounted device, an Internet of Things device, or other devices capable of rendering a scene. The electronic device may be a device running an Android system, an IOS system, a windows system, and other systems.
示例性的,该电子设备的具体结构可以如图1所示,下面结合图1对电子设备的具体结构进行详细的介绍。Exemplarily, the specific structure of the electronic device may be shown in FIG. 1 , and the specific structure of the electronic device will be described in detail below with reference to FIG. 1 .
在一些可行的实施方式中,电子设备10可以包括处理器101和存储器102。处理器101中可以包括中央处理器(Central Processing Unit,CPU)和图形处理器(Graphics Processing Unit,GPU)。进一步的,电子设备10还可以包括显示器103。其中电子设备10中的CPU、GPU、存储器102、显示器103等可以通过总线系统(图中未示出)建立通信连接。In some possible implementations, the electronic device 10 may include a processor 101 and a memory 102 . The processor 101 may include a central processing unit (Central Processing Unit, CPU) and a graphics processing unit (Graphics Processing Unit, GPU). Further, the electronic device 10 may further include a display 103 . The CPU, GPU, memory 102, display 103, etc. in the electronic device 10 may establish communication connections through a bus system (not shown in the figure).
可选的,CPU和GPU可以位于同一个芯片,也可以分别为独立的芯片。Optionally, the CPU and the GPU may be located on the same chip, or may be separate chips.
下面对处理器101和存储器102的作用进行简单介绍。The functions of the processor 101 and the memory 102 are briefly introduced below.
处理器101用于运行操作系统1012和应用程序1011。应用程序1011可以为图形类应用程序,比如游戏、视频播放器、3D建模等等。操作系统1012提供了系统接口,应用程序1011通过该系统接口,以及操作系统1012提供的系统驱动,比如用户态驱动和/或内核态驱动,生成用于渲染场景的指令流。进一步的,处理器101还可以生成用于渲染场景的渲染数据。处理器101通过渲染管线(pipeline)生成渲染目标,并将该渲染目标进行缓存,显示在显示器103上。换句话说,处理器可以用于执行本申请实施例提供的多光源场景渲染的光源采样权重的确定方法。The processor 101 is used to run the operating system 1012 and application programs 1011 . The application 1011 may be a graphics application, such as a game, a video player, 3D modeling, and the like. The operating system 1012 provides a system interface, and the application 1011 generates an instruction stream for rendering the scene through the system interface and system drivers provided by the operating system 1012, such as user mode drivers and/or kernel mode drivers. Further, the processor 101 may also generate rendering data for rendering the scene. The processor 101 generates a rendering target through a rendering pipeline, caches the rendering target, and displays the rendering target on the display 103 . In other words, the processor may be configured to execute the method for determining a light source sampling weight for rendering a multi-light source scene provided in this embodiment of the present application.
示例性的,处理器101可以包括但不限于应用处理器、一个或多个微处理器、数字信号处理器(Digital Signal Processing,DSP)、微控制器(microcontroller unit,MCU)或人工智能处理器等。Exemplarily, the processor 101 may include, but is not limited to, an application processor, one or more microprocessors, a digital signal processor (Digital Signal Processing, DSP), a microcontroller (microcontroller unit, MCU) or an artificial intelligence processor. Wait.
在一些可行的实施方式中,操作系统1012和应用程序1011由CPU运行,渲染管线在GPU中运行,GPU获取CPU生成的指令流,并通过渲染管线生成渲染目标,将该渲染目标进行缓存,显示在显示器103上。In some feasible implementations, the operating system 1012 and the application 1011 are run by the CPU, the rendering pipeline runs in the GPU, and the GPU obtains the instruction stream generated by the CPU, generates a rendering target through the rendering pipeline, caches the rendering target, and displays the rendering target. on display 103 .
显示器103用于显示由电子设备10生成的各种渲染图像,该渲染图像可以为操作系统的图形用户界面(graphical user interface,GUI)或由处理器101处理的图像数据。可选地,显示器103可以包括任何合适类型的显示屏。例如液晶显示器(liquidcrystal display,LCD)或等离子显示器或有机发光二极管(organic light-emittingdiode,OLED)显示器等。The display 103 is used to display various rendered images generated by the electronic device 10, and the rendered images may be a graphical user interface (graphical user interface, GUI) of an operating system or image data processed by the processor 101. Alternatively, display 103 may comprise any suitable type of display screen. For example, liquid crystal display (liquid crystal display, LCD) or plasma display or organic light-emitting diode (organic light-emitting diode, OLED) display and so on.
存储器102用于存储指令和渲染数据。存储器102可以为双倍速率同步动态随机存储器(double data rate synchronous dynamic random accessmemory,DDR SDRAM)或者其它类型的缓存。 Memory 102 is used to store instructions and rendering data. The memory 102 may be a double data rate synchronous dynamic random access memory (DDR SDRAM) or other types of cache.
需要说明的是,渲染管线是处理器在渲染场景的过程中顺序执行的一系列操作,例如本申请实施例提供的光线追踪渲染。渲染管线可以运行在CPU和/或GPU中,换句话说,本申请实施例提供的多光源场景渲染的光源采样权重确定方法可以在CPU和/或GPU中实现。It should be noted that the rendering pipeline is a series of operations sequentially performed by the processor in the process of rendering the scene, for example, the ray tracing rendering provided by the embodiments of the present application. The rendering pipeline may run in the CPU and/or the GPU. In other words, the method for determining the light source sampling weight for multi-light source scene rendering provided by the embodiments of the present application may be implemented in the CPU and/or the GPU.
参见图2,图2为本申请实施例提供的多光源场景渲染的光源采样权重确定方法的一流程示意图。如图2所示,本申请实施例的具体执行步骤如下:Referring to FIG. 2 , FIG. 2 is a schematic flowchart of a method for determining a light source sampling weight for multi-light source scene rendering according to an embodiment of the present application. As shown in Figure 2, the specific execution steps of the embodiment of the present application are as follows:
S201、处理器以目标渲染视角在多光源场景中获取待渲染场景,并获取该多光源场景中设置的多个光源。S201. The processor acquires a scene to be rendered in a multi-light source scene from a target rendering perspective, and acquires a plurality of light sources set in the multi-light source scene.
该目标渲染视角是由虚拟渲染相机在多光源场景中的位置确定的。具体实现中,处理器可以根据虚拟渲染相机的位置以及该虚拟渲染相机的性能参数(例如焦距等),获取上述目标渲染视角。该目标渲染视角决定了待渲染场景,不同的目标渲染视角对应的待渲染场景是不同的。需要说明的是,该虚拟渲染相机可以理解为渲染图像最终呈现图像的设备,例如显示器等。该虚拟渲染相机可以实现包括但不限于确定上述目标渲染视角的功能,还可以确定渲染焦距从而确定待渲染场景的视野等。The target rendering perspective is determined by the position of the virtual rendering camera in the multi-light scene. In a specific implementation, the processor may obtain the above-mentioned target rendering angle of view according to the position of the virtual rendering camera and the performance parameters of the virtual rendering camera (for example, the focal length, etc.). The target rendering perspective determines the scene to be rendered, and different target rendering perspectives correspond to different scenes to be rendered. It should be noted that the virtual rendering camera may be understood as a device that renders an image and finally presents an image, such as a display. The virtual rendering camera may implement functions including, but not limited to, determining the above-mentioned target rendering angle of view, and may also determine the rendering focal length so as to determine the field of view of the scene to be rendered.
在一些可行的实施方式中,多光源场景可以具体表现为渲染引擎中的3D模型。In some feasible implementations, the multi-light source scene can be embodied as a 3D model in a rendering engine.
多光源场景中设置有多个光源,获取多个光源可以理解为获取光源的光源属性,例如光源位置、发光强度、发光颜色、光源形状等。示例性的,以(x,y,z)三维坐标标识光源位置,可以将获取到的多个光源的光源属性生成光源列表,如表格1所示。Multiple light sources are set in a multi-light source scene. Obtaining multiple light sources can be understood as obtaining the light source properties of the light sources, such as light source position, luminous intensity, luminous color, and light source shape. Exemplarily, the position of the light source is identified by (x, y, z) three-dimensional coordinates, and a light source list may be generated from the acquired light source properties of multiple light sources, as shown in Table 1.
表格1Table 1
Figure PCTCN2021131989-appb-000001
Figure PCTCN2021131989-appb-000001
S202、在目标渲染视角下,处理器对待渲染场景执行单光源的光线追踪渲染,得到待渲染场景在各个光源单独光照下对应的各个第一渲染图像。S202. From the target rendering perspective, the processor performs ray tracing rendering of a single light source for the scene to be rendered, and obtains each first rendered image corresponding to the scene to be rendered under the separate illumination of each light source.
单光源的光线追踪渲染代表多光源场景中只有一个光源处于开启状态,换句话说,只有一个光源的光源属性参与光线追踪渲染的运算。Ray tracing rendering of a single light source means that only one light source is turned on in a multi-light source scene. In other words, the light source properties of only one light source are involved in the calculation of ray tracing rendering.
需要说明的是,光线追踪渲染包括路径追踪渲染,其中路径追踪渲染包括单向路径追踪渲染和双向路径追踪渲染。在本申请实施例中,单向路径追踪渲染和双向路径追踪渲染均可以得到待渲染图像在各个光源单独光照下对应的各个第一渲染图像。双向路径追踪渲染是从虚拟渲染相机与各个光源分别发出渲染光线,可以快速产生多条光线,进一步加快收敛速度。本申请实施例中的收敛速度包括渲染速度和渲染效果,例如收敛速度快可以理 解为在相同的时间内场景渲染得更加逼真,或者达到相同的渲染效果所用的时间更少。It should be noted that ray tracing rendering includes path tracing rendering, wherein path tracing rendering includes unidirectional path tracing rendering and bidirectional path tracing rendering. In the embodiment of the present application, both the one-way path tracing rendering and the two-way path tracing rendering can obtain each first rendered image corresponding to the to-be-rendered image under the illumination of each light source alone. Bidirectional path tracing rendering is to emit rendering rays from the virtual rendering camera and each light source, which can quickly generate multiple rays and further accelerate the convergence speed. The convergence speed in this embodiment of the present application includes rendering speed and rendering effect. For example, a fast convergence speed can be understood as rendering the scene more realistic in the same time, or it takes less time to achieve the same rendering effect.
为了更好地理解光线追踪渲染,下面以光线追踪渲染具体实现为双向路径追踪渲染为例,结合图3对双向路径追踪渲染的过程进行说明。In order to better understand ray tracing rendering, the following takes the specific implementation of ray tracing rendering as bidirectional path tracing rendering as an example, and describes the process of bidirectional path tracing rendering in conjunction with FIG. 3 .
参见图3,图3为双向路径追踪渲染的一光线示意图。如图3所示,多个光源包括光源1、光源2、光源3等。待渲染场景包括第一交点i和至少一个第二交点(例如第二交点j、第二交点k),第一交点i为第一渲染光线A1与待渲染场景中的第一物体1相交于第一物体1的表面上的交点。第二交点j为第一交点i的反射光线(例如光线④)与待渲染场景中的第二物体2相交于第二物体2表面上的交点。可以理解的是,在双向路径追踪渲染中,第二交点j也可以为光源1发出的光线(即光线②)与待渲染场景中的第二物体2相交于第二物体2表面上的交点,此时第二物体2可以看作是第三物体,即第二物体与第三物体可以是同一个物体。第二交点k为光源1发出的光线(例如光线③)与待渲染场景中的第三物体3相交于第三物体3表面上的交点。Referring to FIG. 3 , FIG. 3 is a schematic diagram of a ray of bidirectional path tracing rendering. As shown in FIG. 3 , the plurality of light sources include light source 1 , light source 2 , light source 3 , and the like. The scene to be rendered includes a first intersection i and at least one second intersection (for example, a second intersection j, a second intersection k), and the first intersection i is the intersection of the first rendering ray A1 and the first object 1 in the scene to be rendered at the first intersection. An intersection on the surface of an object 1. The second intersection point j is the intersection point where the reflected ray (eg, ray ④ ) of the first intersection point i and the second object 2 in the scene to be rendered intersect on the surface of the second object 2 . It can be understood that in the bidirectional path tracing rendering, the second intersection j may also be the intersection point on the surface of the second object 2 where the light emitted by the light source 1 (that is, the light ②) intersects with the second object 2 in the scene to be rendered, At this time, the second object 2 can be regarded as a third object, that is, the second object and the third object can be the same object. The second intersection point k is the intersection point on the surface of the third object 3 where the light (eg, light ③ ) emitted by the light source 1 intersects with the third object 3 in the scene to be rendered.
第一渲染光线A1是由虚拟渲染相机向待渲染场景发出的,可以理解的是,虚拟渲染相机可以向待渲染场景发出多条渲染光线,图3中以发出第一渲染光线A1作出示例,并不应理解为对本申请构成限制。The first rendering ray A1 is sent to the scene to be rendered by the virtual rendering camera. It can be understood that the virtual rendering camera can send multiple rendering rays to the scene to be rendered. In FIG. 3, the first rendering ray A1 is sent as an example, and It should not be construed as limiting the application.
以预先设置第一渲染图像的分辨率是1*1、像素x的采样数(Samples Per Pixel,SPP)是1、第一光源(即光源1)处于开启状态为例。For example, it is assumed that the resolution of the first rendered image is 1*1, the number of samples of pixel x (Samples Per Pixel, SPP) is 1, and the first light source (ie, light source 1 ) is in an on state as an example.
在目标渲染视角下,处理器基于第一交点i对光源1进行光照采样,得到第一交点i在光源1的单独光照下由第一渲染光线A1投影在第一渲染图像上的第一辐射度。In the target rendering perspective, the processor performs illumination sampling on the light source 1 based on the first intersection point i to obtain the first radiance of the first intersection point i projected by the first rendering ray A1 on the first rendered image under the single illumination of the light source 1 .
具体实现中,基于第一交点i的位置信息与光源1的光源位置,确定光线①是否可见,例如,可以基于光源1的光源位置与第一交点i的位置信息进行求交运算,若两者之间的连线没有与待渲染场景中的其他物体,例如第二物体2、第三物体3等相交,即代表光线①是可见的。光源1可以经过光线①直接对第一交点i进行光照,此时第一交点i在光源1单独光照下由第一渲染光线A1投影在第一渲染图像上的第一辐射度L 1可以表示为: In the specific implementation, based on the position information of the first intersection i and the light source position of the light source 1, it is determined whether the light ① is visible. For example, the intersection operation can be performed based on the position information of the light source 1 and the position information of the first intersection i. The lines between them do not intersect with other objects in the scene to be rendered, such as the second object 2, the third object 3, etc., which means that light ① is visible. The light source 1 can directly illuminate the first intersection i through the light ①. At this time, the first radiance L 1 of the first intersection i projected on the first rendered image by the first rendering ray A1 under the single illumination of the light source 1 can be expressed as :
L 1=bsdf 1.cosα 1.L i1(x,w i1)      公式1 L 1 =bsdf 1 .cosα 1 .L i1 (x,w i1 ) Equation 1
其中bsdf 1是双向散射分布函数,由第一物体1的材质决定;α 1是光线①与第一交点i的法线之间的夹角,L i1代表光线①的入射辐射度。 Where bsdf 1 is the bidirectional scattering distribution function, which is determined by the material of the first object 1; α 1 is the angle between the ray ① and the normal of the first intersection i, and L i1 represents the incident radiance of the ray ①.
进一步的,第一交点i可以对光源1的照射进行反射,若第一交点i经过光线④反射至第二物体2,在第二物体2的表面处交于第二交点j。基于第二交点j对光源1进行光照采样,即将该第二交点j的位置信息与光源1的光源位置进行求交运算,若两者之间的连线没有与待渲染场景中的其他物体相交,即代表光线②是可见的。光源1可以经过光线②和光线④对第一交点i进行光照,第二交点j在光源1单独光照下由第一渲染光线A1投影在第一渲染图像上的第二辐射度L 2可以表示为: Further, the first intersection i can reflect the illumination of the light source 1. If the first intersection i is reflected to the second object 2 through the light ④, it intersects at the second intersection j at the surface of the second object 2. Lighting sampling is performed on light source 1 based on the second intersection point j, that is, the position information of the second intersection point j and the light source position of light source 1 are intersected. If the line between the two does not intersect with other objects in the scene to be rendered , which means that light ② is visible. The light source 1 can illuminate the first intersection point i through light rays ② and ray ④, and the second intersection point j is projected by the first rendering ray A1 on the first rendering image under the single illumination of the light source 1. The second radiance L2 can be expressed as :
Figure PCTCN2021131989-appb-000002
Figure PCTCN2021131989-appb-000002
bsdf 2是双向散射分布函数,由第二物体2的材质决定;α 2是光线②与第二交点j的法线之间的夹角,β 1是光线④与第一交点i的法线之间的夹角,L i2代表光线②的入射辐射度,
Figure PCTCN2021131989-appb-000003
是第一概率密度函数,与β 1有关。
bsdf 2 is the bidirectional scattering distribution function, which is determined by the material of the second object 2; α 2 is the angle between the ray ② and the normal of the second intersection j, β 1 is the difference between the ray ④ and the normal of the first intersection i The included angle between , L i2 represents the incident radiance of light ②,
Figure PCTCN2021131989-appb-000003
is the first probability density function, related to β1.
在一些可行的实施方式中,基于双向路径追踪,可以从光源1向第三物体3发出光线③,在第三物体3的表面处交于第二交点k。基于第二交点k对虚拟渲染相机进行光照采样,需要说明的是,由于光路是可逆的,光照采样可以理解为从虚拟渲染相机发出的渲染光线采样光源,或者从光源发出的光线采样虚拟渲染相机。第二交点k经由第一渲染光线A1对虚拟渲染相机采样,即将该第二交点k的位置信息与第一交点i的位置信息进行求交运算,若两者之间的连线没有与待渲染场景中的其他物体相交,即代表光线⑤是可见的,此时光源1可以经过光线③和光线⑤对第一交点i进行光照,第二交点k在光源1单独光照下由第一渲染光线A1投影在第一渲染图像上的第二辐射度L 3可以表示为: In some possible implementations, based on bidirectional path tracing, light ③ may be emitted from the light source 1 to the third object 3 , and intersect at the second intersection point k at the surface of the third object 3 . Light sampling is performed on the virtual rendering camera based on the second intersection point k. It should be noted that since the light path is reversible, lighting sampling can be understood as sampling the light source from the rendering light emitted by the virtual rendering camera, or sampling the virtual rendering camera from the light emitted by the light source. . The second intersection point k samples the virtual rendering camera through the first rendering ray A1, that is, the position information of the second intersection point k and the position information of the first intersection point i are intersected. The intersection of other objects in the scene means that light ⑤ is visible. At this time, light source 1 can illuminate the first intersection i through light ③ and light ⑤, and the second intersection k is illuminated by light source 1 alone by the first rendering light A1 The second radiance L3 projected on the first rendered image can be expressed as:
Figure PCTCN2021131989-appb-000004
Figure PCTCN2021131989-appb-000004
bsdf 3是双向散射分布函数,由第三物体3的材质决定;α 3是光线③与第二交点k的法线之间的夹角,β 2是光线⑤与第一交点i的法线之间的夹角,L i3代表光线③的入射辐射度,
Figure PCTCN2021131989-appb-000005
是第二概率密度函数,与β 2有关。
bsdf 3 is the bidirectional scattering distribution function, which is determined by the material of the third object 3; α 3 is the angle between the ray ③ and the normal of the second intersection k, and β 2 is the angle between the ray ⑤ and the normal of the first intersection i The included angle between , L i3 represents the incident radiance of light ③,
Figure PCTCN2021131989-appb-000005
is the second probability density function, related to β2.
进一步的,将第二交点k的位置信息与第二交点j的位置信息进行求交运算,若两者之间的连线没有与待渲染场景中的其他物体相交,即代表光线⑥是可见的,此时光源1可以经过光线③、光线⑥和光线④对第一交点i进行光照,第二交点k和第二交点j在光源1单独光照下由第一渲染光线A1投影在第一渲染图像上的第二辐射度L 4可以表示为: Further, the intersection operation is performed between the position information of the second intersection k and the position information of the second intersection j. If the connection between the two does not intersect with other objects in the scene to be rendered, it means that the light ⑥ is visible. , at this time, the light source 1 can illuminate the first intersection i through light ③, light ⑥ and light ④, and the second intersection k and the second intersection j are projected on the first rendered image by the first rendering ray A1 under the single illumination of the light source 1 The second radiance L4 on can be expressed as:
Figure PCTCN2021131989-appb-000006
Figure PCTCN2021131989-appb-000006
β 3是光线⑥与第二交点j的法线之间的夹角;
Figure PCTCN2021131989-appb-000007
是第三概率密度函数,与β 3有关。
β 3 is the angle between the ray ⑥ and the normal of the second intersection j;
Figure PCTCN2021131989-appb-000007
is the third probability density function, related to β3.
根据第一辐射度L 1和各个第二辐射度例如L 2、L 3、L 4,获取第一交点i在光源1单独光照下由第一渲染光线A1投影在第一渲染图像上的第一辐照度L为(不考虑物体发光): According to the first radiance L 1 and the respective second radiances such as L 2 , L 3 , L 4 , obtain the first intersection point i projected on the first rendered image by the first rendering ray A1 under the single illumination of the light source 1 The irradiance L is (regardless of object luminescence):
L=L 1+L 2+L 3+L 4      公式5 L=L 1 +L 2 +L 3 +L 4 Equation 5
基于第一辐照度L以及第一交点i所在物体(即第一物体1)的物体属性(例如颜色、材质、角度等),确定第一交点i在光源1单独光照下的渲染显示信息。具体实现中,渲染显示信息包括色彩信息(即RGB表示),将第一辐照度L乘以第一物体1的RGB表示,从而得到第一交点i在光源1单独光照下的RGB表示。Based on the first irradiance L and the object attributes (such as color, material, angle, etc.) of the object where the first intersection i is located (ie, the first object 1 ), the rendering display information of the first intersection i under the single illumination of the light source 1 is determined. In a specific implementation, the rendering display information includes color information (ie, RGB representation), and the first irradiance L is multiplied by the RGB representation of the first object 1 to obtain the RGB representation of the first intersection i under the single illumination of the light source 1 .
由于预先设置的第一渲染图像的分辨率是1*1,采样数是1SPP,所以第一交点i在光源1单独光照下的RGB表示即为第一渲染图像的RGB表示,由第一渲染图像的RGB表示即可以得到第一渲染图像。Since the preset resolution of the first rendered image is 1*1 and the number of samples is 1SPP, the RGB representation of the first intersection i under the single illumination of light source 1 is the RGB representation of the first rendered image. The RGB representation of , that is, the first rendered image can be obtained.
需要说明的是,若预先设置第一渲染图像的采样数大于1SPP。换句话说,为了得到像素x的色彩信息,虚拟渲染相机向待渲染图像发出多条渲染光线,渲染光线的数量等于采样数。比如预先设置第一渲染图像的采样数是10SPP,则虚拟相机向待渲染图像发出10条渲染光线,与待渲染场景中的物体产生10个第一交点,每个第一交点辐照度的计算与第一交点i的辐照度计算类似,将待渲染场景中的所有第一交点的辐照度分别与各自所在物体 的物体属性相乘,分别得到待渲染场景中的所有第一交点在光源1光照下的渲染显示信息。同理的,渲染显示信息包括色彩信息(即RGB表示),将多个第一交点在光源1单独光照下的各个RGB表示进行相加后取平均值,作为像素x的RGB表示。It should be noted that, if the preset number of samples of the first rendered image is greater than 1SPP. In other words, in order to obtain the color information of pixel x, the virtual rendering camera sends out multiple rendering rays to the image to be rendered, and the number of rendering rays is equal to the number of samples. For example, if the sampling number of the first rendered image is preset to 10SPP, the virtual camera sends 10 rendering rays to the image to be rendered, and generates 10 first intersection points with the objects in the scene to be rendered. The calculation of the irradiance of each first intersection point Similar to the irradiance calculation of the first intersection i, the irradiances of all the first intersections in the scene to be rendered are multiplied by the object attributes of their respective objects, respectively, and all the first intersections in the scene to be rendered are obtained. 1 Rendering display information under lighting. Similarly, the rendering display information includes color information (ie, RGB representation). The RGB representations of the multiple first intersection points under the single illumination of the light source 1 are added and the average is taken as the RGB representation of the pixel x.
在一些可行的实施方式中,若预先设置的第一渲染图像的分辨率是1*1,则像素x的RGB表示即为第一渲染图像的RGB表示,由第一渲染图像的RGB表示即可以得到第一渲染图像。In some possible implementations, if the preset resolution of the first rendered image is 1*1, the RGB representation of the pixel x is the RGB representation of the first rendered image, and the RGB representation of the first rendered image can be Get the first rendered image.
可选的,在一些可行的实施方式中,若预先设置的第一渲染图像的分辨率大于1*1,即第一渲染图像中包括多个像素x,则可以将多个像素x的RGB表示进行相加,作为第一渲染图像的RGB表示。可选的,也可以将多个像素x的RGB表示相加后取平均值,作为第一渲染图像的RGB表示。由第一渲染图像的RGB表示即可以得到第一渲染图像。Optionally, in some feasible implementation manners, if the preset resolution of the first rendered image is greater than 1*1, that is, the first rendered image includes multiple pixels x, the RGB of the multiple pixels x may be represented. Addition is made as the RGB representation of the first rendered image. Optionally, the RGB representations of multiple pixels x may also be added and then averaged, and used as the RGB representation of the first rendered image. The first rendered image can be obtained from the RGB representation of the first rendered image.
可以理解的是,上文以只开启光源1为例对单光源的光线追踪渲染过程进行示例性说明,本申请实施例可以依次开启待渲染场景中的各个光源,每次只开启一个光源,例如只开启光源2,多光源场景中除光源2之外的其他光源均关闭。光源2的单光源光线追踪渲染的具体实现方式可以参考只开启光源1的实现方式,由此可以得到待渲染场景在各个光源单独光照下对应的各个第一渲染图像。此时,处理器可以获取第一渲染图像的图像信息,例如色彩信息(即RGB表示)、亮度信息(即YUV表示)等。It can be understood that the above example illustrates the ray tracing rendering process of a single light source by taking only the light source 1 on as an example. In this embodiment of the present application, each light source in the scene to be rendered can be turned on in sequence, and only one light source is turned on at a time. For example, Only light source 2 is turned on, and all other light sources except light source 2 in the multi-light source scene are turned off. For the specific implementation of the single light source ray tracing rendering of the light source 2, refer to the implementation of only turning on the light source 1, so that each first rendered image corresponding to the scene to be rendered under the independent illumination of each light source can be obtained. At this time, the processor may acquire image information of the first rendered image, such as color information (ie, RGB representation), luminance information (ie, YUV representation), and the like.
S203、处理器根据各个第一渲染图像中的辐照信息,确定各个光源在目标渲染视角下对应的光源采样权重。S203: The processor determines, according to the irradiation information in each first rendered image, the light source sampling weight corresponding to each light source in the target rendering perspective.
在一些可行的实施方式中,各个第一渲染图像中的辐照信息为基于各个第一渲染图像对应的亮度信息而确定的,其中各个第一渲染图像的亮度信息为基于各个第一渲染图像中的色彩信息得到的。示例性的,处理器可以获取各个第一渲染图像的RGB表示,将各个第一渲染图像的RGB表示转换为YUV表示,并将各个第一渲染图像的亮度信息(即Y值)作为各个光源在目标渲染视角下对应的光源采样权重。其中各个第一渲染图像的亮度信息分别与各个光源一一对应,将各个第一渲染图像的亮度信息作为对应光源的光源采样权重,进一步的,可以对各个光源的光源采样权重进行归一化处理,即将各个光源的光源采样权重转换到0至1的范围内。示例性的,可以将各个光源的光源采样权重与表格1中的光源属性关联,得到新的光源列表如表格2所示。In some feasible implementations, the irradiation information in each first rendered image is determined based on brightness information corresponding to each first rendered image, wherein the brightness information of each first rendered image is determined based on the brightness information in each first rendered image obtained from the color information. Exemplarily, the processor may acquire the RGB representation of each first rendered image, convert the RGB representation of each first rendered image into a YUV representation, and use the brightness information (ie, the Y value) of each first rendered image as each light source in the The corresponding light source sampling weight in the target rendering perspective. The brightness information of each first rendered image is in one-to-one correspondence with each light source, and the brightness information of each first rendered image is used as the light source sampling weight of the corresponding light source. Further, the light source sampling weight of each light source may be normalized. , that is, convert the light source sampling weight of each light source to the range of 0 to 1. Exemplarily, the light source sampling weight of each light source may be associated with the light source attribute in Table 1, and a new light source list is obtained as shown in Table 2.
表格2 Form 2
Figure PCTCN2021131989-appb-000008
Figure PCTCN2021131989-appb-000008
本申请实施例根据各个光源对待渲染场景进行单光源光线追踪渲染后得到的各个第一渲染图像的辐照信息,确定对应各个光源的光源采样权重,该光源采样权重可以使得多光源光线追踪渲染过程中选择到光源采样权重较大对应的光源的概率变大。实施本申请实施 例,可以在多光源光线追踪渲染过程中选择到更合适的光源,从而加快多光源场景渲染的收敛速度。In this embodiment of the present application, the light source sampling weight corresponding to each light source is determined according to the irradiance information of each first rendered image obtained after each light source performs single light source ray tracing rendering on the scene to be rendered, and the light source sampling weight can make the multi-light source ray tracing rendering process The probability of selecting a light source corresponding to a larger light source sampling weight increases. By implementing the embodiments of the present application, a more suitable light source can be selected during the multi-light source ray tracing rendering process, thereby accelerating the convergence speed of multi-light source scene rendering.
进一步的,基于步骤S203得到各个光源在目标渲染视角下对应的光源采样权重,处理器可以在目标渲染视角下对待渲染场景执行多光源的光线追踪渲染,得到待渲染场景在多光源光照下的第二渲染图像。Further, based on step S203 to obtain the light source sampling weights corresponding to each light source in the target rendering perspective, the processor may perform ray tracing rendering of multiple light sources in the scene to be rendered in the target rendering perspective, and obtain the first ray tracing rendering of the scene to be rendered under the illumination of multiple light sources. 2. Render the image.
具体实现中,多光源场景中的多个光源处于开启状态。虚拟渲染相机向待渲染场景发出目标渲染光线,该目标渲染光线与待渲染场景中的任一物体相交于该任一物体的表面上的交点,即为目标交点。在目标渲染视角下,基于该目标交点对各个光源进行多次光照采样,获取目标交点在每次光照采样下的辐照度。可以理解的是,与基于第一交点对第一光源进行单光源光照采样不同,此时不止一个光源处于开启状态,基于该目标交点对各个光源进行多次光照采样,每次光照采样对应从多个光源中选择各个目标光源,每次光照采样选择到的各个目标光源不一定是同一个组合,例如按照表格2中光源与光源采样权重之间的关系,可以是选择到光源1和光源2或者选择到光源2和光源3或者选择到光源1、光源2和光源3等,由于光源2的光源采样权重是最大的,所以选择光源2的概率要大于选择光源1和光源3的概率。换句话说,选择各个目标光源的概率正比于各个光源在目标渲染视角下的光源采样权重。处理器获取目标交点在每次光照采样下由目标渲染光线投影在第二渲染图像上的第二辐照度可以参考第一辐照度的获取方式。In a specific implementation, multiple light sources in the multi-light source scene are in an on state. The virtual rendering camera emits a target rendering ray to the scene to be rendered, and the intersection of the target rendering ray and any object in the to-be-rendered scene on the surface of any object is the target intersection point. From the target rendering perspective, multiple lighting samples are performed on each light source based on the target intersection, and the irradiance of the target intersection under each lighting sampling is obtained. It can be understood that, unlike the single light source illumination sampling performed on the first light source based on the first intersection point, more than one light source is turned on at this time, and each light source is subjected to multiple illumination sampling based on the target intersection point. Each target light source is selected from each light source, and each target light source selected for each lighting sampling is not necessarily the same combination. Select light source 2 and light source 3 or select light source 1, light source 2 and light source 3, etc. Since the light source sampling weight of light source 2 is the largest, the probability of selecting light source 2 is greater than the probability of selecting light source 1 and light source 3. In other words, the probability of selecting each target light source is proportional to the light sampling weight of each light source in the target rendering perspective. When the processor obtains the second irradiance of the target intersection point projected by the target rendering ray on the second rendered image under each illumination sampling, reference may be made to the acquisition method of the first irradiance.
可选的,本申请实施例中执行多光源的光线追踪渲染可以是单向路径追踪渲染,也可以是双向路径追踪渲染。Optionally, in the embodiment of the present application, the ray tracing rendering of multiple light sources may be unidirectional path tracing rendering, or may be bidirectional path tracing rendering.
根据目标交点在多次光照采样下的各个第二辐照度以及该目标交点所在物体的物体属性,确定目标交点在多光源光照下的渲染显示信息,其中渲染显示信息可以包括色彩信息(即RGB表示)。示例性的,将目标交点在每次光照采样下的辐照度进行相加取平均值,作为该目标交点在多光源光照下的辐照度。将该目标交点在多光源光照下的辐照度乘以该目标交点所在所在物体的RGB表示,从而得到该目标交点在多光源光照下的RGB表示。According to each second irradiance of the target intersection under multiple illumination sampling and the object attributes of the object where the target intersection is located, determine the rendering display information of the target intersection under multi-light source illumination, where the rendering display information may include color information (ie, RGB express). Exemplarily, the irradiance of the target intersection point under each illumination sampling is added and averaged, as the irradiance of the target intersection point under the illumination of multiple light sources. Multiply the irradiance of the target intersection point under multi-light source illumination by the RGB representation of the object where the target intersection point is located, so as to obtain the RGB representation of the target intersection point under multi-light source illumination.
将待渲染场景中的所有目标交点在多光源光照下的渲染显示信息(例如RGB表示)进行相加取平均值,得到第二渲染图像的RGB表示,由该第二渲染图像的RGB表示即可以获取第二渲染图像。The rendering display information (such as RGB representation) of all target intersections in the scene to be rendered under the illumination of multiple light sources is added and averaged to obtain the RGB representation of the second rendered image. The RGB representation of the second rendered image can be Get the second rendered image.
本申请实施例,基于各个光源的光源采样权重,在光线追踪渲染过程中选择到光源采样权重较大对应的光源的概率变大,可以加快多光源场景渲染的收敛速度。In the embodiment of the present application, based on the light source sampling weight of each light source, the probability of selecting a light source corresponding to a larger light source sampling weight increases during the ray tracing rendering process, which can speed up the convergence speed of multi-light source scene rendering.
进一步的,各个目标光源在目标渲染视角下的光源采样权重大于预设阈值。换句话说,处理器通过设置预设阈值对各个光源进行剔除,示例性的,预设阈值为0.3,则光源采样权重不大于0.3的光源(例如表格3中的光源1)不在光线追踪渲染的光源选择范围内,即光源1不参与光线追踪渲染的运算。本申请实施例通过设置光源采样权重阈值,可以减少光源的采样数量,从而减少处理器的运算量。Further, the light source sampling weight of each target light source in the target rendering perspective is greater than the preset threshold. In other words, the processor culls each light source by setting a preset threshold. Exemplarily, the preset threshold is 0.3, and the light source whose light source sampling weight is not greater than 0.3 (for example, light source 1 in Table 3) is not rendered by ray tracing. Within the light source selection range, that is, light source 1 does not participate in the calculation of ray tracing rendering. By setting the light source sampling weight threshold in the embodiments of the present application, the number of light source samples can be reduced, thereby reducing the computational complexity of the processor.
在一些可行的实施方式中,上述各个第一渲染图像的分辨率均小于第二渲染图像的分辨率。本申请实施例在正式渲染之前通过设置第一渲染图像为较小分辨率图像,计算各个光源的光源采样权重,可以减少处理器的运算量,提高渲染速度。In some feasible implementation manners, the resolution of each of the above-mentioned first rendered images is smaller than the resolution of the second rendered images. In this embodiment of the present application, the first rendered image is set to be a smaller resolution image, and the light source sampling weight of each light source is calculated before the official rendering, which can reduce the calculation amount of the processor and improve the rendering speed.
下面结合图4至图14介绍本申请的一些人机交互实施例。Some human-computer interaction embodiments of the present application are described below with reference to FIGS. 4 to 14 .
在本申请的一些实施例中,电子设备可以设置有渲染预处理模式,用户可以根据需要开启该渲染预处理模式。开启该渲染预处理模式即为实施本申请实施例提供的多光源场景渲染的光源采样权重方法。电子设备开启该渲染预处理模式之后,可以加快多光源场景渲染的收敛速度。In some embodiments of the present application, the electronic device may be set with a rendering preprocessing mode, and the user may enable the rendering preprocessing mode as required. Turning on the rendering preprocessing mode is to implement the light source sampling weight method for multi-light source scene rendering provided by the embodiment of the present application. After the electronic device enables the rendering preprocessing mode, the convergence speed of the multi-light source scene rendering can be accelerated.
示例性的,图4示出了一种可能的用户开启渲染预处理模式的人机交互图。如图4所示,电子设备的屏幕可以显示三维动画制作软件(例如Blender软件)的渲染界面,该渲染界面包括多光源场景40和设置界面41,以多光源场景40是一栋居民楼为例,在居民楼的各个楼层中都设有光源。可以理解的是,居民楼的墙体、地板、光源等是在3D建模的过程中设置好的,本申请实施例基于Blender软件对3D建模得到的模型(即多光源场景40)进行渲染。电子设备可以响应于用户对设置界面41中的虚拟渲染相机的点击操作、拖动操作等,获取虚拟渲染相机的放置位置。基于虚拟渲染相机的放置位置以及该虚拟渲染相机的性能参数(例如焦距等),确定目标渲染视角。处理器以该目标渲染视角在多光源场景40中获取待渲染场景,例如虚拟渲染相机的放置位置为居民楼中的一个房间,电子设备的屏幕可以显示如图5所示的待渲染场景50。在一些可行的实施方式中,设置界面41还可以包括其他信息,比如多光源场景中各个物体的形状信息、属性、渲染时间等。Exemplarily, FIG. 4 shows a possible human-computer interaction diagram in which the user turns on the rendering preprocessing mode. As shown in FIG. 4 , the screen of the electronic device can display a rendering interface of 3D animation production software (such as Blender software), the rendering interface includes a multi-light source scene 40 and a setting interface 41 , and the multi-light source scene 40 is a residential building as an example , there are light sources on each floor of the residential building. It can be understood that the walls, floors, light sources, etc. of the residential building are set during the 3D modeling process, and the embodiment of the present application renders the model obtained by the 3D modeling (ie, the multi-light source scene 40 ) based on the Blender software. . The electronic device may acquire the placement position of the virtual rendering camera in response to the user's click operation, drag operation, etc. on the virtual rendering camera in the setting interface 41 . Based on the placement position of the virtual rendering camera and performance parameters (eg, focal length, etc.) of the virtual rendering camera, the target rendering angle of view is determined. The processor obtains the scene to be rendered in the multi-light source scene 40 from the target rendering perspective. For example, the placement position of the virtual rendering camera is a room in a residential building, and the screen of the electronic device can display the scene to be rendered 50 as shown in FIG. 5 . In some feasible implementation manners, the setting interface 41 may further include other information, such as shape information, attributes, rendering time, etc. of each object in the multi-light source scene.
电子设备还可以响应于用户在设置界面41中输入的分辨率设置,此处设置的分辨率是待渲染场景在多光源光照下经过光线追踪渲染之后得到的第二图像的分辨率。The electronic device may also respond to the resolution setting input by the user in the setting interface 41, where the resolution set here is the resolution of the second image obtained after the scene to be rendered is rendered by ray tracing under the illumination of multiple light sources.
设置界面41还包括渲染预处理模式是否开启的选项,示例性的,电子设备还可以响应于用户勾选光源采样权重预处理的选择,即开启渲染预处理模式。The setting interface 41 further includes an option of whether to enable the rendering preprocessing mode. Exemplarily, the electronic device may also enable the rendering preprocessing mode in response to the user checking the selection of light source sampling weight preprocessing.
当渲染预处理模式开启之后,电子设备将首先对待渲染场景50执行单光源的光线追踪渲染,示例性的,电子设备依次开启单个光源,分别对待渲染场景50执行双向路径追踪渲染,得到待渲染场景50在各个光源单独光照下对应的各个第一渲染图像,基于各个第一渲染图像中的辐照信息(例如各个第一渲染图像的Y值),确定各个光源的光源采样权重。电子设备得到各个光源的光源采样权重之后,开启多光源场景40中的所有光源,对待渲染场景50执行多光源的光线追踪渲染,例如可以是双向路径追踪渲染,得到待渲染场景在多光源光照下的第二渲染图像。示例性的,电子设备可以响应用户设置的渲染时间,例如渲染时间为60s。或者电子设备基于默认的渲染时间,对待渲染场景50执行多光源的光线追踪渲染,得到如图6所示的渲染结果图(即第二渲染图像)。After the rendering preprocessing mode is turned on, the electronic device will first perform ray tracing rendering of a single light source on the scene 50 to be rendered. Exemplarily, the electronic device turns on the single light source in turn, and respectively performs bidirectional path tracing rendering on the scene to be rendered 50 to obtain the scene to be rendered. 50 Determine the light source sampling weight of each light source based on the irradiation information in each first rendered image (eg, the Y value of each first rendered image) for each first rendered image corresponding to each light source individually illuminated. After the electronic device obtains the light source sampling weight of each light source, it turns on all the light sources in the multi-light source scene 40, and performs ray tracing rendering of the multi-light source in the scene to be rendered 50, for example, bidirectional path tracing rendering, and obtains the scene to be rendered under the illumination of multiple light sources. of the second rendered image. Exemplarily, the electronic device may respond to the rendering time set by the user, for example, the rendering time is 60s. Or, based on the default rendering time, the electronic device performs ray tracing rendering of multiple light sources on the scene 50 to be rendered, and obtains the rendering result diagram (ie, the second rendered image) as shown in FIG. 6 .
为了说明本申请实施例提供的多光源场景渲染的光源采样权重确定方法可以加快多光源场景渲染的收敛速度,本申请的发明人做了对比试验,关闭渲染预处理模式(即不勾选光源采样权重的选项)。在与渲染预处理模式开启时的渲染时间相同的情况下,例如渲染时间也为60s。开启多光源场景40中的所有光源,电子设备基于默认的光源采样权重对待渲染场景50执行多光源的光线追踪渲染,得到如图7所示的渲染结果图。进一步的,可以在关闭渲染预处理模式,但在足够长的渲染时间,例如渲染时间为2h,电子设备基于默认的光源采样权重,开启多光源场景40中的所有光源,对待渲染场景50执行多光源的光线追踪渲染,得到如图8所示的渲染结果图。此时可以认为图8示出的渲染结果图是接近于真实图像的效果,即可以将图8作为待渲染场景的参考渲染结果图。In order to illustrate that the method for determining the light source sampling weight for multi-light source scene rendering provided by the embodiment of the present application can speed up the convergence speed of multi-light source scene rendering, the inventor of the present application has conducted a comparative experiment, turning off the rendering preprocessing mode (that is, not checking light source sampling weight options). In the same case as the rendering time when the rendering preprocessing mode is turned on, for example, the rendering time is also 60s. All light sources in the multi-light source scene 40 are turned on, and the electronic device performs ray tracing rendering of the multi-light source in the scene 50 to be rendered based on the default light source sampling weight, and the rendering result diagram as shown in FIG. 7 is obtained. Further, the rendering preprocessing mode can be turned off, but when the rendering time is long enough, for example, the rendering time is 2h, the electronic device turns on all the light sources in the multi-light source scene 40 based on the default light source sampling weight, and executes multiple functions in the scene 50 to be rendered. The ray tracing rendering of the light source, the rendering result shown in Figure 8 is obtained. At this time, it can be considered that the rendering result graph shown in FIG. 8 is an effect close to the real image, that is, FIG. 8 can be used as a reference rendering result graph of the scene to be rendered.
由图6和图7示出的渲染结果图对比可知,实施本申请实施例提供的多光源场景渲染的光源采样权重确定方法,在相同的渲染时间内,本申请实施例得到的第二渲染图像更加逼真,噪点也较少。并且由图6和图8示出的渲染结果对比图可知,实施本申请实施例提供的多光源场景渲染的光源采样权重确定方法,可以在较短的时间内达到与参考渲染结果图相同的渲染效果。即实施本申请实施例可以加快多光源场景渲染的收敛速度。It can be seen from the comparison of the rendering result graphs shown in FIG. 6 and FIG. 7 that, by implementing the method for determining the light source sampling weight for multi-light source scene rendering provided by the embodiment of the present application, within the same rendering time, the second rendered image obtained by the embodiment of the present application is obtained. More realistic and less noisy. And it can be seen from the comparison diagrams of rendering results shown in FIG. 6 and FIG. 8 that implementing the method for determining the light source sampling weight for multi-light source scene rendering provided by the embodiment of the present application can achieve the same rendering as the reference rendering result diagram in a relatively short period of time. Effect. That is, by implementing the embodiments of the present application, the convergence speed of multi-light source scene rendering can be accelerated.
进一步的,为了更清楚直观地呈现实施本申请达到的渲染效果,本申请还提供了渲染结果图的渲染细节示意图。参见图9至图14。Further, in order to more clearly and intuitively present the rendering effect achieved by implementing the present application, the present application also provides a schematic diagram of rendering details of the rendering result graph. See Figures 9 to 14.
需要首先说明的是,图9和图12是图6中示出的渲染结果图的渲染细节示意图;图10和图13是图7示出的渲染结果图的渲染细节示意图;图11和图14是图8示出的渲染结果图的渲染细节示意图。图9、图10和图11构成一组对比组合,图12、图13和图14构成另一组对比组合,可以理解的是,一组对比组合说明该组合内所有示出的渲染结果图是针对同一细节(即同一物体)渲染得到的。根据图9与图10、图12与图13示出的渲染结果图对比,可以更加明显地看出在相同的渲染时间内,实施本申请实施例得到的第二渲染图像更加逼真。It should be noted first that Figures 9 and 12 are schematic diagrams of rendering details of the rendering result diagram shown in Figure 6; Figures 10 and 13 are schematic diagrams of rendering details of the rendering result diagram shown in Figure 7; Figures 11 and 14 It is a schematic diagram of rendering details of the rendering result graph shown in FIG. 8 . Figure 9, Figure 10, and Figure 11 constitute a set of comparison combinations, and Figures 12, 13, and 14 constitute another set of comparison combinations. It can be understood that a set of comparison combinations indicates that all the rendering results shown in the combination are Rendered for the same detail (ie the same object). According to the comparison of the rendering result graphs shown in FIG. 9 with FIG. 10 and FIG. 12 with FIG. 13 , it can be more clearly seen that within the same rendering time, the second rendered image obtained by implementing the embodiment of the present application is more realistic.
根据图9与图11、图12与图14,也可以更加明显地看出实施本申请得到的渲染结果与参考渲染结果图的差别不大,可以近似于认为实施本申请实施例可以在较短的时间内达到与参考渲染结果图相同的渲染效果。即实施本申请实施例可以加快多光源场景渲染的收敛速度。According to FIG. 9 and FIG. 11 , FIG. 12 and FIG. 14 , it can also be more clearly seen that the rendering result obtained by implementing the present application is not much different from the reference rendering result graph. to achieve the same rendering effect as the reference rendering result image within the time. That is, by implementing the embodiments of the present application, the convergence speed of multi-light source scene rendering can be accelerated.
示例性的,除了采用上述渲染结果图的逼真度衡量多光源场景渲染的收敛速度之外,还可以采用量化数据来对多光源场景渲染的收敛速度进行衡量。该量化数据可以包括但不限于峰值信噪比(peak signal-to-noise ratio,PSNR)、结构相似性(structural similarity,SSIM)、均方根误差(root-mean-square error,RMSE)等。在其他渲染条件相同的情况下(例如渲染时间相同,渲染视角相同等),实施本申请实施例(即开启渲染预处理模式)与不开启渲染预处理模式的量化数据对比可以如表格3所示。Exemplarily, in addition to using the fidelity of the above rendering result graph to measure the convergence speed of multi-light source scene rendering, quantitative data may also be used to measure the convergence speed of multi-light source scene rendering. The quantized data may include but not limited to peak signal-to-noise ratio (peak signal-to-noise ratio, PSNR), structural similarity (structural similarity, SSIM), root-mean-square error (root-mean-square error, RMSE) and the like. When other rendering conditions are the same (for example, the rendering time is the same, the rendering angle of view is the same, etc.), the comparison of the quantitative data between the embodiment of the present application (that is, the rendering preprocessing mode is turned on) and the rendering preprocessing mode not turned on can be shown in Table 3. .
表格3 Form 3
Figure PCTCN2021131989-appb-000009
Figure PCTCN2021131989-appb-000009
需要说明的是,PSNR的数值越大表示渲染图像与参考渲染结果图越接近;SSIM的数值越大也可以表示渲染图像与参考渲染结果图越接近;RMSE的数值越小表示渲染图像与参考渲染结果图误差越小。此处参考渲染图像分别为图8、图11和图14,由表格3中的量化数据可以得到,开启渲染预处理模式得到的渲染图形比不开启渲染预处理模式得到的渲染图像更接近参考渲染图像。即实施本申请实施例可以加快多光源场景渲染的收敛速度。It should be noted that the larger the value of PSNR is, the closer the rendered image is to the reference rendering result image; the larger the value of SSIM, the closer the rendered image is to the reference rendering result image; the smaller the value of RMSE, the closer the rendered image is to the reference rendering image. The resulting graph error is smaller. The reference rendering images are shown in Figure 8, Figure 11, and Figure 14, respectively, which can be obtained from the quantified data in Table 3. The rendered image obtained by enabling the rendering preprocessing mode is closer to the reference rendering than the rendered image obtained by not enabling the rendering preprocessing mode. image. That is, by implementing the embodiments of the present application, the convergence speed of multi-light source scene rendering can be accelerated.
参见图15,图15为本申请实施例提供的多光源场景渲染的光源采样权重确定装置的一结构示意图。如图15所示,多光源场景渲染的光源采样权重确定装置150包括:Referring to FIG. 15 , FIG. 15 is a schematic structural diagram of an apparatus for determining a light source sampling weight for rendering a multi-light source scene according to an embodiment of the present application. As shown in FIG. 15 , the device 150 for determining light source sampling weights for multi-light source scene rendering includes:
获取模块1500,用于以目标渲染视角在多光源场景中获取待渲染场景,并获取该多光源场景中设置的多个光源;an acquisition module 1500, configured to acquire the scene to be rendered in the multi-light source scene from the target rendering perspective, and acquire a plurality of light sources set in the multi-light source scene;
预处理模块1501,用于在目标渲染视角下,对获取模块1500获取到的待渲染场景执行单光源的光线追踪渲染,得到该待渲染场景在各个光源单独光照下对应的各个第一渲染图像;The preprocessing module 1501 is configured to perform ray tracing rendering of a single light source on the scene to be rendered acquired by the acquisition module 1500 under the target rendering perspective, and obtain each first rendered image corresponding to the scene to be rendered under the separate illumination of each light source;
确定模块1502,用于根据预处理模块1501中得到的各个第一渲染图像中的辐照信息,确定各个光源在目标渲染视角下对应的光源采样权重,该光源采样权重用于对待渲染场景执行多光源的光线追踪渲染。The determining module 1502 is configured to determine the light source sampling weight corresponding to each light source in the target rendering perspective according to the irradiance information in each first rendered image obtained in the preprocessing module 1501, and the light source sampling weight is used to perform multi-processing on the scene to be rendered. Raytraced rendering of light sources.
进一步的,多光源场景渲染的光源采样权重确定装置150还包括处理模块1503;Further, the device 150 for determining the light source sampling weight for multi-light source scene rendering further includes a processing module 1503;
处理模块1503,用于在目标渲染视角下,基于确定模块1502确定的各个光源在目标渲染视角下对应的光源采样权重,对待渲染场景执行多光源的光线追踪渲染;The processing module 1503 is configured to perform ray tracing rendering of multiple light sources in the scene to be rendered based on the light source sampling weights corresponding to each light source in the target rendering perspective determined by the determining module 1502 under the target rendering perspective;
获取模块1500,还用于获取待渲染场景在多光源光照下的第二渲染图像。The obtaining module 1500 is further configured to obtain a second rendered image of the scene to be rendered under the illumination of multiple light sources.
在一些可行的实施方式中,确定模块1502,还用于基于各个第一渲染图像对应的亮度信息确定各个第一渲染图像中的辐照信息,其中各个第一渲染图像的亮度信息为基于各个第一渲染图像中的色彩信息转换得到。In some feasible implementation manners, the determining module 1502 is further configured to determine irradiation information in each first rendered image based on brightness information corresponding to each first rendered image, wherein the brightness information of each first rendered image is based on each first rendered image. The color information in a rendered image is converted.
在一些可行的实施方式中,上述多个光源包括第一光源;上述待渲染场景包括第一交点和至少一个第二交点,该第一交点为第一渲染光线与待渲染场景中的第一物体相交于该第一物体的表面上的交点,该第二交点为该第一交点的反射光线与待渲染场景中的第二物体相交于该第二物体表面上的交点和/或上述各个光源发出的光线分别与待渲染场景中的各个第三物体相交于该各个第三物体表面上的交点;该第一渲染光线为虚拟渲染相机向上述待渲染场景发出的,该虚拟渲染相机用于确定上述目标渲染视角;In some feasible implementation manners, the plurality of light sources include a first light source; the scene to be rendered includes a first intersection and at least one second intersection, where the first intersection is the first rendering ray and the first object in the scene to be rendered The intersection point on the surface of the first object, the second intersection point is the intersection point where the reflected ray of the first intersection point and the second object in the scene to be rendered intersect on the surface of the second object and/or the above-mentioned light sources emit The ray of light intersects each third object in the scene to be rendered at the intersection on the surface of each third object; the first rendering ray is sent by the virtual rendering camera to the above scene to be rendered, and the virtual rendering camera is used to determine the above target rendering perspective;
获取模块1500,还用于在目标渲染视角下,基于第一交点对第一光源进行光照采样,得到第一交点在第一光源单独光照下由第一渲染光线投影在上述第一渲染图像上的第一辐射度;The acquiring module 1500 is further configured to perform illumination sampling on the first light source based on the first intersection point under the target rendering perspective, to obtain the first intersection point projected on the above-mentioned first rendered image by the first rendering light under the single illumination of the first light source. first radiance;
预处理模块1501,还用于在目标渲染视角下,基于各个第二交点对第一光源进行光照采样,得到各个第二交点在第一光源单独光照下由第一渲染光线投影在上述第一渲染图像上的各个第二辐射度;The preprocessing module 1501 is further configured to perform illumination sampling on the first light source based on each second intersection point under the target rendering perspective, and obtain each second intersection point under the single illumination of the first light source by the first rendering light projected on the above-mentioned first rendering each second radiance on the image;
获取模块1500,还用于根据第一辐射度与各个第二辐射度之和,获取第一交点在第一光源单独光照下由第一渲染光线投影在上述第一渲染图像上的第一辐照度;The obtaining module 1500 is further configured to obtain, according to the sum of the first radiance and each second radiance, the first irradiance of the first intersection point projected on the above-mentioned first rendered image by the first rendering light under the single illumination of the first light source Spend;
确定模块1502,还用于基于上述第一辐照度以及第一交点所在物体的物体属性,确定第一交点在第一光源单独光照下的渲染显示信息;The determining module 1502 is further configured to determine the rendering display information of the first intersection under the single illumination of the first light source based on the above-mentioned first irradiance and the object attribute of the object where the first intersection is located;
获取模块1500,还用于基于待渲染场景中的所有第一交点在第一光源光照下的渲染显示信息,获取待渲染场景在第一光源单独光照下对应的第一渲染图像。The obtaining module 1500 is further configured to obtain a first rendered image corresponding to the scene to be rendered under the single illumination of the first light source based on the rendering display information of all the first intersection points in the scene to be rendered under the illumination of the first light source.
在一些可行的实施方式中,待渲染场景包括目标交点,该目标交点为目标渲染光线与待渲染场景中的任一物体相交于该任一物体的表面上的交点;该目标渲染光线为虚拟渲染相机向上述待渲染场景发出的,该虚拟渲染相机用于确定上述目标渲染视角;In some feasible implementations, the scene to be rendered includes a target intersection point, and the target intersection point is the intersection point between the target rendering ray and any object in the scene to be rendered on the surface of any object; the target rendering ray is virtual rendering Sent by the camera to the above scene to be rendered, the virtual rendering camera is used to determine the above target rendering perspective;
处理模块1503,还用于在目标渲染视角下,基于目标交点对各个光源进行多次光照采样;其中每次光照采样对应从多个光源中选择各个目标光源,各个目标光源用于对目标交 点执行多光源的光线追踪渲染,其中,选择各个目标光源的概率正比于各个光源在目标渲染视角下的光源采样权重;The processing module 1503 is further configured to perform multiple illumination sampling on each light source based on the target intersection point under the target rendering perspective; wherein each illumination sampling corresponds to selecting each target light source from multiple light sources, and each target light source is used to perform execution on the target intersection point Ray tracing rendering of multiple light sources, wherein the probability of selecting each target light source is proportional to the light source sampling weight of each light source in the target rendering perspective;
获取模块1500,还用于获取目标交点在每次光照采样下由目标渲染光线投影在上述第二渲染图像上的第二辐照度;The obtaining module 1500 is further configured to obtain the second irradiance of the target intersection point projected by the target rendering light on the above-mentioned second rendered image under each illumination sampling;
确定模块1502,还用于根据目标交点在多次光照采样下的各个第二辐照度以及目标交点所在物体的物体属性,确定目标交点在多光源光照下的渲染显示信息;The determining module 1502 is further configured to determine the rendering display information of the target intersection under multi-light source illumination according to each second irradiance of the target intersection under multiple illumination sampling and the object attributes of the object where the target intersection is located;
获取模块1500,还用于根据待渲染场景中的所有目标交点在多光源光照下的渲染显示信息,获取上述第二渲染图像。The obtaining module 1500 is further configured to obtain the above-mentioned second rendered image according to the rendering display information of all target intersections in the scene to be rendered under the illumination of multiple light sources.
需要说明的是,上述术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性。It should be noted that the above-mentioned terms "first" and "second" are only used for descriptive purposes, and should not be construed as indicating or implying relative importance.
在本申请所提供的几个实施例中,应该理解到,所揭露的方法、装置以及系统,可以通过其它的方式实现。以上所描述的实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this application, it should be understood that the disclosed method, apparatus and system may be implemented in other manners. The above-described embodiments 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 Integration into another system, or some features can be ignored, or not implemented. In addition, the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms. of.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by program instructions related to hardware, the aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, execute Including the steps of the above method embodiment; and the aforementioned storage medium includes: a mobile storage device, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk and other various A medium on which program code can be stored.
或者,本发明上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present invention may be embodied in the form of software products in essence or the parts that make contributions to the prior art. The computer software products are stored in a storage medium and include several instructions for A computer device (which may be a personal computer, a server, or a network device, etc.) is caused to execute all or part of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic disk or an optical disk and other mediums that can store program codes.

Claims (12)

  1. 一种多光源场景渲染的光源采样权重确定方法,其特征在于,所述方法包括:A method for determining light source sampling weights for multi-light source scene rendering, characterized in that the method includes:
    以目标渲染视角在多光源场景中获取待渲染场景,并获取所述多光源场景中设置的多个光源;acquiring the scene to be rendered in the multi-light source scene from the target rendering perspective, and acquiring the multiple light sources set in the multi-light source scene;
    在所述目标渲染视角下,对所述待渲染场景执行单光源的光线追踪渲染,得到所述待渲染场景在各个光源单独光照下对应的各个第一渲染图像;From the target rendering perspective, perform ray tracing rendering of a single light source on the scene to be rendered, to obtain each first rendered image corresponding to the scene to be rendered under the separate illumination of each light source;
    根据所述各个第一渲染图像中的辐照信息,确定所述各个光源在所述目标渲染视角下对应的光源采样权重,所述光源采样权重用于对所述待渲染场景执行多光源的光线追踪渲染。According to the irradiance information in each first rendered image, the light source sampling weight corresponding to each light source in the target rendering perspective is determined, and the light source sampling weight is used to perform multi-light source lighting on the scene to be rendered Trace rendering.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    在所述目标渲染视角下,基于所述各个光源在所述目标渲染视角下对应的光源采样权重,对所述待渲染场景执行多光源的光线追踪渲染,得到所述待渲染场景在多光源光照下的第二渲染图像。In the target rendering perspective, based on the light source sampling weights corresponding to the respective light sources in the target rendering perspective, ray tracing rendering of multiple light sources is performed on the scene to be rendered, and the multi-light source illumination of the scene to be rendered is obtained. The second rendered image below.
  3. 根据权利要求2所述的方法,其特征在于,所述各个第一渲染图像的分辨率均小于所述第二渲染图像的分辨率。The method according to claim 2, wherein the resolution of each first rendered image is smaller than the resolution of the second rendered image.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述光线追踪渲染包括双向路径追踪渲染。The method according to any one of claims 1-3, wherein the ray tracing rendering comprises bidirectional path tracing rendering.
  5. 根据权利要求1所述的方法,其特征在于,所述各个第一渲染图像中的辐照信息为基于所述各个第一渲染图像对应的亮度信息而确定的,其中所述各个第一渲染图像的亮度信息为基于所述各个第一渲染图像中的色彩信息转换得到。The method according to claim 1, wherein the irradiation information in each of the first rendered images is determined based on luminance information corresponding to the respective first rendered images, wherein the respective first rendered images The brightness information of is obtained by conversion based on the color information in each of the first rendered images.
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述多个光源包括第一光源;所述待渲染场景包括第一交点和至少一个第二交点,所述第一交点为第一渲染光线与所述待渲染场景中的第一物体相交于所述第一物体的表面上的交点,所述第二交点为所述第一交点的反射光线与所述待渲染场景中的第二物体相交于所述第二物体表面上的交点和/或所述各个光源发出的光线分别与所述待渲染场景中的各个第三物体相交于所述各个第三物体表面上的交点;所述第一渲染光线为虚拟渲染相机向所述待渲染场景发出的,所述虚拟渲染相机用于确定所述目标渲染视角;The method according to any one of claims 1-5, wherein the plurality of light sources comprises a first light source; the scene to be rendered comprises a first intersection and at least one second intersection, and the first intersection is The intersection of the first rendering ray and the first object in the scene to be rendered on the surface of the first object, and the second intersection is the reflected ray of the first intersection and the scene to be rendered. The intersection of the second object on the surface of the second object and/or the intersection of the light emitted by the light source and the third object in the scene to be rendered on the surface of the third object respectively; The first rendering light is sent by a virtual rendering camera to the scene to be rendered, and the virtual rendering camera is used to determine the target rendering angle of view;
    所述在所述目标渲染视角下,对所述待渲染场景执行单光源的光线追踪渲染,得到所述待渲染场景在各个光源单独光照下对应的各个第一渲染图像包括:The performing ray tracing rendering of a single light source on the scene to be rendered from the target rendering perspective, and obtaining each first rendered image corresponding to the scene to be rendered under the lighting of each light source alone includes:
    在所述目标渲染视角下,基于所述第一交点对所述第一光源进行光照采样,得到所述第一交点在所述第一光源单独光照下由所述第一渲染光线投影在所述第一渲染图像上的第一辐射度;Under the target rendering perspective, lighting sampling is performed on the first light source based on the first intersection point, so as to obtain that the first intersection point is projected on the a first radiance on the first rendered image;
    在所述目标渲染视角下,基于各个第二交点对所述第一光源进行光照采样,得到所述各个第二交点在所述第一光源单独光照下由所述第一渲染光线投影在所述第一渲染图像上的各个第二辐射度;Under the target rendering perspective, lighting sampling is performed on the first light source based on each second intersection point, so as to obtain that each second intersection point is projected by the first rendering light on the respective second radiances on the first rendered image;
    根据所述第一辐射度与所述各个第二辐射度之和,获取所述第一交点在所述第一光源单独光照下由所述第一渲染光线投影在所述第一渲染图像上的第一辐照度;According to the sum of the first radiance and each of the second radiances, obtain the projection of the first intersection point on the first rendered image by the first rendering light under the single illumination of the first light source first irradiance;
    基于所述第一辐照度以及所述第一交点所在物体的物体属性,确定所述第一交点在所述第一光源单独光照下的渲染显示信息;determining, based on the first irradiance and an object attribute of the object where the first intersection is located, rendering display information of the first intersection under the single illumination of the first light source;
    基于所述待渲染场景中的所有第一交点在所述第一光源光照下的渲染显示信息,获取所述待渲染场景在所述第一光源单独光照下对应的第一渲染图像。Based on the rendering display information of all the first intersection points in the scene to be rendered under the illumination of the first light source, a first rendered image corresponding to the scene to be rendered under the single illumination of the first light source is acquired.
  7. 根据权利要求2所述的方法,其特征在于,所述待渲染场景包括目标交点,所述目标交点为目标渲染光线与所述待渲染场景中的任一物体相交于所述任一物体的表面上的交点;所述目标渲染光线为虚拟渲染相机向所述待渲染场景发出的,所述虚拟渲染相机用于确定所述目标渲染视角;The method according to claim 2, wherein the scene to be rendered includes a target intersection point, and the target intersection point is that the target rendering ray intersects with any object in the scene to be rendered on the surface of any object. The target rendering ray is sent to the scene to be rendered by a virtual rendering camera, and the virtual rendering camera is used to determine the target rendering angle of view;
    所述在所述目标渲染视角下,基于所述各个光源在所述目标渲染视角下对应的光源采样权重,对所述待渲染场景执行多光源的光线追踪渲染,得到所述待渲染场景在多光源光照下的第二渲染图像包括:In the target rendering perspective, based on the light source sampling weights corresponding to the respective light sources in the target rendering perspective, ray tracing rendering of multiple light sources is performed on the scene to be rendered, and the number of the scene to be rendered is obtained. The second rendered image under the light source includes:
    在所述目标渲染视角下,基于所述目标交点对各个光源进行多次光照采样,其中每次光照采样对应从所述多个光源中选择各个目标光源,所述各个目标光源用于对所述目标交点执行多光源的光线追踪渲染,以获取所述目标交点在每次光照采样下由所述目标渲染光线投影在所述第二渲染图像上的第二辐照度;其中,选择所述各个目标光源的概率正比于所述各个光源在所述目标渲染视角下的光源采样权重;Under the target rendering perspective, multiple illumination samplings are performed on each light source based on the target intersection point, wherein each illumination sampling corresponds to selecting each target light source from the plurality of light sources, and each target light source is used for the Performing ray tracing rendering of multiple light sources at the target intersection to obtain the second irradiance projected by the target rendering rays on the second rendered image at the target intersection under each illumination sampling; wherein, selecting the respective The probability of the target light source is proportional to the light source sampling weight of each light source in the target rendering perspective;
    根据所述目标交点在所述多次光照采样下的各个第二辐照度以及所述目标交点所在物体的物体属性,确定所述目标交点在多光源光照下的渲染显示信息;According to each second irradiance of the target intersection under the multiple illumination sampling and the object attribute of the object where the target intersection is located, determine the rendering display information of the target intersection under the illumination of multiple light sources;
    根据所述待渲染场景中的所有目标交点在多光源光照下的渲染显示信息,获取所述第二渲染图像。The second rendered image is acquired according to rendering display information of all target intersections in the scene to be rendered under the illumination of multiple light sources.
  8. 根据权利要求7所述的方法,其特征在于,所述各个目标光源在所述目标渲染视角下的光源采样权重大于预设阈值。The method according to claim 7, wherein a light source sampling weight of each target light source in the target rendering perspective is greater than a preset threshold.
  9. 一种多光源场景渲染的光源采样权重的确定装置,其特征在于,所述装置包括:A device for determining light source sampling weights for multi-light source scene rendering, characterized in that the device comprises:
    获取模块,用于以目标渲染视角在多光源场景中获取待渲染场景,并获取所述多光源场景中设置的多个光源;an acquisition module, configured to acquire a scene to be rendered in a multi-light source scene from a target rendering perspective, and acquire a plurality of light sources set in the multi-light source scene;
    预处理模块,用于在所述目标渲染视角下,对所述获取模块获取到的所述待渲染场景执行单光源的光线追踪渲染,得到所述待渲染场景在各个光源单独光照下对应的各个第一渲染图像;A preprocessing module, configured to perform ray tracing rendering of a single light source on the scene to be rendered acquired by the acquisition module from the perspective of the target rendering, so as to obtain each corresponding scene of the scene to be rendered under the separate illumination of each light source. the first rendered image;
    确定模块,用于根据所述预处理模块得到的所述各个第一渲染图像中的辐照信息,确定所述各个光源在所述目标渲染视角下对应的光源采样权重,所述光源采样权重用于对所 述待渲染场景执行多光源的光线追踪渲染。A determination module, configured to determine, according to the irradiation information in the respective first rendered images obtained by the preprocessing module, the light source sampling weights corresponding to the respective light sources in the target rendering perspective, and the light source sampling weights are determined by using performing ray tracing rendering of multiple light sources on the scene to be rendered.
  10. 一种电子设备,其特征在于,所述电子设备包括:处理器和存储器,所述处理器和所述存储器通过总线系统相连;An electronic device, characterized in that the electronic device comprises: a processor and a memory, and the processor and the memory are connected through a bus system;
    所述存储器用于存储指令;the memory is used to store instructions;
    所述处理器用于调用所述存储器中存储的指令,执行上述权利要求1-8中任一项的方法。The processor is configured to invoke the instructions stored in the memory to perform the method of any one of the preceding claims 1-8.
  11. 一种计算机程序产品,其特征在于,包括计算机可读指令,当所述计算机可读指令被一个或多个处理器运行时执行上述权利要求1-8中任一项的方法。A computer program product comprising computer readable instructions which, when executed by one or more processors, perform the method of any of the preceding claims 1-8.
  12. 一种计算机存储介质,其特征在于,包括计算机可读指令,当所述计算机可读指令被一个或多个处理器运行时执行上述权利要求1-8中任一项的方法。A computer storage medium comprising computer readable instructions which, when executed by one or more processors, perform the method of any one of the preceding claims 1-8.
PCT/CN2021/131989 2020-11-27 2021-11-22 Light source sampling weight determination method for multiple light source scenario rendering, and related device WO2022111400A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011360803.XA CN114549730A (en) 2020-11-27 2020-11-27 Light source sampling weight determination method for multi-light source scene rendering and related equipment
CN202011360803.X 2020-11-27

Publications (1)

Publication Number Publication Date
WO2022111400A1 true WO2022111400A1 (en) 2022-06-02

Family

ID=81668044

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/131989 WO2022111400A1 (en) 2020-11-27 2021-11-22 Light source sampling weight determination method for multiple light source scenario rendering, and related device

Country Status (2)

Country Link
CN (1) CN114549730A (en)
WO (1) WO2022111400A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115100339A (en) * 2022-06-15 2022-09-23 北京百度网讯科技有限公司 Image generation method and device, electronic equipment and storage medium
CN115731336A (en) * 2023-01-06 2023-03-03 粤港澳大湾区数字经济研究院(福田) Image rendering method, image rendering model generation method and related device
CN116524061A (en) * 2023-07-03 2023-08-01 腾讯科技(深圳)有限公司 Image rendering method and related device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117351134A (en) * 2022-06-29 2024-01-05 华为技术有限公司 Image rendering method and related equipment thereof
CN115082611B (en) * 2022-08-18 2022-11-11 腾讯科技(深圳)有限公司 Illumination rendering method, apparatus, device and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110012901A1 (en) * 2009-06-29 2011-01-20 Anton Kaplanyan Method, computer graphics image rendering system and computer-readable data storage medium for computing of indirect illumination in a computer graphics image of a scene
CN104200512A (en) * 2014-07-30 2014-12-10 浙江传媒学院 Multiple-light source rendering method based on virtual spherical light sources
CN104732579A (en) * 2015-02-15 2015-06-24 浙江传媒学院 Multi-light-source scene rendering method based on light fragmentation
CN105261059A (en) * 2015-09-18 2016-01-20 浙江大学 Rendering method based on indirect reflection highlight calculation in screen space
CN106251393A (en) * 2016-07-14 2016-12-21 山东大学 A kind of gradual Photon Mapping optimization method eliminated based on sample

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110012901A1 (en) * 2009-06-29 2011-01-20 Anton Kaplanyan Method, computer graphics image rendering system and computer-readable data storage medium for computing of indirect illumination in a computer graphics image of a scene
CN104200512A (en) * 2014-07-30 2014-12-10 浙江传媒学院 Multiple-light source rendering method based on virtual spherical light sources
CN104732579A (en) * 2015-02-15 2015-06-24 浙江传媒学院 Multi-light-source scene rendering method based on light fragmentation
CN105261059A (en) * 2015-09-18 2016-01-20 浙江大学 Rendering method based on indirect reflection highlight calculation in screen space
CN106251393A (en) * 2016-07-14 2016-12-21 山东大学 A kind of gradual Photon Mapping optimization method eliminated based on sample

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115100339A (en) * 2022-06-15 2022-09-23 北京百度网讯科技有限公司 Image generation method and device, electronic equipment and storage medium
CN115100339B (en) * 2022-06-15 2023-06-20 北京百度网讯科技有限公司 Image generation method, device, electronic equipment and storage medium
CN115731336A (en) * 2023-01-06 2023-03-03 粤港澳大湾区数字经济研究院(福田) Image rendering method, image rendering model generation method and related device
CN116524061A (en) * 2023-07-03 2023-08-01 腾讯科技(深圳)有限公司 Image rendering method and related device
CN116524061B (en) * 2023-07-03 2023-09-26 腾讯科技(深圳)有限公司 Image rendering method and related device

Also Published As

Publication number Publication date
CN114549730A (en) 2022-05-27

Similar Documents

Publication Publication Date Title
WO2022111400A1 (en) Light source sampling weight determination method for multiple light source scenario rendering, and related device
US11570372B2 (en) Virtual camera for 3-d modeling applications
US10115229B2 (en) Reinforcement learning for light transport
US10275926B2 (en) Crowd-sourced video rendering system
US9652880B2 (en) 2D animation from a 3D mesh
CN111723902A (en) Dynamically estimating lighting parameters for a location in an augmented reality scene using a neural network
US9418629B2 (en) Optical illumination mapping
US9478065B2 (en) System and method for remote generation of indirect illumination sources in three-dimensional graphics
WO2021228031A1 (en) Rendering method, apparatus and system
CN112116692A (en) Model rendering method, device and equipment
US11429690B2 (en) Interactive path tracing on the web
WO2023087911A1 (en) Data processing method and device and readable storage medium
WO2023142607A1 (en) Image rendering method and apparatus, and device and medium
WO2024021557A1 (en) Reflected illumination determination method and apparatus, global illumination determination method and apparatus, medium, and device
CN114078077A (en) Assessing qualitative streaming experience using session performance metadata
US20230267063A1 (en) Real-time latency measurements in streaming systems and applications
US11836844B2 (en) Motion vector optimization for multiple refractive and reflective interfaces
TW202141429A (en) Rendering using shadow information
CN116740253B (en) Ray tracing method and electronic equipment
US20240177394A1 (en) Motion vector optimization for multiple refractive and reflective interfaces
WO2022121654A1 (en) Transparency determination method and apparatus, and electronic device and storage medium
CN116681814B (en) Image rendering method and electronic equipment
US20240054720A1 (en) Differentiable object insertion using hybrid lighting volumes for synthetic data generation applications
CN116842294A (en) Collaborative cloud rendering system
CN116993896A (en) Illumination information processing device, electronic device, and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21896901

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21896901

Country of ref document: EP

Kind code of ref document: A1