[go: up one dir, main page]

CN112190936B - Game scene rendering method, device, equipment and storage medium - Google Patents

Game scene rendering method, device, equipment and storage medium Download PDF

Info

Publication number
CN112190936B
CN112190936B CN202011075527.2A CN202011075527A CN112190936B CN 112190936 B CN112190936 B CN 112190936B CN 202011075527 A CN202011075527 A CN 202011075527A CN 112190936 B CN112190936 B CN 112190936B
Authority
CN
China
Prior art keywords
rendering
area
parameter
rendered
game scene
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011075527.2A
Other languages
Chinese (zh)
Other versions
CN112190936A (en
Inventor
刘健彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202011075527.2A priority Critical patent/CN112190936B/en
Publication of CN112190936A publication Critical patent/CN112190936A/en
Application granted granted Critical
Publication of CN112190936B publication Critical patent/CN112190936B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/55Controlling game characters or game objects based on the game progress
    • A63F13/56Computing the motion of game characters with respect to other game characters, game objects or elements of the game scene, e.g. for simulating the behaviour of a group of virtual soldiers or for path finding
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Image Generation (AREA)

Abstract

本申请提供一种游戏场景渲染方法、装置、设备及存储介质,涉及场景配置技术领域。该方法包括:通过游戏场景中待渲染物体的材质着色器,获取所述待渲染物体的第一材质渲染参数和第二材质渲染参数;根据所述第一材质渲染参数,采用基于物理的渲染方法,对所述待渲染物体上直接光照射区域进行材质渲染;根据所述第二材质渲染参数,采用基于物理的渲染方法,对所述待渲染物体上未被直接光照射的区域进行材质渲染。相对于现有技术,通过简单的方式就可以调节游戏场景中直接光照射区域和未被直接光照射的区域的效果,从而平衡直接光照射区域和未被直接光照射的区域的对比,同时避免了对暗部细节进行处理会增加性能消耗的问题。

The present application provides a game scene rendering method, device, equipment and storage medium, and relates to the field of scene configuration technology. The method includes: obtaining a first material rendering parameter and a second material rendering parameter of the object to be rendered through the material shader of the object to be rendered in the game scene; according to the first material rendering parameter, using a physically based rendering method to perform material rendering on the directly illuminated area on the object to be rendered; according to the second material rendering parameter, using a physically based rendering method to perform material rendering on the area on the object to be rendered that is not directly illuminated. Compared with the prior art, the effects of the directly illuminated area and the area not directly illuminated in the game scene can be adjusted in a simple way, thereby balancing the contrast between the directly illuminated area and the area not directly illuminated, while avoiding the problem of increasing performance consumption by processing dark details.

Description

游戏场景渲染方法、装置、设备及存储介质Game scene rendering method, device, equipment and storage medium

技术领域Technical Field

本申请涉及场景配置技术领域,具体而言,涉及一种游戏场景渲染方法、装置、设备及存储介质。The present application relates to the technical field of scene configuration, and in particular to a game scene rendering method, device, equipment and storage medium.

背景技术Background Art

在游戏场景的制作过程中,往往会通过是否可以接收到直接光的照射来区分场景的亮部区域和暗部区域,亮部区域可以接收到直接光的照射,而暗部区域由于被遮挡无法受到直射光的影响,往往整个暗部会呈现几乎是一样的深度灰色的效果,因此往往需要对暗部区域进行额外的光照处理。In the process of making game scenes, the bright and dark areas of the scene are often distinguished by whether they can receive direct light. The bright areas can receive direct light, while the dark areas are blocked and cannot be affected by direct light. Often the entire dark area will present an almost identical deep gray effect, so additional lighting processing is often required for the dark areas.

现有技术中为了凸现暗部的细节,一般会采用直接光和间接光所产生的光线对物体表面进行交互,从而获取交互后物体表面着色的结果并显示出来。In order to highlight the details of dark areas in the prior art, the light generated by direct light and indirect light is generally used to interact with the surface of an object, so as to obtain and display the result of the coloring of the surface of the object after the interaction.

但是这种使用光源对暗部细节进行处理的方式,会增加性能消耗,并且难以平衡亮部与暗部之间的对比。However, this method of using light sources to process dark details will increase performance consumption and make it difficult to balance the contrast between bright and dark areas.

发明内容Summary of the invention

本申请的目的在于,针对上述现有技术中的不足,提供一种游戏场景渲染方法、装置、设备及存储介质,以解决现有技术中对暗部细节进行处理会增加性能消耗,并且难以平衡亮部与暗部之间的对比的问题。The purpose of this application is to provide a game scene rendering method, device, equipment and storage medium to address the deficiencies in the above-mentioned prior art, so as to solve the problem that processing dark details in the prior art will increase performance consumption and it is difficult to balance the contrast between bright and dark parts.

为实现上述目的,本申请实施例采用的技术方案如下:To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

第一方面,本申请一实施例提供了一种游戏场景渲染方法,所述方法包括:In a first aspect, an embodiment of the present application provides a game scene rendering method, the method comprising:

通过游戏场景中待渲染物体的材质着色器,获取所述待渲染物体的第一材质渲染参数和第二材质渲染参数;Obtaining a first material rendering parameter and a second material rendering parameter of the object to be rendered through a material shader of the object to be rendered in the game scene;

根据所述第一材质渲染参数,采用基于物理的渲染方法,对所述待渲染物体上直接光照射区域进行材质渲染;According to the first material rendering parameter, using a physically based rendering method, material rendering is performed on a directly illuminated area of the object to be rendered;

根据所述第二材质渲染参数,采用基于物理的渲染方法,对所述待渲染物体上未被直接光照射的区域进行材质渲染。According to the second material rendering parameter, a physically based rendering method is used to perform material rendering on the area of the object to be rendered that is not illuminated by direct light.

可选地,所述通过游戏场景中待渲染物体的材质着色器,获取所述待渲染物体的第一材质渲染参数和第二材质渲染参数,包括:Optionally, obtaining a first material rendering parameter and a second material rendering parameter of the object to be rendered by using a material shader of the object to be rendered in the game scene includes:

通过所述材质着色器的配置界面上第一配置区域,获取所述第一材质渲染参数;Obtaining the first material rendering parameter through a first configuration area on a configuration interface of the material shader;

通过所述材质着色器的配置界面上第二配置区域,获取所述第二材质渲染参数。The second material rendering parameters are obtained through a second configuration area on the configuration interface of the material shader.

可选地,所述通过所述材质着色器的配置界面上第一配置区域,获取所述第一材质渲染参数,包括:Optionally, obtaining the first material rendering parameter through a first configuration area on a configuration interface of the material shader includes:

接收通过所述第一配置区域输入的材质贴图;Receiving a material map input through the first configuration area;

从所述材质贴图中预设通道中读取所述第一材质渲染参数;所述材质贴图中所述预设通道记录有对应类型的材质渲染参数。The first material rendering parameter is read from a preset channel in the material map; the preset channel in the material map records the material rendering parameter of the corresponding type.

可选地,所述从所述材质贴图中预设通道中读取所述第一材质渲染参数,包括:Optionally, reading the first material rendering parameter from a preset channel in the material map includes:

从所述材质贴图的R通道中读取第一金属度值,从所述材质贴图的G通道中读取第一粗糙度值。A first metalness value is read from the R channel of the texture map, and a first roughness value is read from the G channel of the texture map.

可选地,所述通过所述材质着色器的配置界面上第二配置区域,获取所述第二材质渲染参数,包括:Optionally, obtaining the second material rendering parameter through a second configuration area on a configuration interface of the material shader includes:

接收通过所述第二配置区域输入的预设类型的材质渲染参数,所述第二材质渲染参数包括:所述预设类型的材质渲染参数。A material rendering parameter of a preset type input through the second configuration area is received, where the second material rendering parameter includes: a material rendering parameter of the preset type.

可选地,所述第二配置区域中具有:至少一个预设类型的材质渲染参数的输入框;Optionally, the second configuration area has: an input box for at least one preset type of material rendering parameter;

所述接收通过所述第二配置区域输入的预设类型的材质渲染参数,包括:The receiving of the preset type of material rendering parameters input through the second configuration area includes:

接收通过每个预设类型的材质渲染参数的输入框所输入的所述每个预设类型的材质渲染参数:所述第二材质渲染参数包括:所述至少一个预设类型的材质渲染参数。Receiving the material rendering parameters of each preset type input through the input box of the material rendering parameters of each preset type: the second material rendering parameters include: the material rendering parameters of the at least one preset type.

可选地,所述至少一个预设类型的材质渲染参数包括:第二金属度值,和/或,第二粗糙度值。Optionally, the at least one preset type of material rendering parameter includes: a second metalness value, and/or a second roughness value.

可选地,所述根据所述第二材质渲染参数,采用基于物理的渲染方法,对所述待渲染物体上未被直接光照射的区域进行材质渲染,包括:Optionally, performing material rendering on an area of the object to be rendered that is not directly illuminated by light by using a physically based rendering method according to the second material rendering parameter includes:

根据所述第二材质渲染参数,对所述基于物理的渲染方法的渲染管线的间接光的高光项进行配置;According to the second material rendering parameter, a highlight item of indirect light of the rendering pipeline of the physical based rendering method is configured;

基于配置后的所述渲染管线,对所述待渲染物体上未被直接光照射的区域进行材质渲染。Based on the configured rendering pipeline, material rendering is performed on the area of the object to be rendered that is not illuminated by direct light.

第二方面,本申请另一实施例提供了一种游戏场景渲染装置,所述装置包括:获取模块和渲染模块,其中:In a second aspect, another embodiment of the present application provides a game scene rendering device, the device comprising: an acquisition module and a rendering module, wherein:

所述获取模块,用于通过游戏场景中待渲染物体的材质着色器,获取所述待渲染物体的第一材质渲染参数和第二材质渲染参数;The acquisition module is used to acquire the first material rendering parameter and the second material rendering parameter of the object to be rendered through the material shader of the object to be rendered in the game scene;

所述渲染模块,用于根据所述第一材质渲染参数,采用基于物理的渲染方法,对所述待渲染物体上直接光照射区域进行材质渲染;根据所述第二材质渲染参数,采用基于物理的渲染方法,对所述待渲染物体上未被直接光照射的区域进行材质渲染。The rendering module is used to perform material rendering on the area on the object to be rendered that is directly illuminated by light, using a physically based rendering method according to the first material rendering parameters; and to perform material rendering on the area on the object to be rendered that is not directly illuminated by light, using a physically based rendering method according to the second material rendering parameters.

可选地,所述获取模块,具体用于通过所述材质着色器的配置界面上第一配置区域,获取所述第一材质渲染参数;通过所述材质着色器的配置界面上第二配置区域,获取所述第二材质渲染参数。Optionally, the acquisition module is specifically used to acquire the first material rendering parameter through a first configuration area on the configuration interface of the material shader; and acquire the second material rendering parameter through a second configuration area on the configuration interface of the material shader.

可选地,所述装置还包括:接收模块和读取模块,其中:Optionally, the device further comprises: a receiving module and a reading module, wherein:

所述接收模块,用于接收通过所述第一配置区域输入的材质贴图;The receiving module is used to receive the material map input through the first configuration area;

所述读取模块,用于从所述材质贴图中预设通道中读取所述第一材质渲染参数;所述材质贴图中所述预设通道记录有对应类型的材质渲染参数。The reading module is used to read the first material rendering parameter from a preset channel in the material map; the preset channel in the material map records the material rendering parameters of the corresponding type.

可选地,所述读取模块,具体用于从所述材质贴图的R通道中读取第一金属度值,从所述材质贴图的G通道中读取第一粗糙度值。Optionally, the reading module is specifically configured to read a first metalness value from an R channel of the material map, and read a first roughness value from a G channel of the material map.

可选地,所述接收模块,具体用于接收通过所述第二配置区域输入的预设类型的材质渲染参数,所述第二材质渲染参数包括:所述预设类型的材质渲染参数。Optionally, the receiving module is specifically used to receive material rendering parameters of a preset type input through the second configuration area, and the second material rendering parameters include: material rendering parameters of the preset type.

可选地,所述接收模块,具体用于接收通过每个预设类型的材质渲染参数的输入框所输入的所述每个预设类型的材质渲染参数:所述第二材质渲染参数包括:所述至少一个预设类型的材质渲染参数。Optionally, the receiving module is specifically used to receive the material rendering parameters of each preset type input through the input box of the material rendering parameters of each preset type: the second material rendering parameters include: the material rendering parameters of the at least one preset type.

可选地,所述装置还包括:配置模块,用于根据所述第二材质渲染参数,对所述基于物理的渲染方法的渲染管线的间接光的高光项进行配置;Optionally, the apparatus further comprises: a configuration module, configured to configure a highlight item of indirect light of a rendering pipeline of the physically based rendering method according to the second material rendering parameter;

所述渲染模块,具体用于基于配置后的所述渲染管线,对所述待渲染物体上未被直接光照射的区域进行材质渲染。The rendering module is specifically used to perform material rendering on the area of the object to be rendered that is not illuminated by direct light based on the configured rendering pipeline.

第三方面,本申请另一实施例提供了一种游戏场景渲染设备,包括:处理器、存储介质和总线,所述存储介质存储有所述处理器可执行的机器可读指令,当游戏场景渲染设备运行时,所述处理器与所述存储介质之间通过总线通信,所述处理器执行所述机器可读指令,以执行如上述第一方面任一所述方法的步骤。In the third aspect, another embodiment of the present application provides a game scene rendering device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, when the game scene rendering device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of any method described in the first aspect above.

第四方面,本申请另一实施例提供了一种存储介质,所述存储介质上存储有计算机程序,所述计算机程序被处理器运行时执行如上述第一方面任一所述方法的步骤。In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any method described in the first aspect are executed.

本申请的有益效果是:采用本申请提供的游戏场景渲染方法,由于渲染是通过直接获取待渲染物体的材质着色器的第一材质渲染参数和第二材质渲染参数,并根据第一材质渲染参数和第二材质渲染参数分别对直接光照射区域和未被直接光照射的区域进行材质渲染,不需要对未被直接光照射的区域进行额外的光照处理,通过简单的方式就可以调节游戏场景中直接光照射区域和未被直接光照射的区域的效果,从而平衡直接光照射区域和未被直接光照射的区域的对比,从而避免未被直接光照射区域的“死黑”效果,提高游戏场景的渲染效果,并且,可保证渲染后游戏场景中直接光照射区域和未被直接光照射区域的之间的层次效果,渲染效果更真实。The beneficial effect of the present application is that by adopting the game scene rendering method provided by the present application, since the rendering is performed by directly obtaining the first material rendering parameter and the second material rendering parameter of the material shader of the object to be rendered, and material rendering is performed on the directly illuminated area and the area not directly illuminated according to the first material rendering parameter and the second material rendering parameter, respectively, there is no need to perform additional lighting processing on the area not directly illuminated, and the effects of the directly illuminated area and the area not directly illuminated in the game scene can be adjusted in a simple way, thereby balancing the contrast between the directly illuminated area and the area not directly illuminated, thereby avoiding the "dead black" effect of the area not directly illuminated, improving the rendering effect of the game scene, and ensuring the layering effect between the directly illuminated area and the area not directly illuminated in the game scene after rendering, and the rendering effect is more realistic.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

图1为本申请一实施例提供的游戏场景渲染方法的流程示意图;FIG1 is a schematic diagram of a flow chart of a game scene rendering method provided in an embodiment of the present application;

图2为本申请另一实施例提供的游戏场景渲染方法的流程示意图;FIG2 is a schematic diagram of a flow chart of a game scene rendering method provided by another embodiment of the present application;

图3为本申请另一实施例提供的游戏场景渲染方法的流程示意图;FIG3 is a schematic diagram of a flow chart of a game scene rendering method provided by another embodiment of the present application;

图4为本申请另一实施例提供的游戏场景渲染方法的流程示意图;FIG4 is a schematic diagram of a flow chart of a game scene rendering method provided by another embodiment of the present application;

图5为本申请另一实施例提供的游戏场景渲染方法的流程示意图;FIG5 is a schematic diagram of a flow chart of a game scene rendering method provided by another embodiment of the present application;

图6为本申请一实施例提供的配置界面示意图;FIG6 is a schematic diagram of a configuration interface provided by an embodiment of the present application;

图7为本申请一实施例提供的游戏场景渲染装置的结构示意图;FIG7 is a schematic diagram of the structure of a game scene rendering device provided in an embodiment of the present application;

图8为本申请另一实施例提供的游戏场景渲染装置的结构示意图;FIG8 is a schematic diagram of the structure of a game scene rendering device provided by another embodiment of the present application;

图9为本申请一实施例提供的游戏场景渲染设备的结构示意图。FIG. 9 is a schematic diagram of the structure of a game scene rendering device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.

通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

另外,本申请中使用的流程图示出了根据本申请的一些实施例实现的操作。应该理解,流程图的操作可以不按顺序实现,没有逻辑的上下文关系的步骤可以反转顺序或者同时实施。此外,本领域技术人员在本申请内容的指引下,可以向流程图添加一个或多个其他操作,也可以从流程图中移除一个或多个操作。In addition, the flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of order, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of this application, and can also remove one or more operations from the flowchart.

为了使得本领域技术人员能够使用本申请内容,结合特定应用场景:游戏场景的渲染为例,给出以下实施方式。对于本领域技术人员来说,在不脱离本申请的精神和范围的情况下,可以将这里定义的一般原理应用于其他实施例和应用场景。虽然本申请主要围绕游戏场景的渲染进行描述,但是应该理解,这仅是一个示例性实施例。In order to enable those skilled in the art to use the content of this application, the following implementation is given in conjunction with a specific application scenario: the rendering of a game scene as an example. For those skilled in the art, the general principles defined herein can be applied to other embodiments and application scenarios without departing from the spirit and scope of this application. Although this application is mainly described around the rendering of a game scene, it should be understood that this is only an exemplary embodiment.

需要说明的是,本申请实施例中将会用到术语“包括”,用于指出其后所声明的特征的存在,但并不排除增加其它的特征。It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

为方便对本申请的理解,下述对本申请涉及的一些名词进行解释:To facilitate understanding of this application, some terms involved in this application are explained as follows:

着色器(Shader):Shader存储的是GPU的执行代码,用于告知GPU如何绘制目标像素的颜色,广泛应用于三维图形领域。通过shader代码,可以获得各种三维图形效果。Shader: Shader stores the GPU's execution code, which is used to tell the GPU how to draw the color of the target pixel. It is widely used in the field of 3D graphics. Various 3D graphics effects can be obtained through shader code.

直接光(Direct light):从光源出发直接照射到物体身上的光称为直接光。Direct light: The light that directly shines from the light source to the object is called direct light.

间接光(Indirect light):在真实的世界中,物体能够被间接光照所照亮。间接光照指的是,光线通常会在多个物体之间反射,最后进入摄像机,也就是说在光线进入摄像机之前,经过了不止一次的物体反射。Indirect light: In the real world, objects can be illuminated by indirect light. Indirect light means that light usually reflects between multiple objects and finally enters the camera, which means that before the light enters the camera, it is reflected by more than one object.

基于物理的渲染方法(Physical Based Rendering,PBR):是近年来广泛使用的一种实时渲染方法,与之对应的材质体系被称为PBR材质体系,该材质体系下包含了基础色(Base Color),金属度(Metallic),粗糙度(Roughness)等多个参数。Physical Based Rendering (PBR): It is a real-time rendering method widely used in recent years. The corresponding material system is called PBR material system, which includes multiple parameters such as base color, metallic, roughness, etc.

环境反射(Image Based Lighting,IBL):在PBR体系中,是通过IBL技术实现高光反射的。通过使用环境贴图(可以是真实世界拿相机拍的或是游戏内相机实时渲染的)去达到在实时渲染中环境光的效果。Image Based Lighting (IBL): In the PBR system, specular reflection is achieved through IBL technology. The effect of ambient light in real-time rendering is achieved by using environment maps (which can be taken by a camera in the real world or rendered in real time by a camera in the game).

渲染管线:渲染管线是实时渲染的核心组件。渲染管线的功能是通过给定虚拟相机,三维场景物体以及光源等场景要素,用以渲染出二维的图像。Rendering pipeline: The rendering pipeline is the core component of real-time rendering. The function of the rendering pipeline is to render a two-dimensional image by giving a virtual camera, three-dimensional scene objects, light sources and other scene elements.

值得注意的是,在本申请提出申请之前,现有技术为了照亮场景,通常会在游戏引擎中使用直接光和间接光,为了不让未被直接光照射的部分呈现“死黑“一片,即为了突显暗部区域的细节,会使用光源或是环境反射对物体产生交互,即需要直接光和间接光所产生的光线对物体表面进行交互,从而获取渲染着色的结果并显示出来,但是这种方法不但会增加性能消耗,并且在有些游戏场景下,例如水、冰和光滑的雪等,会难以平衡亮部与暗部的对比,从而导致美术人员调好了亮部但暗部过曝或是暗部调好亮部细节不明显的问题。It is worth noting that before the present application was filed, in order to illuminate the scene, the prior art usually used direct light and indirect light in the game engine. In order to prevent the part not illuminated by direct light from appearing "dead black", that is, to highlight the details of the dark area, the light source or the environmental reflection would be used to interact with the object, that is, the light generated by the direct light and the indirect light needs to interact with the surface of the object, so as to obtain the rendering and shading results and display them. However, this method will not only increase the performance consumption, but also in some game scenes, such as water, ice and smooth snow, it will be difficult to balance the contrast between the bright and dark parts, resulting in the problem that the artist has adjusted the bright parts but the dark parts are overexposed or the dark parts are adjusted but the details of the bright parts are not obvious.

本申请提供的游戏场景渲染方法可以通过直接获取待渲染物体的材质着色器的第一材质渲染参数和第二材质渲染参数,并根据第一材质渲染参数和第二材质渲染参数分别对直接光照射区域和未被直接光照射的区域进行材质渲染的形式,不需要对未被直接光照射的区域进行额外的光照处理,通过简单的方式就可以调节游戏场景中直接光照射区域和未被直接光照射的区域的效果,从而平衡直接光照射区域和未被直接光照射的区域的对比,避免未被直接光照射区域的“死黑”效果,提高游戏场景的渲染效果,并且可以解决现有技术中直接光和间接光所产生的光线对物体表面进行交互获取最终的渲染着色效果并显示,导致性能消耗高的问题,达到简化游戏场景的渲染过程的作用。The game scene rendering method provided in the present application can directly obtain the first material rendering parameter and the second material rendering parameter of the material shader of the object to be rendered, and perform material rendering on the directly lighted area and the area not directly lighted according to the first material rendering parameter and the second material rendering parameter, respectively. There is no need to perform additional lighting processing on the area not directly lighted. The effects of the directly lighted area and the area not directly lighted in the game scene can be adjusted in a simple manner, thereby balancing the contrast between the directly lighted area and the area not directly lighted, avoiding the "dead black" effect of the area not directly lighted, and improving the rendering effect of the game scene. It can also solve the problem in the prior art that the light generated by direct light and indirect light interacts with the surface of an object to obtain the final rendering and shading effect and display it, resulting in high performance consumption, thereby simplifying the rendering process of the game scene.

如下结合多个具体的应用示例,对本申请实施例所提供的一种游戏场景渲染方法进行解释说明。图1为本申请一实施例提供的一种游戏场景渲染方法的流程示意图,如图1所示,该方法包括:The following is an explanation of a game scene rendering method provided by an embodiment of the present application in combination with multiple specific application examples. FIG1 is a flow chart of a game scene rendering method provided by an embodiment of the present application. As shown in FIG1 , the method includes:

S101:通过游戏场景中待渲染物体的材质着色器,获取待渲染物体的第一材质渲染参数和第二材质渲染参数。S101: Obtaining a first material rendering parameter and a second material rendering parameter of an object to be rendered through a material shader of the object to be rendered in a game scene.

本申请提供的方法中,由于材质着色器中包括第一材质渲染参数和第二材质渲染参数,使得基于本申请提供的材质着色器可以获取针对待渲染物体的两部分材质渲染参数,并根据两部分材质渲染参数,分别对亮部和暗部区域对应的材质进行渲染。In the method provided in the present application, since the material shader includes a first material rendering parameter and a second material rendering parameter, the material shader provided in the present application can obtain two parts of material rendering parameters for the object to be rendered, and according to the two parts of material rendering parameters, render the materials corresponding to the bright and dark areas respectively.

S102:根据第一材质渲染参数,采用基于物理的渲染方法,对待渲染物体上直接光照射区域进行材质渲染。S102: Performing material rendering on a directly illuminated area of the object to be rendered using a physically based rendering method according to the first material rendering parameter.

可选地,可以根据该第一材质渲染参数对游戏场景内所有直接光照射区域对应的物体进行材质渲染;也可以根据第一材质渲染参数,结合用户的选择操作,仅对游戏场景内直接光照射区域中的几个被选中物体进行材质渲染;也可以根据第一材质渲染参数,结合用户的选择操作,仅对游戏场景内直接光照射区域中多个类型的物体中,被选中的目标类型的多个物体进行材质渲染;具体材质渲染对象的确定方式可以根据用户需要灵活调整,并不以上述实施例给出的为限。Optionally, material rendering can be performed on objects corresponding to all direct light illumination areas in the game scene according to the first material rendering parameters; or, according to the first material rendering parameters and in combination with a user's selection operation, material rendering can be performed only on a few selected objects in the direct light illumination area in the game scene; or, according to the first material rendering parameters and in combination with a user's selection operation, material rendering can be performed only on multiple objects of a selected target type among multiple types of objects in the direct light illumination area in the game scene; the method for determining the specific material rendering object can be flexibly adjusted according to user needs, and is not limited to the above-mentioned embodiments.

其中,游戏场景内直接光照射区域即为当前场景的亮部区域,基于该第一材质渲染参数对该直接光照射区域进行材质渲染,即保证了对亮部区域的渲染效果。如此,可通过配置或更改该第一材质渲染参数,对该亮部区域的渲染效果进行控制。The directly illuminated area in the game scene is the bright area of the current scene. Material rendering is performed on the directly illuminated area based on the first material rendering parameter, which ensures the rendering effect of the bright area. In this way, the rendering effect of the bright area can be controlled by configuring or changing the first material rendering parameter.

S103:根据第二材质渲染参数,采用基于物理的渲染方法,对待渲染物体上未被直接光照射的区域进行材质渲染。S103: performing material rendering on the area of the object to be rendered that is not illuminated by direct light, using a physically based rendering method according to the second material rendering parameter.

可选地,在一些可能的实施例中,对未被直接光照射的区域进行材质渲染的方式例如可以为:可以对游戏场景内所有未被直接光照射的区域对应的物体进行材质渲染;也可以根据用户的选择操作,仅对游戏场景内未被直接光照射的区域中的几个被选中物体进行材质渲染;也可以根据用户的选择操作,仅对游戏场景内未被直接光照射的区域中多个类型的物体中,被选中的目标类型的多个物体进行材质渲染;具体材质渲染对象的确定可以根据用户需要灵活调整,并不以上述实施例给出的为限。Optionally, in some possible embodiments, the method of performing material rendering on areas not illuminated by direct light may be, for example: performing material rendering on objects corresponding to all areas not illuminated by direct light in the game scene; or performing material rendering on only a few selected objects in areas not illuminated by direct light in the game scene based on user selection; or performing material rendering on only multiple objects of a selected target type among multiple types of objects in areas not illuminated by direct light in the game scene based on user selection; the determination of specific material rendering objects may be flexibly adjusted based on user needs and is not limited to the above embodiments.

其中,由于遮挡等原因游戏场景内未被直接光照射的区域即为当前场景的暗部区域,例如被高楼或植物遮挡的部分区域、或处于完全没有光源的洞穴或室内等区域即为当前游戏场景内的暗部区域,第二材质渲染参数用于控制暗部区域的渲染效果。Among them, the area in the game scene that is not directly illuminated by light due to occlusion and other reasons is the dark area of the current scene. For example, some areas blocked by high-rise buildings or plants, or areas in caves or indoors with no light source at all are the dark areas in the current game scene. The second material rendering parameter is used to control the rendering effect of the dark area.

采用本申请提供的游戏场景渲染方法,由于渲染是通过直接获取待渲染物体的材质着色器的第一材质渲染参数和第二材质渲染参数,并根据第一材质渲染参数和第二材质渲染参数分别对游戏场景内直接光照射区域和未被直接光照射的区域进行材质渲染,不需要对游戏场景内未被直接光照射的区域进行额外的光照处理,通过简单的方式就可以调节游戏场景中直接光照射区域和未被直接光照射的区域的效果,从而平衡游戏场景内直接光照射区域和未被直接光照射的区域的对比,从而避免未被直接光照射区域的“死黑”效果,提高游戏场景的渲染效果,并且,可保证渲染后游戏场景中直接光照射区域和未被直接光照射区域的之间的层次效果,渲染效果更真实。By adopting the game scene rendering method provided by the present application, since the rendering is performed by directly obtaining the first material rendering parameter and the second material rendering parameter of the material shader of the object to be rendered, and material rendering is performed on the directly illuminated area and the not directly illuminated area in the game scene according to the first material rendering parameter and the second material rendering parameter, there is no need to perform additional lighting processing on the not directly illuminated area in the game scene. The effects of the directly illuminated area and the not directly illuminated area in the game scene can be adjusted in a simple manner, thereby balancing the contrast between the directly illuminated area and the not directly illuminated area in the game scene, thereby avoiding the "dead black" effect of the not directly illuminated area, improving the rendering effect of the game scene, and ensuring the layering effect between the directly illuminated area and the not directly illuminated area in the game scene after rendering, and the rendering effect is more realistic.

可选地,在上述实施例的基础上,本申请实施例还可提供一种游戏场景渲染方法,如下结合附图对上述方法中获取材质渲染参数的实现过程进行示例说明。图2为本申请另一实施例提供的一种游戏场景渲染方法的流程示意图,如图2所示,S101可包括:Optionally, based on the above embodiment, the embodiment of the present application may also provide a game scene rendering method. The following is an example of the implementation process of obtaining material rendering parameters in the above method in conjunction with the accompanying drawings. Figure 2 is a flowchart of a game scene rendering method provided by another embodiment of the present application. As shown in Figure 2, S101 may include:

S104:通过材质着色器的配置界面上第一配置区域,获取第一材质渲染参数。S104: Obtaining a first material rendering parameter through a first configuration area on a configuration interface of a material shader.

其中,第一配置区域用于接收第一材质渲染参数,例如可以为通过设置界面的形式,在设置界面预先设置的对应位置上显示第一配置区域,用户可以通过在第一配置区域输入参数的形式,确定获取到的用户输入的参数为第一材质渲染参数。Among them, the first configuration area is used to receive the first material rendering parameters. For example, the first configuration area can be displayed at a corresponding position pre-set in the setting interface in the form of a setting interface. The user can determine that the user-input parameters obtained are the first material rendering parameters by entering parameters in the first configuration area.

S105:通过材质着色器的配置界面上第二配置区域,获取第二材质渲染参数。S105: Obtain second material rendering parameters through a second configuration area on a configuration interface of the material shader.

其中,第一配置区域用于接收第一材质渲染参数,在一些可能的实施例中,例如可以为通过设置界面的形式,在设置界面预先设置的对应位置上显示第二配置区域(其中,第一配置区域和第二配置区域为设置界面上的不同区域),用户可以通过在第二配置区域输入参数的形式,确定获取到的用户输入的参数为第二材质渲染参数。Among them, the first configuration area is used to receive the first material rendering parameters. In some possible embodiments, for example, the second configuration area can be displayed at a corresponding position pre-set in the setting interface in the form of a setting interface (wherein the first configuration area and the second configuration area are different areas on the setting interface). The user can determine that the user-input parameters obtained are the second material rendering parameters by entering parameters in the second configuration area.

可选地,第一材质渲染参数和第二材质渲染参数可以为美术人员手动配置的,也可以为美术人员在预设配置选项中通过选择操作确定的,具体材质渲染参数的确定方式可以根据用户需要灵活调整,本申请在此不做任何限制。Optionally, the first material rendering parameter and the second material rendering parameter can be manually configured by an artist, or can be determined by the artist through selection operations in preset configuration options. The specific method of determining the material rendering parameters can be flexibly adjusted according to user needs, and this application does not impose any restrictions here.

可选地,在上述实施例的基础上,本申请实施例还可提供一种游戏场景渲染方法,如下结合附图对上述方法中获取第一材质渲染参数的实现过程进行示例说明。图3为本申请另一实施例提供的一种游戏场景渲染方法的流程示意图,如图3所示,S104可包括:Optionally, based on the above embodiment, the embodiment of the present application may also provide a game scene rendering method. The following is an example of the implementation process of obtaining the first material rendering parameter in the above method in conjunction with the accompanying drawings. Figure 3 is a flowchart of a game scene rendering method provided by another embodiment of the present application. As shown in Figure 3, S104 may include:

S106:接收通过第一配置区域输入的材质贴图。S106: Receive a material map input through the first configuration area.

在一些可能的实施例中,材质贴图可以为从预设材质贴图库中的多个材质贴图中选择的一张材质贴图,也可以为美术人员绘制的一张材质贴图,也可以为从网络上爬取得到的材质贴图,具体材质贴图的获取方式可以根据用户需要灵活调整,并不以上述实施例给出的为限。In some possible embodiments, the material map can be a material map selected from multiple material maps in a preset material map library, or a material map drawn by an artist, or a material map crawled from the Internet. The specific method of obtaining the material map can be flexibly adjusted according to user needs and is not limited to the above embodiments.

S107:从材质贴图中预设通道中读取第一材质渲染参数。S107: Reading a first material rendering parameter from a preset channel in a material map.

其中,材质贴图中预设通道记录有对应类型的材质渲染参数,用于根据材质贴图中对应类型的材质渲染参数对直接光照射区域进行材质渲染,使得若需要更换直接光照射区域的材质,只需更换对应的材质贴图即可。Among them, the preset channel in the material map records the corresponding type of material rendering parameters, which are used to render the material of the directly illuminated area according to the corresponding type of material rendering parameters in the material map, so that if the material of the directly illuminated area needs to be changed, it is only necessary to change the corresponding material map.

在本申请的一个实施例中,可以从材质贴图的R通道中读取第一金属度值,从材质贴图的G通道中读取第一粗糙度值,即根据读取到的第一金属度值对直接光照射区域的金属度进行材质渲染,根据读取到的第一粗糙度对直接光照射区域的粗糙度进行材质渲染。In one embodiment of the present application, the first metalness value can be read from the R channel of the material map, and the first roughness value can be read from the G channel of the material map, that is, the metalness of the directly illuminated area is material rendered according to the read first metalness value, and the roughness of the directly illuminated area is material rendered according to the read first roughness.

可选地,在上述实施例的基础上,本申请实施例还可提供一种游戏场景渲染方法,如下结合附图对上述方法中获取第一材质渲染参数的实现过程进行示例说明。图4为本申请另一实施例提供的一种游戏场景渲染方法的流程示意图,如图4所示,S105可包括:Optionally, based on the above embodiment, the embodiment of the present application may also provide a game scene rendering method. The following is an example of the implementation process of obtaining the first material rendering parameter in the above method in conjunction with the accompanying drawings. Figure 4 is a flowchart of a game scene rendering method provided by another embodiment of the present application. As shown in Figure 4, S105 may include:

S108:接收通过第二配置区域输入的预设类型的材质渲染参数。S108: Receive a preset type of material rendering parameter input through the second configuration area.

其中,第二材质渲染参数包括:预设类型的材质渲染参数。The second material rendering parameters include: material rendering parameters of a preset type.

可选地,在本申请的一个实施例中,第二配置区域中具有:至少一个预设类型的材质渲染参数的输入框;S108即为接收通过每个预设类型的材质渲染参数的输入框所输入的每个预设类型的材质渲染参数:第二材质渲染参数包括:至少一个预设类型的材质渲染参数。Optionally, in one embodiment of the present application, the second configuration area has: an input box for at least one preset type of material rendering parameter; S108 is to receive each preset type of material rendering parameter input through the input box for each preset type of material rendering parameter: the second material rendering parameters include: at least one preset type of material rendering parameter.

示例地,至少一个预设类型的材质渲染参数可以包括:第二金属度值,和/或,第二粗糙度值,在本申请的一个实施例中,至少一个预设类型的材质渲染参数包括:第二金属度值和第二粗糙度值;其取值例如可以为0-1范围内的任意值,其中,第二金属度值为0时,表示当前材质对应的效果完全不是金属质感的,而第二金属度值越靠近1时,表示当前材质对应的效果金属质感越强;第二粗糙度值则是越靠近0时,表示当前材质对应的效果粗糙度越低,即当前材质对应的效果越光滑,第二粗糙度值越靠近1时,表示当前材质对应的效果粗糙度越高,即当前材质对应的效果越不光滑;但是应当理解预设类型的材质,渲染参数具体包括的内容均可以根据用户需要灵活调整,并不以上述实施例给出的为限。For example, at least one preset type of material rendering parameter may include: a second metallic value, and/or a second roughness value. In one embodiment of the present application, at least one preset type of material rendering parameter includes: a second metallic value and a second roughness value; its value may be, for example, any value in the range of 0-1, wherein when the second metallic value is 0, it indicates that the effect corresponding to the current material is not metallic at all, and the closer the second metallic value is to 1, the stronger the metallic texture of the effect corresponding to the current material; the closer the second roughness value is to 0, the lower the roughness of the effect corresponding to the current material, that is, the smoother the effect corresponding to the current material, and the closer the second roughness value is to 1, the higher the roughness of the effect corresponding to the current material, that is, the less smooth the effect corresponding to the current material; however, it should be understood that for materials of the preset type, the specific contents included in the rendering parameters can be flexibly adjusted according to user needs, and are not limited to the above embodiments.

采用本申请提供的方法,相对于现有技术中只读取第一材质渲染参数的方式,本申请额外增设第二材质渲染参数,取代原来只读取一套参数的方法,从而通过简单的设置就可以实现场景内亮部和暗部效果的配置,无需根据直接光、间接光进行交互计算等复杂流程,后续若需要对亮部和暗部的效果进行修改,也只需要经过简单的修改就可以实现场景内亮部和暗部效果的修改,提高了美术人员的工作效率。By adopting the method provided by the present application, compared with the method of only reading the first material rendering parameters in the prior art, the present application additionally adds a second material rendering parameter to replace the original method of only reading a set of parameters. Thus, the configuration of the bright and dark effects in the scene can be achieved through simple settings, without the need for complex processes such as interactive calculations based on direct light and indirect light. If the effects of the bright and dark parts need to be modified later, only simple modifications are required to achieve the modification of the bright and dark effects in the scene, thereby improving the work efficiency of artists.

可选地,在上述实施例的基础上,本申请实施例还可提供一种游戏场景渲染方法,如下结合附图对上述方法中对未被直接光照射的区域进行材质渲染的实现过程进行示例说明。图5为本申请另一实施例提供的一种游戏场景渲染方法的流程示意图,如图5所示,S103可包括:Optionally, based on the above embodiment, the embodiment of the present application may also provide a game scene rendering method. The following is an example of the implementation process of material rendering for areas not directly illuminated by light in the above method in conjunction with the accompanying drawings. FIG5 is a flowchart of a game scene rendering method provided by another embodiment of the present application. As shown in FIG5, S103 may include:

S109:根据第二材质渲染参数,对基于物理的渲染方法的渲染管线的间接光的高光项进行配置。S109: According to the second material rendering parameter, a highlight item of indirect light of a rendering pipeline based on a physically based rendering method is configured.

采用本申请提供的方法,由于对渲染管线中的PBR的部分进行了改进,通过处理PBR中读取的IBL的部分,使得待渲染物体的材质着色器可以接收单独的第一材质渲染参数和第二材质渲染参数,即本申请提供的方法中PBR需要接收两份不同的材质渲染参数,再根据接收到的不同的材质渲染参数对游戏场景内的不同区域进行材质渲染,两份不同的材质渲染参数分别用于对当前游戏场景内的亮部区域和暗部区域的材质效果进行渲染;其中,可以根据第二材质渲染参数,对PBR的渲染管线的间接光的IBL部分的高光项进行配置,用于后续IBL中的高光计算。By adopting the method provided in the present application, since the PBR part in the rendering pipeline is improved, by processing the part of the IBL read in the PBR, the material shader of the object to be rendered can receive separate first material rendering parameters and second material rendering parameters, that is, in the method provided in the present application, the PBR needs to receive two different material rendering parameters, and then perform material rendering on different areas in the game scene according to the received different material rendering parameters, and the two different material rendering parameters are used to render the material effects of the bright area and the dark area in the current game scene, respectively; wherein, the highlight item of the IBL part of the indirect light of the PBR rendering pipeline can be configured according to the second material rendering parameter, for use in the subsequent highlight calculation in the IBL.

S110:基于配置后的渲染管线,对待渲染物体上未被直接光照射的区域进行材质渲染。S110: Based on the configured rendering pipeline, material rendering is performed on the area of the object to be rendered that is not illuminated by direct light.

在本申请的实施例中,将直接光照射区域(亮部)和未被直接光照射区域(亮部)的材质渲染是分开进行的,具体是根据第一材质渲染参数对目标亮部区域进行渲染,根据第二材质渲染参数对目标暗部区域进行渲染,最终场景内的着色效果包括被直接光照射区域的材质渲染后的结果,和未被直接光照射区域的材质渲染后的结果。In an embodiment of the present application, the material rendering of the directly illuminated area (bright part) and the area not directly illuminated by light (bright part) are performed separately. Specifically, the target bright area is rendered according to the first material rendering parameter, and the target dark area is rendered according to the second material rendering parameter. The final shading effect in the scene includes the result of material rendering of the area illuminated by direct light and the result of material rendering of the area not directly illuminated by light.

如下结合游戏场景中虚拟雪地层的渲染进行示例说明。图6为本申请一实施例提供的配置界面示意图,如图6所示,示例地,以当前游戏场景渲染方法为针对游戏场景中雪地层的渲染为例进行说明:物体材质着色器配置界面例如可以为地形镶嵌材质着色器配置界面,配置界面上例如可以包括地形标准参数、雪地基础颜色参数等参数配置区域,此外,可以在物体材质着色器配置界面额外设置第二配置区域130,用于接收第二材质渲染参数;此时雪地层Snow Layer中除了标准参数和基础参数配置区域外,还分层了两部分配置区域:第一配置区域120和第二配置区域130,分别用于读取亮部区域和暗部区域对应的不同的金属度和粗糙度,并根据读取到的参数对当前游戏场景内的待渲染物体进行后续的材质渲染。The following is an example description in conjunction with the rendering of a virtual snow layer in a game scene. Figure 6 is a schematic diagram of a configuration interface provided by an embodiment of the present application. As shown in Figure 6, for example, the current game scene rendering method is used as an example for rendering a snow layer in a game scene: the object material shader configuration interface can be, for example, a terrain mosaic material shader configuration interface, and the configuration interface can include, for example, parameter configuration areas such as terrain standard parameters and snow basic color parameters. In addition, a second configuration area 130 can be additionally set in the object material shader configuration interface for receiving second material rendering parameters; at this time, in addition to the standard parameter and basic parameter configuration areas, the snow layer Snow Layer also has two layered configuration areas: a first configuration area 120 and a second configuration area 130, which are respectively used to read different metallicities and roughnesses corresponding to bright areas and dark areas, and perform subsequent material rendering on the objects to be rendered in the current game scene according to the read parameters.

其中:第一个分层是通过第一配置区域120,即雪层混合参数SnowLayer Mix接口读取第一材质渲染参数,该接口读取的是一张材质贴图,其中材质贴图中的R通道存储的是金属度值,G通道则是粗糙度值,根据读取到的两个参数确定第一材质渲染参数,再根据第一材质渲染参数对被直接光照射的亮部区域进行材质渲染,若美术人员需要对当前游戏场景内两部区域的材质效果进行修改,可以直接通过修改材质贴图的方式,来修改上述接口对应的第一材质渲染参数,从而调整当前游戏场景内亮部区域对应的材质效果。Among them: the first layer is to read the first material rendering parameter through the first configuration area 120, that is, the snow layer mixing parameter SnowLayer Mix interface. The interface reads a material map, wherein the R channel in the material map stores the metalness value, and the G channel stores the roughness value. The first material rendering parameter is determined according to the two parameters read, and then the material rendering is performed on the bright area illuminated by direct light according to the first material rendering parameter. If the artist needs to modify the material effects of the two areas in the current game scene, the first material rendering parameter corresponding to the above interface can be modified directly by modifying the material map, thereby adjusting the material effect corresponding to the bright area in the current game scene.

第二个分层是通过第二配置区域130,即雪层金属度规格参数SnowLayerSpecCubeMetallic接口和雪层粗糙度规格参数SnowLayerSpecCube Roughness接口读取第二材质渲染参数,再根据第二材质渲染参数对未被直接光照射的暗部区域进行材质渲染;上述第二配置区域130中的两个接口用于读取对应的材质渲染参数,其分别允许接收一个从0至1范围的值,不同的值对应不同的粗糙度或金属度,用于后续根据读取到的两个接口的值处理暗部区域的金属度和粗糙度;对游戏场景的配置过程中,若美术人员需要对当前游戏场景内暗部区域的材质效果进行修改,可以直接在参数配置界面对应的第一配置区域120和第二配置区域130上,通过修改这两个接口分别对应的材质渲染参数的方式,来调整当前游戏场景内暗部区域对应的材质效果。The second layering is to read the second material rendering parameters through the second configuration area 130, namely the snow layer metallicity specification parameter SnowLayerSpecCubeMetallic interface and the snow layer roughness specification parameter SnowLayerSpecCube Roughness interface, and then perform material rendering on the dark area not directly illuminated by light according to the second material rendering parameters; the two interfaces in the above-mentioned second configuration area 130 are used to read the corresponding material rendering parameters, which respectively allow receiving a value ranging from 0 to 1, and different values correspond to different roughness or metallicity, which is used to subsequently process the metallicity and roughness of the dark area according to the values of the two interfaces read; in the process of configuring the game scene, if the artist needs to modify the material effect of the dark area in the current game scene, he can directly adjust the material effect corresponding to the dark area in the current game scene by modifying the material rendering parameters corresponding to these two interfaces in the first configuration area 120 and the second configuration area 130 corresponding to the parameter configuration interface.

本申请提供的方法中,PBR计算需要接收用于处理当前游戏场景内亮部材质效果和暗部材质效果的两份不同的金属度和粗糙度值,其中在IBL的部分,使其所需的金属度和粗糙度值使用本申请中增加第二配置区域,其中第二配置区域包括两个接口(SnowLayerSpecCube Metallic和SnowLayerSpecCube Roughness),使得采用本申请提供的方法对当前游戏场景内的材质效果进行修改时,仅需通过简单的参数修改就可以对亮部材质效果和暗部材质效果进行修改,简化了美术人员的操作,使美术人员可以较为简单地控制游戏场景中亮部与暗部的材质效果。In the method provided in the present application, the PBR calculation needs to receive two different metallicity and roughness values for processing the bright material effects and the dark material effects in the current game scene. In the IBL part, the required metallicity and roughness values are used to add a second configuration area in the present application, wherein the second configuration area includes two interfaces (SnowLayerSpecCube Metallic and SnowLayerSpecCube Roughness). When the method provided in the present application is used to modify the material effects in the current game scene, the bright material effects and the dark material effects can be modified by simply modifying the parameters, which simplifies the operation of the artists and allows the artists to control the bright and dark material effects in the game scene more easily.

采用本申请提供的游戏场景渲染方法,通过在第一配置区域和第二配置区域对第一材质渲染参数和第二材质渲染参数的配置结果,分别对目标亮部区域和目标暗部区域进行渲染,相对于传统技术中的根据直接光和间接光的交互实现对暗部区域渲染的方式,本申请提供的渲染方法简单易操作易修改,方便美术人员通过调节第一材质渲染参数和第二材质渲染参数去控制游戏场景内任何材质的物体亮部和暗部的效果。By adopting the game scene rendering method provided by the present application, the target bright area and the target dark area are rendered respectively by configuring the first material rendering parameters and the second material rendering parameters in the first configuration area and the second configuration area. Compared with the traditional technology of rendering the dark area according to the interaction of direct light and indirect light, the rendering method provided by the present application is simple, easy to operate and easy to modify, which makes it convenient for artists to control the bright and dark effects of objects of any material in the game scene by adjusting the first material rendering parameters and the second material rendering parameters.

下述结合附图对本申请所提供的游戏场景渲染装置进行解释说明,该游戏场景渲染装置可执行上述图1-图6任一游戏场景渲染方法,其具体实现以及有益效果参照上述,如下不再赘述。The following is an explanation of the game scene rendering device provided by the present application in conjunction with the accompanying drawings. The game scene rendering device can execute any of the game scene rendering methods shown in Figures 1 to 6 above. Its specific implementation and beneficial effects are referred to above and will not be repeated below.

图7为本申请一实施例提供的游戏场景渲染装置的结构示意图,如图7所示,该装置包括:获取模块201和渲染模块202,其中:FIG. 7 is a schematic diagram of the structure of a game scene rendering device provided by an embodiment of the present application. As shown in FIG. 7 , the device includes: an acquisition module 201 and a rendering module 202, wherein:

获取模块201,用于通过游戏场景中待渲染物体的材质着色器,获取待渲染物体的第一材质渲染参数和第二材质渲染参数。The acquisition module 201 is used to acquire the first material rendering parameter and the second material rendering parameter of the object to be rendered through the material shader of the object to be rendered in the game scene.

渲染模块202,用于根据第一材质渲染参数,采用基于物理的渲染方法,对待渲染物体上直接光照射区域进行材质渲染;根据第二材质渲染参数,采用基于物理的渲染方法,对待渲染物体上未被直接光照射的区域进行材质渲染。The rendering module 202 is used to perform material rendering on the directly illuminated area of the rendered object using a physically based rendering method according to the first material rendering parameter; and to perform material rendering on the not directly illuminated area of the rendered object using a physically based rendering method according to the second material rendering parameter.

可选地,获取模块201,具体用于通过材质着色器的配置界面上第一配置区域,获取第一材质渲染参数;通过材质着色器的配置界面上第二配置区域,获取第二材质渲染参数。Optionally, the acquisition module 201 is specifically used to acquire a first material rendering parameter through a first configuration area on a configuration interface of a material shader; and acquire a second material rendering parameter through a second configuration area on the configuration interface of the material shader.

图8为本申请一实施例提供的游戏场景渲染装置的结构示意图,如图8所示,该装置还包括:接收模块203和读取模块204,其中:FIG8 is a schematic diagram of the structure of a game scene rendering device provided by an embodiment of the present application. As shown in FIG8 , the device further includes: a receiving module 203 and a reading module 204, wherein:

接收模块203,用于接收通过第一配置区域输入的材质贴图;The receiving module 203 is used to receive the material map input through the first configuration area;

读取模块204,用于从材质贴图中预设通道中读取第一材质渲染参数;材质贴图中预设通道记录有对应类型的材质渲染参数。The reading module 204 is used to read the first material rendering parameter from the preset channel in the material map; the preset channel in the material map records the material rendering parameter of the corresponding type.

可选地,读取模块204,具体用于从材质贴图的R通道中读取第一金属度值,从材质贴图的G通道中读取第一粗糙度值。Optionally, the reading module 204 is specifically configured to read the first metalness value from the R channel of the texture map, and read the first roughness value from the G channel of the texture map.

可选地,接收模块203,具体用于接收通过第二配置区域输入的预设类型的材质渲染参数,第二材质渲染参数包括:预设类型的材质渲染参数。Optionally, the receiving module 203 is specifically configured to receive a preset type of material rendering parameter input through the second configuration area, and the second material rendering parameter includes: a preset type of material rendering parameter.

可选地,接收模块203,具体用于接收通过每个预设类型的材质渲染参数的输入框所输入的每个预设类型的材质渲染参数:第二材质渲染参数包括:至少一个预设类型的材质渲染参数。Optionally, the receiving module 203 is specifically configured to receive a material rendering parameter of each preset type input through an input box of the material rendering parameter of each preset type: the second material rendering parameter includes: at least one material rendering parameter of the preset type.

如图8所示,该装置还包括:配置模块205,用于根据第二材质渲染参数,对基于物理的渲染方法的渲染管线的间接光的高光项进行配置;As shown in FIG8 , the apparatus further includes: a configuration module 205 for configuring a highlight item of indirect light of a rendering pipeline of a physically based rendering method according to a second material rendering parameter;

渲染模块202,具体用于基于配置后的渲染管线,对待渲染物体上未被直接光照射的区域进行材质渲染。The rendering module 202 is specifically configured to perform material rendering on the area of the object to be rendered that is not illuminated by direct light based on the configured rendering pipeline.

上述装置用于执行前述实施例提供的方法,其实现原理和技术效果类似,在此不再赘述。The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

以上这些模块可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(Application Specific Integrated Circuit,简称ASIC),或,一个或多个微处理器(digital singnal processor,简称DSP),或,一个或者多个现场可编程门阵列(Field Programmable Gate Array,简称FPGA)等。再如,当以上某个模块通过处理元件调度程序代码的形式实现时,该处理元件可以是通用处理器,例如中央处理器(CentralProcessing Unit,简称CPU)或其它可以调用程序代码的处理器。再如,这些模块可以集成在一起,以片上系统(system-on-a-chip,简称SOC)的形式实现。The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

图9为本申请一实施例提供的游戏场景渲染设备的结构示意图,该游戏场景渲染设备可以集成于终端设备或者终端设备的芯片。FIG9 is a schematic diagram of the structure of a game scene rendering device provided in an embodiment of the present application. The game scene rendering device may be integrated into a terminal device or a chip of the terminal device.

如图9所示,该游戏场景渲染设备包括:处理器501、存储介质502和总线503。As shown in FIG. 9 , the game scene rendering device includes: a processor 501 , a storage medium 502 and a bus 503 .

处理器501用于存储程序,处理器501调用存储介质502存储的程序,以执行上述图1-图6对应的方法实施例。具体实现方式和技术效果类似,这里不再赘述。The processor 501 is used to store programs, and the processor 501 calls the programs stored in the storage medium 502 to execute the method embodiments corresponding to the above Figures 1 to 6. The specific implementation methods and technical effects are similar and will not be repeated here.

可选地,本申请还提供一种程序产品,例如存储介质,该存储介质上存储有计算机程序,包括程序,该程序在被处理器运行时执行上述方法对应的实施例。Optionally, the present application also provides a program product, such as a storage medium, on which a computer program is stored, including a program that, when executed by a processor, executes an embodiment corresponding to the above method.

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

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

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(英文:processor)执行本申请各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取存储器(英文:Random Access Memory,简称:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

Claims (10)

1.A method of rendering a game scene, the method comprising:
acquiring a first material rendering parameter and a second material rendering parameter of an object to be rendered in a game scene through a material shader of the object to be rendered; wherein, the first material rendering parameter comprises a first metal value and a first roughness value; the second material rendering parameter comprises a second metal value and a second roughness value;
According to the first material rendering parameters and the selection operation of the user, adopting a physical-based rendering method to render the material on the object selected by the selection operation of the user or the direct light irradiation area on the object of the selected type in the object to be rendered;
according to the second material rendering parameters, adopting a physical-based rendering method to render materials on an area, which is not directly irradiated by light, of the objects to be rendered, which are selected based on the selection operation of the user or the objects of the selected type;
and performing material rendering on an area, which is not directly irradiated by light, on an object selected based on the selection operation of the user or an object of a selected type in the object to be rendered by adopting a physical-based rendering method according to the second material rendering parameter, wherein the material rendering comprises:
Configuring a highlight item of indirect light of a rendering pipeline of the physical-based rendering method according to the second material rendering parameter;
And based on the configured rendering pipeline, rendering the material of the area, which is not directly irradiated by light, of the object to be rendered.
2. The method of claim 1, wherein the obtaining, by a texture shader of an object to be rendered in a game scene, the first texture rendering parameter and the second texture rendering parameter of the object to be rendered comprises:
Acquiring the first material rendering parameters through a first configuration area on a configuration interface of the material shader;
And acquiring the second material rendering parameters through a second configuration area on the configuration interface of the material shader.
3. The method of claim 2, wherein the obtaining the first texture rendering parameter through a first configuration area on a configuration interface of the texture shader comprises:
receiving a texture map input through the first configuration region;
Reading the first material rendering parameters from a preset channel in the material map; and the preset channel in the texture map records corresponding types of texture rendering parameters.
4. The method of claim 3, wherein the reading the first texture rendering parameter from the predetermined channel in the texture map comprises:
And reading a first metal value from the R channel of the texture map and reading a first roughness value from the G channel of the texture map.
5. The method of claim 2, wherein the obtaining the second texture rendering parameter through a second configuration area on a configuration interface of the texture shader comprises:
Receiving a preset type of material rendering parameter input through the second configuration area, wherein the second material rendering parameter comprises: and the preset type of material rendering parameters.
6. The method of claim 5, wherein the second configuration region has: at least one input box of material rendering parameters of a preset type;
The receiving the preset type of material rendering parameters input through the second configuration area includes:
Receiving the material rendering parameters of each preset type input through an input box of the material rendering parameters of each preset type: the second material rendering parameters include: the at least one preset type of material rendering parameter.
7. The method of claim 6, wherein the at least one predetermined type of material rendering parameter comprises: a second metallization value, and/or a second roughness value.
8. A game scene rendering device, the device comprising: the device comprises an acquisition module and a rendering module, wherein:
The acquisition module is used for acquiring a first material rendering parameter and a second material rendering parameter of an object to be rendered through a material shader of the object to be rendered in a game scene; wherein, the first material rendering parameter comprises a first metal value and a first roughness value; the second material rendering parameter comprises a second metal value and a second roughness value;
The rendering module is used for rendering the material on the direct light irradiation area on the object selected by the selection operation of the user or the object of the selected type in the object to be rendered by adopting a physical-based rendering method according to the first material rendering parameter and the selection operation of the user; according to the second material rendering parameters, adopting a physical-based rendering method to render materials on an area, which is not directly irradiated by light, of the objects to be rendered, which are selected based on the selection operation of the user or the objects of the selected type;
The device also comprises a configuration module, a processing module and a processing module, wherein the configuration module is used for configuring a highlight item of indirect light of a rendering pipeline of the physical-based rendering method according to the second material rendering parameter; and based on the configured rendering pipeline, rendering the material of the area, which is not directly irradiated by light, of the object to be rendered.
9. A game scene rendering device, the device comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor in communication with the storage medium via the bus when the game scene rendering device is in operation, the processor executing the machine-readable instructions to perform the method of any of the preceding claims 1-7.
10. A storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any of the preceding claims 1-7.
CN202011075527.2A 2020-10-09 2020-10-09 Game scene rendering method, device, equipment and storage medium Active CN112190936B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011075527.2A CN112190936B (en) 2020-10-09 2020-10-09 Game scene rendering method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011075527.2A CN112190936B (en) 2020-10-09 2020-10-09 Game scene rendering method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112190936A CN112190936A (en) 2021-01-08
CN112190936B true CN112190936B (en) 2024-10-29

Family

ID=74013229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011075527.2A Active CN112190936B (en) 2020-10-09 2020-10-09 Game scene rendering method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112190936B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113052947B (en) * 2021-03-08 2022-08-16 网易(杭州)网络有限公司 Rendering method, rendering device, electronic equipment and storage medium
CN114581575A (en) * 2021-12-13 2022-06-03 北京市建筑设计研究院有限公司 Model rendering processing method and device and electronic equipment
CN114842126A (en) * 2022-03-31 2022-08-02 网易(杭州)网络有限公司 Streamer effect rendering method and device and electronic equipment
CN116310052B (en) * 2022-09-07 2025-05-20 北京字跳网络技术有限公司 Picture rendering method based on multiple light sources and related equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110193193A (en) * 2019-06-10 2019-09-03 网易(杭州)网络有限公司 The rendering method and device of scene of game
CN111068312A (en) * 2019-12-02 2020-04-28 网易(杭州)网络有限公司 Game picture rendering method and device, storage medium and electronic equipment

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10198856B2 (en) * 2013-11-11 2019-02-05 Oxide Interactive, LLC Method and system of anti-aliasing shading decoupled from rasterization
US10269166B2 (en) * 2016-02-16 2019-04-23 Nvidia Corporation Method and a production renderer for accelerating image rendering
US10893262B2 (en) * 2017-02-07 2021-01-12 Siemens Healthcare Gmbh Lightfield rendering based on depths from physically-based volume rendering
CN107103638B (en) * 2017-05-27 2020-10-16 杭州万维镜像科技有限公司 Rapid rendering method of virtual scene and model
CN108434742B (en) * 2018-02-02 2019-04-30 网易(杭州)网络有限公司 The treating method and apparatus of virtual resource in scene of game
CN111127624A (en) * 2019-12-27 2020-05-08 珠海金山网络游戏科技有限公司 Illumination rendering method and device based on AR scene
CN111210497B (en) * 2020-01-16 2023-11-28 网易(杭州)网络有限公司 Model rendering method and device, computer readable medium and electronic equipment
CN111467807B (en) * 2020-05-18 2023-04-07 网易(杭州)网络有限公司 Snow melting effect rendering method and device, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110193193A (en) * 2019-06-10 2019-09-03 网易(杭州)网络有限公司 The rendering method and device of scene of game
CN111068312A (en) * 2019-12-02 2020-04-28 网易(杭州)网络有限公司 Game picture rendering method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN112190936A (en) 2021-01-08

Similar Documents

Publication Publication Date Title
CN112190936B (en) Game scene rendering method, device, equipment and storage medium
US20230247305A1 (en) Virtual Camera for 3-D Modeling Applications
US12051145B2 (en) System for non-planar specular reflections in hybrid ray tracing
CN107749077B (en) Card ventilation grid shadow rendering method, device, equipment and medium
WO2024148928A1 (en) Voxel-lighting rendering method and apparatus, and computer device and storage medium
US9183654B2 (en) Live editing and integrated control of image-based lighting of 3D models
CN114119848B (en) Model rendering method and device, computer equipment and storage medium
JP7522316B2 (en) Image-based lighting effects processing method, apparatus, device and storage medium
CN114241115B (en) Lighting rendering method, device, computer equipment and storage medium for multi-point light sources
CN113298924B (en) A scene rendering method, computing device and storage medium
CN109712226A (en) The see-through model rendering method and device of virtual reality
CN113554738B (en) Panoramic image display method and device, electronic equipment and storage medium
CN113900797A (en) Three-dimensional oblique photography data processing method, device and equipment based on illusion engine
CN112233220A (en) OpenSceneGraph-based volume light generation method, device, equipment and storage medium
CN116758208A (en) Global illumination rendering method and device, storage medium and electronic equipment
JP4975159B2 (en) Colorless lighting in a graphics system, method and program for generating graphics images
CN114367105B (en) Model coloring method, device, apparatus, medium, and program product
CN115526977A (en) Game picture rendering method and device
CN116152420A (en) A rendering method and device
CN115428029A (en) System and method for real-time ray tracing in 3D environments
JP2007272847A (en) Lighting simulation method and image composition method
CN114596403B (en) Image processing method, device, storage medium and terminal
CN115272558A (en) WEBGL-based jewelry rendering method and device, terminal equipment and storage medium
CN117065333A (en) Game screen display method and device, equipment and storage medium
Bashford-Rogers et al. Approximate visibility grids for interactive indirect illumination

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant