WO2022217922A1 - Method and apparatus for rendering model, storage medium, and computing device - Google Patents

Method and apparatus for rendering model, storage medium, and computing device Download PDF

Info

Publication number
WO2022217922A1
WO2022217922A1 PCT/CN2021/132560 CN2021132560W WO2022217922A1 WO 2022217922 A1 WO2022217922 A1 WO 2022217922A1 CN 2021132560 W CN2021132560 W CN 2021132560W WO 2022217922 A1 WO2022217922 A1 WO 2022217922A1
Authority
WO
WIPO (PCT)
Prior art keywords
model
data
rendered
rendering
diffuse reflection
Prior art date
Application number
PCT/CN2021/132560
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 WO2022217922A1 publication Critical patent/WO2022217922A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/06Ray-tracing

Definitions

  • the present invention is proposed in order to provide a model rendering method, device, storage medium and computing device that overcomes the above problems or at least partially solves the above problems, which can be rendered without modifying the normal direction of the model itself.
  • the over-smoothed diffuse reflection data is also calculated, and the effect of unifying the diffuse reflection of the model to be rendered is achieved.
  • it can effectively reduce the rendering pressure of the game engine without adding additional data and use less model resources, thereby improving the overall performance of the game engine.
  • FIG. 4 schematically shows a light map after retaining the normal of the model to be rendered according to an embodiment of the present invention
  • the upward vector is defined in the material editor, that is, the upward vector is used to simulate the upward normal direction, so that the upward vector can be used to determine the diffuse reflection data of the model to be rendered, and no modification is required in this embodiment of the present invention
  • the normal direction of the model to be rendered itself can also calculate the over-smooth diffuse reflection data, and achieve the effect of unifying the diffuse reflection of the model to be rendered.
  • step S1042 the highlight data and the transmission data of the model to be rendered are calculated respectively, and the sum of the highlight data and the transmission data is obtained to obtain the superimposed data occluded by the shadow.
  • Transmission is the outgoing phenomenon of incident light rays after they have been refracted and passed through an object.
  • the objects to be transmitted can be transparent or translucent, such as objects made of glass, color filters, etc.
  • the intermediate server After the intermediate server receives the rendering request for the virtual scene including the slug model, the intermediate server can obtain the status information reported by each rendering server in the rendering cluster. Then, a target rendering server is determined from the rendering servers in the rendering cluster according to the state information of each rendering server.
  • the status information of the rendering server may include information such as whether the rendering server is online, the busyness of the rendering server, and the memory occupancy rate of the rendering server. Further, the determined target rendering server is requested to render the virtual scene containing the slug model, and the target rendering server can effectively render the slug model based on the final color data of the slug model calculated in the above embodiment. rendering.

Landscapes

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

Abstract

Disclosed are a method and apparatus for rendering a model, a storage medium, and a computing device. The method comprises: defining an upward vector in a material editor, and on the basis of the defined upward vector, determining diffuse reflection data of a model to be rendered; adding superposition data shielded by a shadow into said model, and obtaining shadow result data projected on said model, the superposition data comprising highlight data and transmission data of said model; and performing calculation using the diffuse reflection data, the superposition data, and the shadow result data according to a preset algorithm to obtain final color data of said model, and rendering said model on the basis of the final color data. Embodiments of the present invention can also achieve the effect of unifying the diffuse reflection of said model without modifying a normal direction of said model itself, and can further achieve a real and natural rendering effect without adding additional data, such that the rendering pressure of a game engine is reduced, and the overall performance of the game engine is improved.

Description

一种模型的渲染方法、装置、存储介质以及计算设备Model rendering method, device, storage medium and computing device
交叉引用cross reference
本申请要求于2021年4月16日提交、申请号为202110412345.8且名称为“一种模型的渲染方法、装置、存储介质以及计算设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on April 16, 2021, with the application number of 202110412345.8 and the title of "a model rendering method, device, storage medium and computing device", the entire contents of which are incorporated by reference in in this application.
技术领域technical field
本发明涉及模型渲染技术领域,特别是一种模型的渲染方法、装置、存储介质以及计算设备。The present invention relates to the technical field of model rendering, in particular to a model rendering method, device, storage medium and computing device.
背景技术Background technique
目前大多数项目都会采用插片的形式来模拟游戏场景中草的效果,但是由于模型本身的特性,在计算漫反射、高光、透射的时候都会出现各种错误的结果。为避免出现计算漫反射、高光、透射时结果错误,现有技术会通过修改插片草模型的法线朝向,让所有的模型法线全部垂直朝上,从而利用朝上的法线结果计算光照。此外,现有技术还会用更加细致的模型来模拟草,在模型上表现出草的形态,用模型本身的法线来计算光照。At present, most projects use the form of inserts to simulate the effect of grass in the game scene, but due to the characteristics of the model itself, various wrong results will appear when calculating diffuse reflection, highlight, and transmission. In order to avoid errors in the calculation of diffuse reflection, highlight, and transmission, the existing technology modifies the normal direction of the patch grass model so that all model normals are vertically upward, so as to use the upward normal results to calculate lighting. . In addition, the existing technology will use a more detailed model to simulate the grass, show the shape of the grass on the model, and use the normal of the model itself to calculate the lighting.
但是,在修改插片草模型的法线朝向之后,虽然在计算插片草模型的漫反射结果时草光影关系得到统一,但是在计算插片草模型的高光项时,由于法线朝向天空方向,计算出的额高光结果并不是由草的表面反射到人的眼睛,表现的结果是只有在逆光的时候才能看到高光,而在顺光的时候没有光线可以反射到人的眼睛,这与现实是不相符的,如图1所示的修改插片草模型的法线朝向后的漫反射方向ReflectionDir和人的观察方向ViewDir。而为了达到真实的效果若使用更加细致的模型来模拟草的形态,无疑会增加模型顶点的数量,从而加大渲染压力,影响渲染效率。However, after modifying the normal direction of the patch grass model, although the grass light and shadow relationship is unified when calculating the diffuse reflection result of the patch grass model, when calculating the highlight item of the patch grass model, the normal is facing the sky direction. , the calculated highlight result is not reflected by the surface of the grass to the human eyes. The result of the performance is that the highlights can only be seen when the light is backlit, and no light can be reflected to the eyes when the light is straight. This is similar to The reality is inconsistent. As shown in Figure 1, the normal of the modified patch grass model is oriented towards the diffuse reflection direction ReflectionDir and the human viewing direction ViewDir. In order to achieve a realistic effect, if a more detailed model is used to simulate the shape of the grass, the number of model vertices will undoubtedly increase, thereby increasing the rendering pressure and affecting the rendering efficiency.
发明内容SUMMARY OF THE INVENTION
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分 地解决上述问题的模型的渲染方法、装置、存储介质以及计算设备,能够在不修改待渲染模型本身的法线方向的基础上,同样计算得到过度平滑的漫反射数据,并达到让待渲染模型的漫反射统一的效果。而且可以在达到真实自然的渲染效果的基础上,无需增加额外的数据,使用较少的模型资源,有效地减小游戏引擎的渲染压力,进而提高游戏引擎的整体性能。In view of the above problems, the present invention is proposed in order to provide a model rendering method, device, storage medium and computing device that overcomes the above problems or at least partially solves the above problems, which can be rendered without modifying the normal direction of the model itself. Above, the over-smoothed diffuse reflection data is also calculated, and the effect of unifying the diffuse reflection of the model to be rendered is achieved. Moreover, on the basis of achieving a real and natural rendering effect, it can effectively reduce the rendering pressure of the game engine without adding additional data and use less model resources, thereby improving the overall performance of the game engine.
根据本发明的一个方面,提供了一种模型的渲染方法,包括:在材质编辑器中定义一个朝上向量,基于定义的朝上向量确定待渲染模型的漫反射数据;在所述待渲染模型中添加被影子遮挡的叠加数据,并获取投射到待渲染模型上的影子结果数据,所述叠加数据包含待渲染模型的高光数据和透射数据;将所述漫反射数据、所述叠加数据和所述影子结果数据按照预设算法计算得到待渲染模型的最终颜色数据,基于所述最终颜色数据对所述待渲染模型进行渲染。According to an aspect of the present invention, a method for rendering a model is provided, comprising: defining an upward vector in a material editor, and determining diffuse reflection data of a model to be rendered based on the defined upward vector; Add the overlay data that is occluded by the shadow, and obtain the shadow result data projected on the model to be rendered, the overlay data includes the highlight data and transmission data of the model to be rendered; the diffuse reflection data, the overlay data and all The shadow result data is calculated according to a preset algorithm to obtain final color data of the model to be rendered, and the model to be rendered is rendered based on the final color data.
根据本发明的另一方面,提供了一种模型的渲染装置,包括:According to another aspect of the present invention, a model rendering device is provided, comprising:
确定模块,适于在材质编辑器中定义一个朝上向量,基于定义的朝上向量确定待渲染模型的漫反射数据;添加模块,适于在所述上述待渲染模型中添加被影子遮挡的叠加数据,并获取投射到待渲染模型上的影子结果数据,所述上述叠加数据包含待渲染模型的高光数据和透射数据;渲染模块,适于将所述上述漫反射数据、所述上述叠加数据和所述上述影子结果数据按照预设算法计算得到待渲染模型的最终颜色数据,基于所述上述最终颜色数据对所述上述待渲染模型进行渲染。A determination module, suitable for defining an upward vector in the material editor, and determining the diffuse reflection data of the model to be rendered based on the defined upward vector; an adding module, suitable for adding a superposition occluded by shadows in the above-mentioned model to be rendered data, and obtain the shadow result data projected on the model to be rendered, the superimposed data includes the highlight data and transmission data of the model to be rendered; the rendering module is suitable for the above-mentioned diffuse reflection data, the above-mentioned superimposed data and The shadow result data is calculated according to a preset algorithm to obtain final color data of the model to be rendered, and the model to be rendered is rendered based on the final color data.
根据本发明的又一个方面,提供了一种计算设备,包括存储器、处理器及存储在存储器上的计算机程序/指令,所述处理器执行所述计算机程序/指令时实现上述第一方面所述方法的步骤。According to yet another aspect of the present invention, a computing device is provided, comprising a memory, a processor, and computer programs/instructions stored on the memory, and the processor implements the above-mentioned first aspect when executing the computer programs/instructions steps of the method.
根据本发明的再一方面,提供了一种计算机存储介质,其上存储有计算机程序/指令,所述计算机程序/指令被处理器执行时实现上述第一方面所述方法的步骤。。According to still another aspect of the present invention, a computer storage medium is provided, which stores computer programs/instructions, and when the computer programs/instructions are executed by a processor, implements the steps of the method in the first aspect. .
根据本发明的再一个方面,提供了一种计算机程序产品,包括计算机程序/指令,所述计算机程序/指令被处理器执行时实现上述第一方面所述方法 的步骤。According to yet another aspect of the present invention, a computer program product is provided, comprising a computer program/instruction, when the computer program/instruction is executed by a processor, the steps of the method described in the first aspect above are implemented.
本发明的有益效果为:在本发明实施例中,通过在材质编辑器中定义朝上向量,即利用朝上向量模拟朝上的法线方向,从而可利用朝上向量来确定待渲染模型的漫反射数据,本发明实施例无需修改待渲染模型本身的法线方向,同样可以计算出过度平滑的漫反射数据,并达到让待渲染模型的漫反射统一的效果。并且,由于无需修改待渲染模型本身的法线方向,后续计算待渲染模型的高光项时还可以有效地避免出现高光结果不是由草的表面反射到人的眼睛的情况。本发明实施例在待渲染模型中添加被影子遮挡的叠加数据,并利用漫反射数据、叠加数据和影子结果数据计算得到用于渲染待渲染模型的最终颜色数据,可以避免出现待渲染模型在光照射不到的地方被叠加上颜色的问题,从而达到真实且自然的渲染效果。本发明实施例在达到真实自然的渲染效果的基础上,没有增加额外的数据,且使用了较少的模型资源(如使用了较少的模型顶点数),有效地减小了游戏引擎的渲染压力,进而提高了游戏引擎的整体性能。The beneficial effects of the present invention are: in the embodiment of the present invention, by defining the upward vector in the material editor, that is, using the upward vector to simulate the upward normal direction, the upward vector can be used to determine the direction of the model to be rendered. For diffuse reflection data, the embodiment of the present invention does not need to modify the normal direction of the model to be rendered, and can also calculate excessively smooth diffuse reflection data, and achieve the effect of unifying the diffuse reflection of the model to be rendered. In addition, since there is no need to modify the normal direction of the model to be rendered, the subsequent calculation of the highlight item of the model to be rendered can also effectively avoid a situation where the highlight result is not reflected by the surface of the grass to human eyes. In this embodiment of the present invention, superimposed data occluded by shadows is added to the model to be rendered, and the final color data used for rendering the model to be rendered is calculated by using the diffuse reflection data, the superimposed data and the shadow result data, which can avoid the appearance of the model to be rendered in the light. The problem of color is superimposed on places that cannot be illuminated, so as to achieve a realistic and natural rendering effect. On the basis of achieving a real and natural rendering effect, the embodiments of the present invention do not add additional data, and use less model resources (for example, use less model vertices), effectively reducing the rendering of the game engine pressure, which in turn improves the overall performance of the game engine.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention, in order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand , the following specific embodiments of the present invention are given.
根据下文结合附图对本发明具体实施例的详细描述,本领域技术人员将会更加明了本发明的上述以及其他目的、优点和特征。The above and other objects, advantages and features of the present invention will be more apparent to those skilled in the art from the following detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,本发明的上述及各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。在附图中:The above and various other advantages and benefits of the present invention will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. In the attached image:
图1示意性地示出了现有技术的修改待渲染模型法线后的光照图;Fig. 1 schematically shows the light map after modifying the normal of the model to be rendered in the prior art;
图2示意性地示出了根据本发明一个实施例的模型的渲染方法的流程图;FIG. 2 schematically shows a flowchart of a model rendering method according to an embodiment of the present invention;
图3示意性地示出了根据本发明一个实施例的在待渲染模型中添加被影子遮挡的叠加数据的过程图;3 schematically shows a process diagram of adding overlay data occluded by shadows in a model to be rendered according to an embodiment of the present invention;
图4示意性地示出了根据本发明一个实施例的保留待渲染模型法线后的光照图;FIG. 4 schematically shows a light map after retaining the normal of the model to be rendered according to an embodiment of the present invention;
图5示意性地示出了根据本发明一个实施例的模型的渲染装置的结构图;FIG. 5 schematically shows a structural diagram of a model rendering apparatus according to an embodiment of the present invention;
图6示意性地示出了用于实现根据本发明的方法的计算设备的框图;以及Figure 6 schematically shows a block diagram of a computing device for implementing the method according to the present invention; and
图7示意性地示出了实现根据本发明的方法的计算机程序产品的框图。Figure 7 schematically shows a block diagram of a computer program product implementing the method according to the invention.
具体实施例specific embodiment
下面结合附图和具体的实施方式对本发明作进一步的描述。以下描述仅为说明本发明的基本原理而并非对其进行限制。The present invention will be further described below with reference to the accompanying drawings and specific embodiments. The following description is merely illustrative of the basic principles of the present invention and is not intended to limit it.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second" and the like in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.
为解决上述技术问题,本发明实施例提供了一种模型的渲染方法,图2示意性地示出了根据本发明一个实施例的模型的渲染方法的流程图,参见图2,该方法可以包括步骤S102至步骤S106。In order to solve the above technical problems, an embodiment of the present invention provides a model rendering method. FIG. 2 schematically shows a flowchart of a model rendering method according to an embodiment of the present invention. Referring to FIG. 2 , the method may include Steps S102 to S106.
在步骤S102,在材质编辑器中定义一个朝上向量,基于定义的朝上向量确定待渲染模型的漫反射数据。In step S102, an upward vector is defined in the material editor, and the diffuse reflection data of the model to be rendered is determined based on the defined upward vector.
本发明实施例中,漫反射指的是投射在物体的粗糙表面上的光向各个方向反射的现象。当一束平行的入射光线投射到物体的粗糙表面时,粗糙表面会把入射光线向着四面八方反射。入射光线虽然互相平行,但是由于物体表面上各点的法线方向不一致,因此会造成反射光线向不同的方向无规则地反 射,这种反射即为“漫反射”,当然,也可以称为“漫射”。In this embodiment of the present invention, diffuse reflection refers to a phenomenon in which light projected on a rough surface of an object is reflected in all directions. When a parallel incident light ray strikes a rough surface of an object, the rough surface reflects the incident light rays in all directions. Although the incident light rays are parallel to each other, the normal directions of the points on the surface of the object are inconsistent, so the reflected light rays will be irregularly reflected in different directions. diffusion".
在步骤S104,在待渲染模型中添加被影子遮挡的叠加数据,并获取投射到待渲染模型上的影子结果数据,叠加数据包含待渲染模型的高光数据和透射数据。In step S104, superimposed data occluded by shadows is added to the model to be rendered, and shadow result data projected onto the model to be rendered is acquired, where the superimposed data includes highlight data and transmission data of the model to be rendered.
在步骤S106,将漫反射数据、叠加数据和影子结果数据按照预设算法计算得到待渲染模型的最终颜色数据,基于最终颜色数据对待渲染模型进行渲染。In step S106, the diffuse reflection data, the overlay data and the shadow result data are calculated according to a preset algorithm to obtain final color data of the model to be rendered, and the model to be rendered is rendered based on the final color data.
本发明实施例通过在材质编辑器中定义朝上向量,即利用朝上向量模拟朝上的法线方向,从而可利用朝上向量来确定待渲染模型的漫反射数据,本发明实施例无需修改待渲染模型本身的法线方向,同样可以计算出过度平滑的漫反射数据,并达到让待渲染模型的漫反射统一的效果。In this embodiment of the present invention, the upward vector is defined in the material editor, that is, the upward vector is used to simulate the upward normal direction, so that the upward vector can be used to determine the diffuse reflection data of the model to be rendered, and no modification is required in this embodiment of the present invention The normal direction of the model to be rendered itself can also calculate the over-smooth diffuse reflection data, and achieve the effect of unifying the diffuse reflection of the model to be rendered.
由于无需修改待渲染模型本身的法线方向,后续计算待渲染模型的高光项时还可以有效地避免出现高光结果不是由草的表面反射到人的眼睛的情况。此外,本发明实施例在待渲染模型中添加被影子遮挡的叠加数据,并利用漫反射数据、叠加数据和影子结果数据计算得到用于渲染待渲染模型的最终颜色数据,可以避免出现待渲染模型在光照射不到的地方被叠加上颜色的问题,从而达到真实且自然的渲染效果。Since there is no need to modify the normal direction of the model to be rendered, the subsequent calculation of the highlight item of the model to be rendered can also effectively avoid the situation that the highlight result is not reflected by the surface of the grass to the human eyes. In addition, in this embodiment of the present invention, superimposed data occluded by shadows is added to the model to be rendered, and final color data for rendering the model to be rendered can be obtained by calculating the diffuse reflection data, the superimposed data and the shadow result data, which can avoid the appearance of the model to be rendered. The problem of superimposing colors in places where the light cannot reach, so as to achieve a realistic and natural rendering effect.
本发明实施例在达到真实自然的渲染效果的基础上,没有增加额外的数据,且使用了较少的模型资源(如使用了较少的模型顶点数),有效地减小了游戏引擎的渲染压力,进而提高了游戏引擎的整体性能。On the basis of achieving a real and natural rendering effect, the embodiments of the present invention do not add additional data, and use less model resources (for example, use less model vertices), effectively reducing the rendering of the game engine pressure, which in turn improves the overall performance of the game engine.
在本发明一些实施例中,待渲染模型可以是插片草模型,当然还可以是关于植物的其他类型的模型,本发明实施例对此不作具体限定。在该实施例中,关于插片草需要说明的是,通常在游戏引擎中物体都是以模型的形式存在,因此,对于游戏场景中草等地面上的植物可采用大致垂直于地面并且相互穿插的模型来表现草的形态,即插片草模型用来表现游戏场景中地面上的草的形态,且游戏场景中的多个插片草模型垂直于地面并相互穿插。In some embodiments of the present invention, the to-be-rendered model may be an insert grass model, and certainly may also be other types of models related to plants, which are not specifically limited in this embodiment of the present invention. In this embodiment, it should be noted that the grass inserts are generally in the form of models in the game engine. Therefore, for the plants on the ground such as grass in the game scene, it can be roughly perpendicular to the ground and interspersed with each other. The model is used to express the shape of the grass, that is, the patch grass model is used to represent the shape of the grass on the ground in the game scene, and multiple patch grass models in the game scene are perpendicular to the ground and interspersed with each other.
本发明实施例的游戏引擎可以采用UE(Unreal Engine,虚幻引擎)引擎,当然也可以采用其他引擎,此处对游戏引擎的类型不作具体限定。The game engine in the embodiment of the present invention may use a UE (Unreal Engine, Unreal Engine) engine, and of course other engines may also be used, and the type of the game engine is not specifically limited here.
通常待渲染模型在默认情况下只能保存一套法线信息,但是在计算光照时需要两套法线信息,其中一套朝上的法线信息用来计算漫反射,一套待渲染模型本身的法线信息用来计算高光。法线主要用于描述待渲染模型的表面方向的向量,待渲染模型表面方向的向量默认是垂直于模型表面的。Usually, the model to be rendered can only save one set of normal information by default, but two sets of normal information are needed when calculating lighting, one set of normal information facing upward is used to calculate diffuse reflection, and one set of the model to be rendered itself The normal information of is used to calculate the specular. The normal is mainly used to describe the vector of the surface direction of the model to be rendered. The vector of the surface direction of the model to be rendered is perpendicular to the model surface by default.
为了避免修改待渲染模型的法线朝向,从而避免计算高光的结果不由待渲染模型的表面反射到人的眼睛,本发明实施例在执行上文步骤S102时,根据计算漫反射的法线具有垂直朝上的特征,在游戏引擎中采用一个朝上向量(0,0,1)来代替用于计算漫反射的法线信息,可以不必再修改待渲染模型本身的法线,而是直接采用朝上向量(0,0,1)来计算待渲染模型的漫反射数据,同样可以达到让待渲染模型的漫反射统一的效果。In order to avoid modifying the normal orientation of the model to be rendered, so that the result of calculating the highlights is not reflected to the human eyes by the surface of the model to be rendered, in this embodiment of the present invention, when the above step S102 is performed, the normal line according to the calculation of the diffuse reflection has a vertical For the upward feature, an upward vector (0, 0, 1) is used in the game engine to replace the normal information used to calculate the diffuse reflection. It is not necessary to modify the normal of the model to be rendered, but directly use the upward direction. The upper vector (0, 0, 1) is used to calculate the diffuse reflection data of the model to be rendered, which can also achieve the effect of unifying the diffuse reflection of the model to be rendered.
通常计算插片草模型的漫反射数据的方式为D漫反射=N模型法线·L光照方向,本发明实施例利用朝上向量(0,0,1)代替N模型法线,在执行上文步骤S102基于定义的朝上向量确定待渲染模型的漫反射数据时,先获取待渲染模型的光照方向信息,即L光照方向,然后,再将定义的朝上向量与光照方向信息相乘计算得到待渲染模型的漫反射数据,即利用朝上向量(0,0,1)与L光照方向相乘得到插片草模型的漫反射数据。Generally, the way to calculate the diffuse reflection data of the patch grass model is D diffuse reflection = N model normal · L illumination direction. In this embodiment of the present invention, the upward vector (0, 0, 1) is used to replace the N model normal. In step S102, when determining the diffuse reflection data of the model to be rendered based on the defined upward vector, first obtain the illumination direction information of the model to be rendered, that is, the L illumination direction, and then multiply the defined upward vector with the illumination direction information to calculate The diffuse reflection data of the model to be rendered is obtained, that is, the diffuse reflection data of the patch grass model is obtained by multiplying the upward vector (0, 0, 1) by the L illumination direction.
由于游戏引擎的特性,为模型的材质传入参数时只能传入一个法线信息,结合上文介绍,待渲染模型在默认情况下也只能保存一套法线信息,若要通过另外一套法线计算光照还需要添加额外的计算量。在游戏引擎中,可以通过自发光属性给最终的计算结果叠加颜色,但是自发光颜色并不会考虑影子的问题,在光照射不到的地方也会被叠加上颜色,这是不符合逻辑的。因此,本发明实施例在叠加颜色时会考虑影子的影响。Due to the characteristics of the game engine, only one normal information can be passed in when passing parameters for the material of the model. Combined with the above introduction, the model to be rendered can only save one set of normal information by default. The set of normals to calculate the lighting also needs to add extra calculation. In the game engine, the final calculation result can be superimposed with color through the self-illumination attribute, but the self-illumination color does not consider the shadow problem, and the color will also be superimposed in the place where the light cannot be illuminated, which is illogical . Therefore, the embodiments of the present invention consider the influence of shadows when superimposing colors.
在本发明一些实施例中,参见上文步骤S104,在待渲染模型中添加被影子遮挡的叠加数据的过程可以包含图3所示的步骤S1041至步骤S1043。In some embodiments of the present invention, referring to step S104 above, the process of adding overlay data occluded by shadows in the model to be rendered may include steps S1041 to S1043 shown in FIG. 3 .
在步骤S1041,在待渲染模型中定义被影子遮挡的叠加项变量。In step S1041, a superimposed item variable occluded by the shadow is defined in the model to be rendered.
本发明实施例在待渲染模型中先定义被影子遮挡的叠加项变量,即提前准备好一个变量(buffer)用来储存后文依据高光数据和透射数据计算得到的叠加项数据。In the embodiment of the present invention, the superimposed item variable occluded by the shadow is first defined in the model to be rendered, that is, a variable (buffer) is prepared in advance to store superimposed item data calculated later according to the highlight data and the transmission data.
在步骤S1042,分别计算待渲染模型的高光数据和透射数据,对高光数据和透射数据求和得到被影子遮挡的叠加数据。In step S1042, the highlight data and the transmission data of the model to be rendered are calculated respectively, and the sum of the highlight data and the transmission data is obtained to obtain the superimposed data occluded by the shadow.
对高光数据和透射数据求和得到被影子遮挡的叠加数据的计算公式为E 叠加颜色=S 模型高光+T 透射颜色,其中,E 叠加颜色表示被影子遮挡的叠加数据,S 模型高光表示基于待渲染模型法线计算的高光数据,T 透射颜色表示透射数据。 Summing the highlight data and transmission data to obtain the superimposed data occluded by the shadow, the calculation formula is E superimposed color = S model highlight + T transmission color , where E superimposed color represents the superimposed data occluded by shadow, S model Renders the specular data for the model's normal calculation, and the T transmission color represents the transmission data.
本发明实施例中的高光实际上是一种美术用语,指光源的光线照射到物体后又反射到人的眼睛里时,被照射物体表面上最亮的那个点就是高光,高光本质不是代表光,而是指物体上最亮的部分。The highlight in the embodiment of the present invention is actually an artistic term, which refers to the brightest point on the surface of the irradiated object when the light of the light source irradiates the object and then reflects into the human eyes, and the highlight does not represent light in nature. , but refers to the brightest part of the object.
关于透射需要介绍的是,当光源的光线入射到透明或半透明材料物体表面时,一部分光线被反射,一部分光线被吸收,还有一部分光线可以从透明或半透明材料中透射过去。透射是入射光线经过折射并穿过物体后的出射现象。被透射的物体可以透明体或半透明体,如玻璃、滤色片等材质的物体。What needs to be introduced about transmission is that when the light of the light source is incident on the surface of a transparent or translucent material, some of the light is reflected, some of the light is absorbed, and some of the light can be transmitted through the transparent or translucent material. Transmission is the outgoing phenomenon of incident light rays after they have been refracted and passed through an object. The objects to be transmitted can be transparent or translucent, such as objects made of glass, color filters, etc.
在步骤S1043,将叠加数据添加于定义的叠加项变量中。In step S1043, the overlay data is added to the defined overlay variable.
该步骤将计算得到的叠加数据添加于定义的叠加项变量中,从而可以实现在待渲染模型中添加被影子遮挡的叠加数据。另外,由于本发明实施例采用一个朝上向量(0,0,1)代替用于计算漫反射的法线信息,保留了待渲染模型本身的法线,如图4所示的插片草模型本身的法线方向、反射方向ReflectionDir和人的观察方向ViewDir。因此,可以利用待渲染模型本身的法线计算待渲染模型的高光数据。In this step, the calculated overlay data is added to the defined overlay item variable, so that overlay data occluded by shadows can be added to the model to be rendered. In addition, since the embodiment of the present invention uses an upward vector (0, 0, 1) to replace the normal information for calculating the diffuse reflection, the normal of the model to be rendered is retained, as shown in FIG. Its own normal direction, reflection direction ReflectionDir and people's viewing direction ViewDir. Therefore, the specular data of the model to be rendered can be calculated using the normal of the model to be rendered.
在执行上文步骤S1042计算待渲染模型的高光数据时,可以先获取待渲染模型本身的法线信息,然后,基于待渲染模型本身的法线信息计算得到待渲染模型的高光数据。When performing the above step S1042 to calculate the highlight data of the model to be rendered, the normal information of the model to be rendered can be obtained first, and then the highlight data of the model to be rendered can be obtained by calculating based on the normal information of the model to be rendered.
由于无需修改待渲染模型本身的法线方向,因此计算待渲染模型的高光项可以有效地避免出现高光结果不是由草的表面反射到人的眼睛的情况,并避免出现只有在逆光的时候才能看到高光,而在顺光的时候没有光线可以反射到眼睛的问题。Since there is no need to modify the normal direction of the model to be rendered, the calculation of the highlight item of the model to be rendered can effectively avoid the situation that the highlight result is not reflected by the surface of the grass to the human eyes, and can only be seen when it is backlit. to the highlights, and there is no problem of light reflecting to the eyes when the light is in the front.
本发明实施例在计算待渲染模型的高光数据后,可以将高光数据叠加至游戏引擎原有着色模型ShadingModel计算得到的雾效、间接光等常规通用 的计算结果中,以渲染出真实的高光效果。In the embodiment of the present invention, after calculating the highlight data of the model to be rendered, the highlight data can be superimposed on the conventional and general calculation results such as fog effect and indirect light calculated by the original Shading Model of the game engine, so as to render a real highlight effect. .
参见上文步骤S1042,在本发明一些实施例中,计算待渲染模型的透射数据时,先获取待渲染模型的观察方向信息和光照方向信息,然后,将观察方向信息和光照方向信息进行点积计算得到待渲染模型的透射强度,最后,获取待渲染模型的透射颜色,依据透射颜色和透射强度计算得到待渲染模型的透射数据。具体的,可以按照公式:(观察方向·灯光方向) 2×透射颜色×透射强度,计算得到草模型的透射数据。 Referring to the above step S1042, in some embodiments of the present invention, when calculating the transmission data of the model to be rendered, first obtain the viewing direction information and the lighting direction information of the model to be rendered, and then perform a dot product on the viewing direction information and the lighting direction information The transmission intensity of the model to be rendered is obtained by calculation, and finally, the transmission color of the model to be rendered is obtained, and the transmission data of the model to be rendered is obtained by calculation according to the transmission color and the transmission intensity. Specifically, the transmission data of the grass model can be obtained by calculation according to the formula: (observation direction·light direction) 2 × transmission color × transmission intensity.
本发明实施例在计算待渲染模型的透射数据后,可以将透射数据叠加至游戏引擎原有着色模型ShadingModel计算得到的雾效、间接光等常规通用的计算结果中,以渲染出真实的透射效果。In this embodiment of the present invention, after calculating the transmission data of the model to be rendered, the transmission data can be superimposed on the conventional and general calculation results such as fog effect and indirect light calculated by the original Shading Model of the game engine, so as to render a real transmission effect. .
由此,本发明实施例可以使用较少的模型顶点数来模拟草的形态,并且不仅能够得到插片草模型变化均匀的漫反射效果,而且还可以得到正确的高光结果和透射结果。Therefore, the embodiment of the present invention can use a smaller number of model vertices to simulate the shape of the grass, and can not only obtain the uniform diffuse reflection effect of the patch grass model, but also obtain the correct highlight and transmission results.
上文已经介绍了计算得到漫反射数据和叠加数据的过程,在本发明一实施例中,在将漫反射数据、叠加数据和影子结果数据按照预设算法计算得到待渲染模型的最终颜色数据的过程中,可以先将漫反射数据和叠加数据进行求和。由于对高光数据S 模型高光和透射数据T 透射颜色求和可以得到被影子遮挡的叠加数据E 叠加颜色,因此,将基于朝上向量计算的漫反射数据C 漫反射数据和叠加数据E 叠加颜色进行求和的公式可以为C 漫反射数据+S 模型高光+T 透射颜色The process of calculating the diffuse reflection data and the superimposed data has been described above. In an embodiment of the present invention, the final color data of the model to be rendered is obtained by calculating the diffuse reflection data, the superimposed data and the shadow result data according to a preset algorithm. During the process, the diffuse reflection data and the overlay data can be summed first. Since the summation of the highlight data of the S model and the transmission color of the transmission data T can obtain the superimposed color of the superimposed data E occluded by the shadow. The formula for the summation can be C diffuse data + S model specular + T transmission color .
然后,将漫反射数据和叠加数据的求和结果与获取到的影子结果数据相乘,从而得到待渲染模型的最终颜色数据,即按照公式Color 最终颜色=(C 漫反射 数据+S 高光数据+T 透射颜色)×Shadow 影子结果计算得到待渲染模型的最终颜色数据Color 最终颜色。待渲染模型的最终颜色数据可以用于对待渲染模型进行有效地渲染,如对插片草模型进行渲染能够得到真实且自然的草的效果。 Then, multiply the summation result of the diffuse reflection data and the superimposed data with the obtained shadow result data to obtain the final color data of the model to be rendered, that is, according to the formula Color final color = (C diffuse reflection data + S highlight data + T transmission color ) × Shadow shadow result calculation to obtain the final color data Color final color of the model to be rendered. The final color data of the to-be-rendered model can be used to render the to-be-rendered model effectively, for example, rendering the grass insert model can obtain the effect of real and natural grass.
本发明实施例的插片草模型应用的虚拟场景可以是游戏场景、虚拟现实(VR,Virtual Reality)场景、动画场景、模拟器场景等等。例如,插片草模型应用在移动终端(如手机)的安卓系统中渲染游戏场景。又例如,插片草模型应用在PC(Personal Computer,个人计算机)端的安卓系统中渲染动 画场景等。本发明实施例对插片草模型的应用场景不作具体限定。The virtual scene of the insert grass model application in the embodiment of the present invention may be a game scene, a virtual reality (VR, Virtual Reality) scene, an animation scene, a simulator scene, and the like. For example, the patch grass model application renders the game scene in the Android system of the mobile terminal (such as a mobile phone). For another example, the insert grass model is used to render animation scenes in the Android system on the PC (Personal Computer, personal computer) side. The embodiment of the present invention does not specifically limit the application scenarios of the slug grass model.
为了进一步的提高插片草模型的渲染效率以及插片草模型所在虚拟场景的渲染效率,本发明实施例还可以采用多台渲染服务器协同渲染待渲染场景,以降低单台渲染服务器的渲染压力。并且,本发明实施例为了合理有效地应用多个渲染服务器,还可以采用中间服务器对各个渲染服务器进行合理调度。这里的中间服务器和多个渲染服务器可以共同组成一个渲染集群,下面对渲染集群中各个渲染服务器和中间服务器的工作过程进行如下介绍。In order to further improve the rendering efficiency of the slug model and the rendering efficiency of the virtual scene where the slug model is located, the embodiment of the present invention can also use multiple rendering servers to render the scene to be rendered collaboratively, so as to reduce the rendering pressure of a single rendering server. In addition, in order to reasonably and effectively apply multiple rendering servers, the embodiment of the present invention may also employ an intermediate server to reasonably schedule each rendering server. The intermediate server and multiple rendering servers can form a rendering cluster together. The working process of each rendering server and intermediate server in the rendering cluster is described below.
中间服务器在接收到对包含有插片草模型的虚拟场景的渲染请求后,可以获取渲染集群中的各个渲染服务器上报的状态信息。然后,根据各渲染服务器的状态信息从渲染集群的渲染服务器中确定目标渲染服务器。其中,渲染服务器的状态信息可以包括渲染服务器是否在线、渲染服务器的繁忙程度、渲染服务器的内存占用率等信息。进而,请求确定出的目标渲染服务器对包含有插片草模型的虚拟场景进行渲染,并且目标渲染服务器可以基于上文实施例计算得到的插片草模型的最终颜色数据对插片草模型进行有效地渲染。After the intermediate server receives the rendering request for the virtual scene including the slug model, the intermediate server can obtain the status information reported by each rendering server in the rendering cluster. Then, a target rendering server is determined from the rendering servers in the rendering cluster according to the state information of each rendering server. The status information of the rendering server may include information such as whether the rendering server is online, the busyness of the rendering server, and the memory occupancy rate of the rendering server. Further, the determined target rendering server is requested to render the virtual scene containing the slug model, and the target rendering server can effectively render the slug model based on the final color data of the slug model calculated in the above embodiment. rendering.
该实施例中,各个渲染服务器可以实时地获取自身的状态信息,并将获取到的状态信息上报至中间服务器,中间服务器保存各个渲染服务器上报的状态信息,并对保存的态信息进行不断更新。In this embodiment, each rendering server can acquire its own state information in real time, and report the acquired state information to the intermediate server, and the intermediate server saves the state information reported by each rendering server, and continuously updates the stored state information.
本发明实施例可用于游戏场景的渲染,也可以用于其他三维场景的渲染,本发明实施例不作具体限定。The embodiments of the present invention may be used for rendering of game scenes, and may also be used for rendering of other three-dimensional scenes, which are not specifically limited in the embodiments of the present invention.
由此,本发明实施例的待渲染场景不是由单一的渲染服务器进行渲染,而是多台渲染服务器协同工作,不仅大幅降低了单台服务器的渲染压力,提高了场景渲染效率,改善了用户体验,而且,还可用多台低配置的渲染服务器代替高配置的渲染服务器,从而有效降低渲染集群的部署成本。Therefore, the scene to be rendered in the embodiment of the present invention is not rendered by a single rendering server, but multiple rendering servers work together, which not only greatly reduces the rendering pressure of a single server, but also improves the scene rendering efficiency and improves the user experience. Moreover, multiple low-configuration rendering servers can be used to replace high-configuration rendering servers, thereby effectively reducing the deployment cost of the rendering cluster.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属 于可选实施例,所涉及的动作并不一定是本发明所必须的。It should be noted that, for the sake of simple description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence. As in accordance with the present invention, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present invention.
基于同一发明构思,本发明实施例还提供了一种模型的渲染装置,图5示意性地示出了根据本发明一个实施例的模型的渲染装置的结构图。参见图5,模型的渲染装置500可以包括确定模块510、添加模块520和渲染模块530。Based on the same inventive concept, an embodiment of the present invention further provides a model rendering apparatus, and FIG. 5 schematically shows a structural diagram of a model rendering apparatus according to an embodiment of the present invention. Referring to FIG. 5 , the model rendering apparatus 500 may include a determining module 510 , an adding module 520 and a rendering module 530 .
确定模块510,适于在材质编辑器中定义一个朝上向量,基于定义的朝上向量确定待渲染模型的漫反射数据。The determining module 510 is adapted to define an upward vector in the material editor, and determine the diffuse reflection data of the model to be rendered based on the defined upward vector.
通过利用朝上向量模拟朝上的法线方向,从而可利用朝上向量来确定待渲染模型的漫反射数据,本发明实施例无需修改待渲染模型本身的法线方向,同样可以计算出过度平滑的漫反射数据,达到让待渲染模型的漫反射统一的效果。并且,由于无需修改待渲染模型本身的法线方向,后续计算待渲染模型的高光项时还可有效地避免出现高光结果不是由草的表面反射到人的眼睛的情况。By using the upward vector to simulate the upward normal direction, the upward vector can be used to determine the diffuse reflection data of the model to be rendered. This embodiment of the present invention does not need to modify the normal direction of the model to be rendered itself, and can also calculate excessive smoothing The diffuse reflection data to achieve the uniform effect of the diffuse reflection of the model to be rendered. In addition, since there is no need to modify the normal direction of the model to be rendered, the subsequent calculation of the highlight item of the model to be rendered can also effectively avoid a situation where the highlight result is not reflected by the surface of the grass to human eyes.
添加模块520,适于在待渲染模型中添加被影子遮挡的叠加数据,并获取投射到待渲染模型上的影子结果数据,叠加数据包含待渲染模型的高光数据和透射数据。The adding module 520 is adapted to add overlay data occluded by shadows in the model to be rendered, and obtain shadow result data projected on the model to be rendered, where the overlay data includes highlight data and transmission data of the model to be rendered.
渲染模块530,适于将漫反射数据、叠加数据和影子结果数据按照预设算法计算得到待渲染模型的最终颜色数据,基于最终颜色数据对待渲染模型进行渲染。The rendering module 530 is adapted to calculate the diffuse reflection data, the overlay data and the shadow result data according to a preset algorithm to obtain final color data of the model to be rendered, and render the model to be rendered based on the final color data.
在待渲染模型中添加被影子遮挡的叠加数据,并利用漫反射数据、叠加数据和影子结果数据计算得到用于渲染待渲染模型的最终颜色数据,可以避免出现待渲染模型在光照射不到的地方被叠加上颜色的问题,从而达到真实且自然的渲染效果。进一步的,本发明实施例在达到真实自然的渲染效果的基础上,没有增加额外的数据,且使用了较少的模型资源,有效地减小了游戏引擎的渲染压力,进而提高了游戏引擎的整体性能。Add the overlay data occluded by shadows to the model to be rendered, and use the diffuse reflection data, overlay data and shadow result data to calculate the final color data for rendering the model to be rendered, which can avoid the appearance of the model to be rendered that cannot be illuminated by light. The problem is that the place is superimposed with color, so as to achieve a realistic and natural rendering effect. Further, on the basis of achieving a real and natural rendering effect, the embodiment of the present invention does not add additional data, and uses less model resources, which effectively reduces the rendering pressure of the game engine, thereby improving the performance of the game engine. overall performance.
在本发明一些实施例中,待渲染模型包括插片草模型,且游戏场景中的多个插片草模型垂直于地面并相互穿插。In some embodiments of the present invention, the model to be rendered includes a patch grass model, and the multiple patch grass models in the game scene are perpendicular to the ground and interspersed with each other.
在本发明一些实施例中,确定模块510,还适于获取待渲染模型的光照 方向信息;将定义的朝上向量与光照方向信息相乘计算得到待渲染模型的漫反射数据。In some embodiments of the present invention, the determining module 510 is further adapted to obtain illumination direction information of the model to be rendered; and multiply the defined upward vector by the illumination direction information to obtain the diffuse reflection data of the model to be rendered.
在本发明一些实施例中,添加模块520,还适于在待渲染模型中定义被影子遮挡的叠加项变量;分别计算待渲染模型的高光数据和透射数据,对高光数据和透射数据求和得到被影子遮挡的叠加数据;将叠加数据添加于定义的叠加项变量中。In some embodiments of the present invention, the addition module 520 is further adapted to define a superimposed item variable occluded by shadows in the model to be rendered; separately calculate the highlight data and transmission data of the model to be rendered, and sum the highlight data and the transmission data to obtain Overlay data occluded by shadows; add overlay data to the defined overlay variable.
在本发明一些实施例中,添加模块520,还适于获取待渲染模型本身的法线信息;基于待渲染模型本身的法线信息计算得到待渲染模型的高光数据。In some embodiments of the present invention, the addition module 520 is further adapted to obtain normal information of the model to be rendered; and calculate the highlight data of the model to be rendered based on the normal information of the model to be rendered.
在本发明一些实施例中,添加模块520,还适于获取待渲染模型的观察方向信息和光照方向信息;将观察方向信息和光照方向信息进行点积计算得到待渲染模型的透射强度;获取待渲染模型的透射颜色,依据透射颜色和透射强度计算得到待渲染模型的透射数据。In some embodiments of the present invention, a module 520 is added, which is further adapted to obtain the viewing direction information and illumination direction information of the model to be rendered; perform dot product calculation on the viewing direction information and the illumination direction information to obtain the transmission intensity of the model to be rendered; obtain the transmission intensity of the model to be rendered; The transmission color of the rendered model is calculated according to the transmission color and the transmission intensity to obtain the transmission data of the model to be rendered.
在本发明一些实施例中,渲染模块530,还适于将漫反射数据和叠加数据进行求和;将漫反射数据和叠加数据的求和结果与影子结果数据相乘,得到待渲染模型的最终颜色数据。In some embodiments of the present invention, the rendering module 530 is further adapted to sum the diffuse reflection data and the overlay data; multiply the summation result of the diffuse reflection data and the overlay data with the shadow result data to obtain the final model of the to-be-rendered model. color data.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的模型的渲染装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置的程序/指令(例如,计算机程序/指令和计算机程序产品)。这样的实现本发明的程序/指令可以存储在计算机可读介质上,或者可以一个或者多个信号的形式存在,这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。Various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the rendering apparatus of the model according to the embodiment of the present invention. The present invention can also be implemented as a program/instruction (eg, computer program/instruction and computer program product) for an apparatus or apparatus for performing some or all of the methods described herein. Such programs/instructions implementing the present invention may be stored on a computer readable medium, or may exist in the form of one or more signals, such signals may be downloaded from an Internet website, or provided on a carrier signal, or in any form Available in other formats.
计算机存储介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取 存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。Computer storage media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology. Information may be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridges, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices.
图6示意性地示出了可以实现根据本发明的一种模型渲染方法的计算设备的框图,该计算装置包括处理器610和以存储器620形式的计算机可读介质。存储器620是计算机可读介质的一个示例,其具有用于存储计算机程序/指令631的存储空间630。当所述计算机程序/指令631由处理器610执行时,可实现上文所描述的模型渲染方法中的各个步骤。FIG. 6 schematically shows a block diagram of a computing device that can implement a model rendering method according to the present invention, the computing device including a processor 610 and a computer-readable medium in the form of a memory 620 . Memory 620 is an example of a computer-readable medium having storage space 630 for storing computer programs/instructions 631 . When the computer program/instructions 631 are executed by the processor 610, the various steps in the model rendering method described above may be implemented.
图7示意性地示出了实现根据本发明的方法的计算机程序产品的框图。所述计算机程序产品包括计算机程序/指令710,当所述计算机程序/指令710被诸如图6所示的处理器610之类的处理器执行时,可实现上文所描述的模型渲染方法中的各个步骤。Figure 7 schematically shows a block diagram of a computer program product implementing the method according to the invention. The computer program product includes a computer program/instructions 710 that, when executed by a processor, such as the processor 610 shown in FIG. 6, can implement the model rendering methods described above. each step.
上文对本说明书特定实施例进行了描述,其与其它实施例一并涵盖于所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定遵循示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可行的或者有利的。Specific embodiments of this specification have been described above, and other embodiments are intended to be included within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily follow the specific order shown, or sequential order, to achieve desirable results. In certain embodiments, multitasking and parallel processing are also possible or advantageous.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device comprising a series of elements includes not only those elements, but also Other elements not expressly listed, or which are inherent to such a process, method, article of manufacture, or apparatus are also included. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, article of manufacture, or device that includes the element.
应可理解,以上所述实施例仅为举例说明本发明之目的而并非对本发明进行限制。在不脱离本发明基本精神及特性的前提下,本领域技术人员还可以通过其他方式来实施本发明。本发明的范围当以后附的权利要求为准,凡在本说明书一个或多个实施例的精神和原则之内所做的任何修改、等同替换、改进等,皆应涵盖其中。It should be understood that the above-mentioned embodiments are only for the purpose of illustrating the present invention and not for limiting the present invention. Those skilled in the art can also implement the present invention in other ways without departing from the basic spirit and characteristics of the present invention. The scope of the present invention shall be determined by the appended claims, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be covered therein.

Claims (11)

  1. 一种模型的渲染方法,包括:A rendering method for a model, including:
    在材质编辑器中定义一个朝上向量,基于定义的朝上向量确定待渲染模型的漫反射数据;Define an up vector in the material editor, and determine the diffuse reflection data of the model to be rendered based on the defined up vector;
    在所述待渲染模型中添加被影子遮挡的叠加数据,并获取投射到待渲染模型上的影子结果数据,所述叠加数据包含待渲染模型的高光数据和透射数据;adding overlay data occluded by shadows in the model to be rendered, and obtaining shadow result data projected onto the model to be rendered, the overlay data includes highlight data and transmission data of the model to be rendered;
    将所述漫反射数据、所述叠加数据和所述影子结果数据按照预设算法计算得到待渲染模型的最终颜色数据,基于所述最终颜色数据对所述待渲染模型进行渲染。The diffuse reflection data, the overlay data and the shadow result data are calculated according to a preset algorithm to obtain final color data of the model to be rendered, and the model to be rendered is rendered based on the final color data.
  2. 根据权利要求1所述的方法,其中,所述待渲染模型包括插片草模型,且游戏场景中的多个插片草模型垂直于地面并相互穿插。The method according to claim 1, wherein the model to be rendered comprises a patch grass model, and a plurality of patch grass models in the game scene are perpendicular to the ground and interspersed with each other.
  3. 根据权利要求1或2所述的方法,其中,基于定义的朝上向量确定待渲染模型的漫反射数据,包括:The method according to claim 1 or 2, wherein determining the diffuse reflection data of the model to be rendered based on the defined upward vector comprises:
    获取所述待渲染模型的光照方向信息;obtaining the illumination direction information of the to-be-rendered model;
    将定义的朝上向量与所述光照方向信息相乘计算得到所述待渲染模型的漫反射数据。The diffuse reflection data of the to-be-rendered model is obtained by multiplying the defined upward vector by the lighting direction information.
  4. 根据权利要求1或2所述的方法,其中,在所述待渲染模型中添加被影子遮挡的叠加数据,包括:The method according to claim 1 or 2, wherein adding overlay data occluded by shadows in the to-be-rendered model comprises:
    在所述待渲染模型中定义被影子遮挡的叠加项变量;Define a superimposed item variable occluded by the shadow in the to-be-rendered model;
    分别计算所述待渲染模型的高光数据和透射数据,对所述高光数据和所述透射数据求和得到被影子遮挡的叠加数据;Calculate the highlight data and the transmission data of the model to be rendered respectively, and sum the highlight data and the transmission data to obtain the overlay data blocked by the shadow;
    将所述叠加数据添加于定义的所述叠加项变量中。The overlay data is added to the defined overlay variable.
  5. 根据权利要求4所述的方法,其中,计算所述待渲染模型的高光数据,包括:The method according to claim 4, wherein calculating the specular data of the model to be rendered comprises:
    获取所述待渲染模型本身的法线信息;Obtain the normal information of the to-be-rendered model itself;
    基于所述待渲染模型本身的法线信息计算得到待渲染模型的高光数据。The highlight data of the to-be-rendered model is calculated based on the normal information of the to-be-rendered model itself.
  6. 根据权利要求4所述的方法,其中,计算所述待渲染模型的透射数据,包括:The method according to claim 4, wherein calculating the transmission data of the model to be rendered comprises:
    获取所述待渲染模型的观察方向信息和光照方向信息;obtaining the viewing direction information and the illumination direction information of the model to be rendered;
    将所述观察方向信息和光照方向信息进行点积计算得到待渲染模型的透射强度;Performing dot product calculation on the viewing direction information and the illumination direction information to obtain the transmission intensity of the model to be rendered;
    获取所述待渲染模型的透射颜色,依据所述透射颜色和透射强度计算得到待渲染模型的透射数据。The transmission color of the model to be rendered is acquired, and the transmission data of the model to be rendered is obtained by calculating according to the transmission color and the transmission intensity.
  7. 根据权利要求1或2所述的方法,其中,将所述漫反射数据、所述叠加数据和所述影子结果数据按照预设算法计算得到待渲染模型的最终颜色数据,包括:The method according to claim 1 or 2, wherein calculating the diffuse reflection data, the overlay data and the shadow result data according to a preset algorithm to obtain final color data of the model to be rendered, comprising:
    将所述漫反射数据和叠加数据进行求和;summing the diffuse data and overlay data;
    将所述漫反射数据和叠加数据的求和结果与所述影子结果数据相乘,得到所述待渲染模型的最终颜色数据。The summation result of the diffuse reflection data and the overlay data is multiplied by the shadow result data to obtain the final color data of the to-be-rendered model.
  8. 一种模型的渲染装置,包括:A model rendering device, comprising:
    确定模块,用于在材质编辑器中定义一个朝上向量,基于定义的朝上向量确定待渲染模型的漫反射数据;The determination module is used to define an up vector in the material editor, and determine the diffuse reflection data of the model to be rendered based on the defined up vector;
    添加模块,用于在所述待渲染模型中添加被影子遮挡的叠加数据,并获取投射到待渲染模型上的影子结果数据,所述叠加数据包含待渲染模型的高光数据和透射数据;The adding module is used to add overlay data occluded by shadows in the model to be rendered, and obtain shadow result data projected onto the model to be rendered, where the overlay data includes highlight data and transmission data of the model to be rendered;
    渲染模块,用于将所述漫反射数据、所述叠加数据和所述影子结果数据按照预设算法计算得到待渲染模型的最终颜色数据,基于所述最终颜色数据对所述待渲染模型进行渲染。A rendering module, configured to calculate the diffuse reflection data, the overlay data and the shadow result data according to a preset algorithm to obtain final color data of the model to be rendered, and render the model to be rendered based on the final color data .
  9. 一种计算设备,包括存储器、处理器及存储在存储器上的计算机程序/指令,所述处理器执行所述计算机程序/指令时实现根据权利要求1-7中任一项所述的模型的渲染方法的步骤。A computing device, comprising a memory, a processor and a computer program/instruction stored on the memory, the processor implementing the rendering of the model according to any one of claims 1-7 when the processor executes the computer program/instruction steps of the method.
  10. 一种计算机存储介质,其上存储有计算机程序/指令,所述计算机程序/指令被处理器执行时实现根据权利要求1-7中任一项所述的模型的渲染方法的步骤。A computer storage medium having computer programs/instructions stored thereon, the computer programs/instructions implementing the steps of the model rendering method according to any one of claims 1-7 when the computer program/instructions are executed by a processor.
  11. 一种计算机程序产品,包括计算机程序/指令,所述计算机程序/ 指令被处理器执行时实现根据权利要求1-7中任一项所述的模型的渲染方法的步骤。A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the method for rendering a model according to any one of claims 1-7.
PCT/CN2021/132560 2021-04-16 2021-11-23 Method and apparatus for rendering model, storage medium, and computing device WO2022217922A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110412345.8A CN113223131B (en) 2021-04-16 2021-04-16 Model rendering method and device, storage medium and computing equipment
CN202110412345.8 2021-04-16

Publications (1)

Publication Number Publication Date
WO2022217922A1 true WO2022217922A1 (en) 2022-10-20

Family

ID=77087908

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/132560 WO2022217922A1 (en) 2021-04-16 2021-11-23 Method and apparatus for rendering model, storage medium, and computing device

Country Status (2)

Country Link
CN (1) CN113223131B (en)
WO (1) WO2022217922A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113223131B (en) * 2021-04-16 2022-05-31 完美世界(北京)软件科技发展有限公司 Model rendering method and device, storage medium and computing equipment
CN113610955A (en) * 2021-08-11 2021-11-05 北京果仁互动科技有限公司 Object rendering method and device and shader
CN114494570A (en) * 2021-10-18 2022-05-13 北京市商汤科技开发有限公司 Rendering method and device of three-dimensional model, storage medium and computer equipment
CN115082607A (en) * 2022-05-26 2022-09-20 网易(杭州)网络有限公司 Virtual character hair rendering method and device, electronic equipment and storage medium
CN116091684B (en) * 2023-04-06 2023-07-07 杭州片段网络科技有限公司 WebGL-based image rendering method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8294713B1 (en) * 2009-03-23 2012-10-23 Adobe Systems Incorporated Method and apparatus for illuminating objects in 3-D computer graphics
CN111127623A (en) * 2019-12-25 2020-05-08 上海米哈游天命科技有限公司 Model rendering method and device, storage medium and terminal
CN112200900A (en) * 2020-12-02 2021-01-08 成都完美时空网络技术有限公司 Volume cloud rendering method and device, electronic equipment and storage medium
CN112316420A (en) * 2020-11-05 2021-02-05 网易(杭州)网络有限公司 Model rendering method, device, equipment and storage medium
CN113223131A (en) * 2021-04-16 2021-08-06 完美世界(北京)软件科技发展有限公司 Model rendering method and device, storage medium and computing equipment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106056661B (en) * 2016-05-31 2018-08-28 钱进 Three-dimensional graphics renderer engine based on Direct3D 11
CN106469463B (en) * 2016-09-27 2019-04-30 上海上大海润信息系统有限公司 A kind of rendering method mixed based on CPU with GPU
US20200082595A1 (en) * 2017-05-31 2020-03-12 Sony Corporation Image processing apparatus, image processing system, and image processing method as well as program
CN109685876B (en) * 2018-12-21 2020-11-03 北京达佳互联信息技术有限公司 Hair rendering method and device, electronic equipment and storage medium
CN111009026B (en) * 2019-12-24 2020-12-01 腾讯科技(深圳)有限公司 Object rendering method and device, storage medium and electronic device
CN111899325B (en) * 2020-08-13 2024-02-23 网易(杭州)网络有限公司 Spar model rendering method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8294713B1 (en) * 2009-03-23 2012-10-23 Adobe Systems Incorporated Method and apparatus for illuminating objects in 3-D computer graphics
CN111127623A (en) * 2019-12-25 2020-05-08 上海米哈游天命科技有限公司 Model rendering method and device, storage medium and terminal
CN112316420A (en) * 2020-11-05 2021-02-05 网易(杭州)网络有限公司 Model rendering method, device, equipment and storage medium
CN112200900A (en) * 2020-12-02 2021-01-08 成都完美时空网络技术有限公司 Volume cloud rendering method and device, electronic equipment and storage medium
CN113223131A (en) * 2021-04-16 2021-08-06 完美世界(北京)软件科技发展有限公司 Model rendering method and device, storage medium and computing equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZHANG ZHIWEI: "Research of Flower Simulation Algorithm Based on Perlin Noise", MASTER THESIS, TIANJIN POLYTECHNIC UNIVERSITY, CN, no. 1, 15 January 2021 (2021-01-15), CN , XP055977234, ISSN: 1674-0246 *

Also Published As

Publication number Publication date
CN113223131A (en) 2021-08-06
CN113223131B (en) 2022-05-31

Similar Documents

Publication Publication Date Title
WO2022217922A1 (en) Method and apparatus for rendering model, storage medium, and computing device
WO2022116659A1 (en) Volumetric cloud rendering method and apparatus, and program and readable medium
CN111968215B (en) Volume light rendering method and device, electronic equipment and storage medium
US7212207B2 (en) Method and apparatus for real-time global illumination incorporating stream processor based hybrid ray tracing
CN111127623B (en) Model rendering method and device, storage medium and terminal
PT1376472E (en) Systems and methods for providing controllable texture sampling
CN107909641A (en) One kind bakees rendering intent, device, terminal device and storage medium
CN110866967B (en) Water ripple rendering method, device, equipment and storage medium
Yao et al. Multi‐image based photon tracing for interactive global illumination of dynamic scenes
CN105335996B (en) A kind of computational methods and device of light radiation response
WO2023273133A1 (en) Game model light supplementing method and apparatus, storage medium, and computer device
Akinci et al. Screen space foam rendering
Iwasaki et al. Real‐time rendering of dynamic scenes under all‐frequency lighting using integral spherical gaussian
CN109712226A (en) The see-through model rendering method and device of virtual reality
US20150161816A1 (en) Simulating Sub-Surface Scattering of Illumination for Simulated Three-Dimensional Objects
Cabeleira Combining rasterization and ray tracing techniques to approximate global illumination in real-time
CN113313622A (en) Illumination simulation method and device in virtual scene and electronic equipment
Papaefthymiou et al. Real‐time rendering under distant illumination with conformal geometric algebra
Elek et al. Spectral ray differentials
US20180005432A1 (en) Shading Using Multiple Texture Maps
Wang et al. Rendering transparent objects with caustics using real-time ray tracing
US20190371049A1 (en) Transform-based shadowing of object sets
CN109934900A (en) Real-time global illumination solution based on VR hardware structure
Otto et al. Physically-based Environment and Area Lighting using Progressive Rendering in WebGL
Yutong et al. Study of water surface scattering model based on Unity3D Shader

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: 21936788

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: 21936788

Country of ref document: EP

Kind code of ref document: A1