CN115131482A - Rendering method, device and device for lighting information in game scene - Google Patents
Rendering method, device and device for lighting information in game scene Download PDFInfo
- Publication number
- CN115131482A CN115131482A CN202210325539.9A CN202210325539A CN115131482A CN 115131482 A CN115131482 A CN 115131482A CN 202210325539 A CN202210325539 A CN 202210325539A CN 115131482 A CN115131482 A CN 115131482A
- Authority
- CN
- China
- Prior art keywords
- information
- voxels
- game scene
- probe
- illumination
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000009877 rendering Methods 0.000 title claims abstract description 126
- 238000000034 method Methods 0.000 title claims abstract description 99
- 239000000523 sample Substances 0.000 claims abstract description 373
- 238000005070 sampling Methods 0.000 claims abstract description 54
- 238000003860 storage Methods 0.000 claims abstract description 29
- 238000005286 illumination Methods 0.000 claims description 128
- 230000008569 process Effects 0.000 claims description 39
- 238000013507 mapping Methods 0.000 claims description 20
- 230000011218 segmentation Effects 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 12
- 238000012545 processing Methods 0.000 claims description 3
- 230000005540 biological transmission Effects 0.000 abstract description 10
- 230000000694 effects Effects 0.000 description 19
- 238000000605 extraction Methods 0.000 description 13
- 238000009826 distribution Methods 0.000 description 12
- 238000010586 diagram Methods 0.000 description 8
- 230000004044 response Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 6
- 230000003068 static effect Effects 0.000 description 6
- 239000000284 extract Substances 0.000 description 5
- 230000003044 adaptive effect Effects 0.000 description 4
- 239000000463 material Substances 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000010365 information processing Effects 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 239000013589 supplement Substances 0.000 description 2
- 230000007704 transition Effects 0.000 description 2
- 238000010521 absorption reaction Methods 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 239000011449 brick Substances 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000005094 computer simulation Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 230000036651 mood Effects 0.000 description 1
- 238000010422 painting Methods 0.000 description 1
- 230000000704 physical effect Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 239000000779 smoke Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/005—General purpose rendering architectures
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/50—Controlling the output signals based on the game progress
- A63F13/52—Controlling the output signals based on the game progress involving aspects of the displayed game scene
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/04—Texture mapping
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/50—Lighting effects
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F2300/00—Features 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/60—Methods for processing data by generating or executing the game program
- A63F2300/66—Methods for processing data by generating or executing the game program for rendering three dimensional images
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Image Generation (AREA)
Abstract
本申请公开了一种游戏场景中光照信息的渲染方法、装置及设备,涉及3D渲染技术领域,能够自适应布局光照探针,降低游戏场景中光照信息采样的更新、传输和存储成本,提高光照信息的渲染效率。其中方法包括:利用游戏场景中空间区域的数据结构对空间区域进行切分,提取包含有物体的空间体素,数据结构为包含有多个层级的网格数据;遍历多个层级的网格数据,针对包含有物体的空间体素设置有效光照探针,得到空间区域的第一光照探针网格;针对未包含物体的空间体素补充设置虚拟光照探针,得到空间区域的第二光照探针网格;将第二光照探针网格所采集的光照信息传输至纹理资源信息中,并根据纹理资源信息对游戏场景中的光照信息进行渲染。
The present application discloses a method, device and device for rendering lighting information in a game scene, relating to the technical field of 3D rendering, capable of adaptively arranging lighting probes, reducing the update, transmission and storage costs of lighting information sampling in the game scene, and improving lighting Information rendering efficiency. The method includes: using the data structure of the spatial region in the game scene to segment the spatial region, extracting the spatial voxels containing objects, and the data structure is grid data containing multiple levels; traversing the grid data of multiple levels , set an effective light probe for the space voxels that contain objects to obtain the first light probe grid of the space area; set up virtual light probes for the space voxels that do not contain objects to obtain the second light probe of the space area Needle grid; transmit the lighting information collected by the second light probe grid to the texture resource information, and render the lighting information in the game scene according to the texture resource information.
Description
技术领域technical field
本申请涉及3D渲染技术领域,尤其是涉及到一种游戏场景中光照信息的渲染方法、装置及设备。The present application relates to the technical field of 3D rendering, and in particular, to a method, apparatus and device for rendering lighting information in a game scene.
背景技术Background technique
随着游戏行业的兴起,很多3D游戏都需要场景,建立渲染场景,再加上物理效果,可以让游戏场景可视化,提高玩家的游戏效果。由于游戏场景是采用计算机技术描述的虚拟世界,该虚拟世界与真实世界相似,场景中包含光、物体以及游戏中的物体与场景光源发出的光线,发生反射或者折射现象,为了提高游戏场景的真实性,通常会使用全局光照进行渲染,全局光照通过一系列复杂的算法,来计算光线从光源射出后在物体表面间的弹射,通常在运行时实现精准的模拟,所使用的计算开销较大。With the rise of the game industry, many 3D games require scenes. The establishment of rendering scenes, coupled with physical effects, can visualize the game scene and improve the player's game effect. Because the game scene is a virtual world described by computer technology, the virtual world is similar to the real world. The scene contains light, objects, and the light emitted by the objects in the game and the light source of the scene, and the phenomenon of reflection or refraction occurs. In order to improve the authenticity of the game scene Generally, global illumination is used for rendering. Global illumination uses a series of complex algorithms to calculate the bounce of light between object surfaces after being emitted from the light source. Usually, accurate simulation is achieved at runtime, and the computational overhead used is relatively large.
在实际开发场景中,针对动态物体全局光照效果,通常采用分布在游戏场景中的光照探收集器对光照信息进行逐像素采样,光照探针收集器作为空间中的一个个位置点,能够存储来自所有方向的光线采样,以形成游戏场景中的光照信息。然而,以像素为单位对光照信息进行采样的方式需要使用更加精确的光照探针,游戏场景中像素纹理的数量决定了光照探针的数量,大量的像素纹理从一定程度上需要GPU硬件快速采样每帧数百万个光照探针,使得游戏场景中光照信息采样的更新、传输和存储成本较高,影响光照信息的渲染效率。In the actual development scene, for the global illumination effect of dynamic objects, light probe collectors distributed in the game scene are usually used to sample the lighting information pixel by pixel. Light samples from all directions to form lighting information in the game scene. However, the way of sampling lighting information in pixels requires the use of more accurate light probes. The number of pixel textures in the game scene determines the number of light probes, and a large number of pixel textures require fast sampling by GPU hardware to a certain extent. Millions of light probes per frame make the update, transmission and storage costs of lighting information sampling in the game scene high, affecting the rendering efficiency of lighting information.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本申请提供了一种游戏场景中光照信息的渲染方法、装置及设备,主要目的在于解决现有技术游戏场景中光照信息采样的更新、传输和存储成本较高,影响光照信息的渲染效率的问题。In view of this, the present application provides a method, device and device for rendering lighting information in a game scene, the main purpose of which is to solve the problem that the update, transmission and storage costs of lighting information sampling in the game scene of the prior art are relatively high and affect the illumination information. Rendering efficiency issues.
根据本申请的第一个方面,提供了一种游戏场景中光照信息的渲染方法,包括:According to a first aspect of the present application, a method for rendering lighting information in a game scene is provided, including:
利用游戏场景中空间区域的数据结构对所述空间区域进行切分,提取包含有物体的空间体素,所述数据结构为包含有多个层级的网格数据;The spatial region is segmented by using the data structure of the spatial region in the game scene, and the spatial voxels containing objects are extracted, and the data structure is grid data containing multiple levels;
遍历所述多个层级的网格数据,针对所述包含有物体的空间体素设置有效光照探针,得到空间区域的第一光照探针网格,所述第一光照探针网格包含有效光照探针;Traverse the grid data of the multiple levels, set valid illumination probes for the spatial voxels that contain objects, and obtain a first illumination probe grid of the spatial area, the first illumination probe grid includes valid illumination probes light probe;
针对未包含物体的空间体素补充设置虚拟光照探针,得到空间区域的第二光照探针网格,所述第二光照探针网格包含有效光照探针和虚拟光照探针;Supplementary setting of virtual light probes for spatial voxels that do not contain objects, to obtain a second light probe grid of the spatial region, where the second light probe grid includes effective light probes and virtual light probes;
将所述第二光照探针网格所采集的光照信息传输至纹理资源信息中,并根据所述纹理资源信息对游戏场景中的光照信息进行渲染。The lighting information collected by the second lighting probe grid is transmitted to the texture resource information, and the lighting information in the game scene is rendered according to the texture resource information.
进一步地,所述数据结构为所述空间区域所形成的树形结构,所述利用游戏场景中空间区域的数据结构对所述空间区域进行切分,提取包含有物体的空间体素,具体包括:利用所述空间区域所形成的树形结构对所述空间区域进行多层级切分,形成多个层级的空间体素;在多层级空间区域的切分过程中,判断切分后层级内的空间体素是否包含有物体;若是,则对切分后层级内的空间体素进行下一层级切分,直至层级数量达到预设阈值,提取包含有物体的空间体素。Further, the data structure is a tree structure formed by the spatial region, and the spatial region is segmented by using the data structure of the spatial region in the game scene, and the spatial voxels containing objects are extracted, specifically including: : Use the tree structure formed by the spatial region to perform multi-level segmentation on the spatial region to form multiple levels of spatial voxels; during the segmentation process of the multi-level spatial region, determine the Whether the space voxel contains objects; if so, the space voxels in the divided level are divided into the next level until the number of levels reaches the preset threshold, and the space voxels containing objects are extracted.
进一步地,针对所述包含有物体的空间体素设置有效光照探针,得到空间区域的第一光照探针网格,具体包括:针对包含有物体的空间体素,获取所述空间体素在多个层级的网格数据中所处的网格位置;在所述第一网格位置中的顶点设置有效光照探针,得到空间区域的第一光照探针网格。Further, setting an effective illumination probe for the space voxel containing the object to obtain the first illumination probe grid of the space area specifically includes: for the space voxel containing the object, obtaining the space voxel in the space voxel. Grid positions in the grid data of multiple levels; valid light probes are set on vertices in the first grid positions to obtain a first light probe grid in the spatial area.
进一步地,所述针对未包含物体的空间体素补充设置虚拟光照探针,得到空间区域的第二光照探针网格,具体包括:遍历所述多个层级的网格数据,针对每个层级中未包含物体的空间体素,获取所述空间体素在多个层级的网格数据中所处的第二网格位置;判断所述网格位置的四个顶点处是否设置有效光照探针;若否,则针对网格位置中未设置有效光照探针的顶点补充设置虚拟光照探针,得到空间区域的第二光照探针网格。Further, the supplementary setting of virtual light probes for spatial voxels that do not contain objects to obtain a second light probe grid of the spatial region specifically includes: traversing the grid data of the multiple levels, for each level The spatial voxel that does not contain the object, obtain the second grid position where the spatial voxel is located in the grid data of multiple levels; determine whether the four vertices of the grid position are set with valid light probes ; if not, set up a virtual light probe for the vertices in the grid position where no valid light probe is set to obtain the second light probe mesh of the space area.
进一步地,在所述将所述第二光照探针网格所采集的光照信息传输至纹理资源信息中,并根据所述纹理资源信息对游戏场景中的光照信息进行渲染之前,所述方法还包括:抽取所述第二光照探针网格中光照信息所映射的空间逻辑关系,并将所述空间逻辑关系存储至纹理资源信息中。Further, before the lighting information collected by the second lighting probe grid is transmitted to the texture resource information, and the lighting information in the game scene is rendered according to the texture resource information, the method further includes: The method includes: extracting the spatial logical relationship mapped by the lighting information in the second light probe grid, and storing the spatial logical relationship into texture resource information.
进一步地,所述根据所述纹理资源信息对游戏场景中的光照信息进行渲染,具体包括:按照所述空间逻辑关系将所述纹理资源信息中光照信息展开到三维分块数据集中,并利用间接纹理记录三维分块数据集之间层级关系;利用所述间接纹理中三维分块数据集之间层级关系合并所述三维分块数据集,形成树形结构的三维分块纹理信息,所述三维分块纹理信息中记录有光照信息在游戏场景中的空间位置;根据视点位置在游戏场景中的空间位置,从所述树形结构的三维分块纹理信息中读取相应空间位置的光照信息进行渲染。Further, the rendering of the lighting information in the game scene according to the texture resource information specifically includes: expanding the lighting information in the texture resource information into a three-dimensional block data set according to the spatial logical relationship, and using indirect The texture records the hierarchical relationship between the three-dimensional block data sets; the three-dimensional block data sets are merged by using the hierarchical relationship between the three-dimensional block data sets in the indirect texture to form tree-structured three-dimensional block texture information, and the three-dimensional block texture information is formed. The spatial position of the lighting information in the game scene is recorded in the block texture information; according to the spatial position of the viewpoint position in the game scene, the lighting information of the corresponding spatial position is read from the three-dimensional block texture information of the tree structure. render.
进一步地,所述按照所述空间逻辑关系将所述纹理资源信息中光照信息展开到三维分块数据集中,并利用间接纹理记录每三维分块数据集之间层级关系,具体包括:根据所述空间逻辑关系,提取所述第二光照探针网格中有效光照探针和虚拟光照探针的层级分布;按照所述第二光照探针网格中有效光照探针和虚拟光照探针的层级分布,将所述纹理资源信息中光照信息展开到三维分块数据中,并利用间接纹理记录三维分块数据集之间层级关系。Further, expanding the lighting information in the texture resource information into a three-dimensional block data set according to the spatial logical relationship, and recording the hierarchical relationship between each three-dimensional block data set using an indirect texture, specifically includes: according to the The spatial logical relationship is to extract the hierarchical distribution of effective light probes and virtual light probes in the second light probe grid; according to the levels of the effective light probes and virtual light probes in the second light probe grid distribution, expand the lighting information in the texture resource information into the three-dimensional block data, and use the indirect texture to record the hierarchical relationship between the three-dimensional block data sets.
进一步地,所述根据视点位置在游戏场景中的空间位置,从所述树形结构的三维分块纹理信息中读取相应空间位置的光照信息进行渲染,具体包括:根据视点位置在游戏场景中的空间位置,从所述树形结构的三维分块纹理信息中获取表征三维分块数据集之间层级关系的间接纹理;利用所述表征三维分块数据集之间层级关系的间接纹理,读取所述树形结构的三维分块纹理信息中相应空间位置的光照信息进行渲染。Further, according to the spatial position of the viewpoint position in the game scene, the lighting information of the corresponding spatial position is read from the three-dimensional block texture information of the tree structure for rendering, which specifically includes: according to the viewpoint position in the game scene. The spatial position of , obtains the indirect texture representing the hierarchical relationship between the three-dimensional block data sets from the three-dimensional block texture information of the tree structure; using the indirect texture representing the hierarchical relationship between the three-dimensional block data sets, read The illumination information of the corresponding spatial position in the three-dimensional block texture information of the tree structure is taken for rendering.
根据本申请的第二个方面,提供了一种游戏场景中光照信息的渲染方法,包括:According to a second aspect of the present application, a method for rendering lighting information in a game scene is provided, including:
获取游戏场景中空间体素包含的近距离体素,所述近距离体素为游戏场景中空间体素分割所形成预设层级的体素中符合距离条件的体素,所述距离条件为体素的包围盒与游戏场景中物体包围盒相交;Obtain the close-range voxels included in the space voxels in the game scene, where the close-range voxels are voxels that meet the distance condition in the voxels of the preset level formed by the division of space voxels in the game scene, and the distance condition is the volume The bounding box of the pixel intersects the bounding box of the object in the game scene;
为所述空间体素包含的近距离体素创建有效光照探针和虚拟光照探针,生成空间体素的探针网格,所述探针网格用于捕获游戏场景中的光照信息;creating effective lighting probes and virtual lighting probes for the close-range voxels included in the spatial voxels, and generating a probe grid of the spatial voxels, where the probe grids are used to capture lighting information in the game scene;
根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中;Combine and store the lighting information captured by the probe grid of the spatial voxel into the texture resource information according to the viewpoint position in the game scene;
响应于光照信息的渲染指令,利用所述纹理资源信息建立渲染任务,对所述游戏场景中光照信息进行渲染。In response to the rendering instruction of the lighting information, a rendering task is established by using the texture resource information, and the lighting information in the game scene is rendered.
进一步地,所述获取游戏场景中物体表面的近距离体素,具体包括:获取游戏场景中待挂接物体覆盖的空间区域,将所述空间区域内的每个空间体素分割为预设层级的体素;遍历预设层级内的每个体素,判断分割后体素的包围盒与游戏场景中物体包围盒相交;若是,则确定所述分割后体素为游戏场景中物体表面的近距离体素。Further, the obtaining of the close-range voxels of the surface of the object in the game scene specifically includes: obtaining the space area covered by the object to be attached in the game scene, and dividing each space voxel in the space area into preset levels traverse each voxel in the preset level, and determine that the bounding box of the divided voxel intersects the bounding box of the object in the game scene; if so, determine that the divided voxel is the close distance of the surface of the object in the game scene voxels.
进一步地,所述为所述空间体素包含的近距离体素创建有效光照探针和虚拟光照探针,生成空间体素的探针网格,具体包括:针对所述空间体素中处于层级内的近距离体素,创建有效光照探针;为所述空间体素增设层级对应的虚拟体素,针对所述虚拟体素中符合添加条件的体素创建虚拟光照探针,所述虚拟光照探针用于对所述空间体素中处于层级内近距离体素所采样的光照数据进行无缝插值。Further, creating effective illumination probes and virtual illumination probes for the close-range voxels included in the spatial voxels, and generating a probe grid of the spatial voxels, specifically includes: for the spatial voxels in the hierarchical level create a valid light probe for the close-range voxels in Probes are used to seamlessly interpolate illumination data sampled by close-range voxels in the spatial voxels.
进一步地,所述为所述空间体素增设层级对应的虚拟体素,针对所述虚拟体素中符合添加条件的体素创建虚拟光照探针,具体包括:针对所述空间体素中大于一阶的层级,增设层级对应的虚拟体素,所述虚拟体素与所述空间体素中对应层级的体素相映射;遍历层级对应的虚拟体素,判断所述空间体素中相映射体素是否存在有效光照探针;若否,则针对虚拟体素创建虚拟光照探针。Further, adding a virtual voxel corresponding to the level for the spatial voxel, and creating a virtual light probe for the voxels that meet the addition conditions in the virtual voxel, specifically includes: for more than one of the spatial voxels. The level of the level, the virtual voxel corresponding to the level is added, and the virtual voxel is mapped with the voxel of the corresponding level in the space voxel; the virtual voxel corresponding to the level is traversed, and the mapped volume in the space voxel is judged Whether a valid light probe exists for the voxel; if not, a virtual light probe is created for the virtual voxel.
进一步地,在所述根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中之前,所述方法还包括:根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息展开到三维分块数据集,形成多层级树形结构的三维分块纹理信息;在展开到三维分块数据集的过程中,将所述三维分块数据集映射的层级关系记录至间接纹理信息中;Further, before combining and storing the lighting information captured by the probe grid of the spatial voxel into the texture resource information according to the viewpoint position in the game scene, the method further includes: according to the viewpoint position in the game scene, The illumination information captured by the probe grid of the space voxel is expanded into a three-dimensional block data set to form a three-dimensional block texture information of a multi-level tree structure; in the process of expanding into a three-dimensional block data set, all The hierarchical relationship of the three-dimensional block data set mapping is recorded in the indirect texture information;
所述所述根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中,具体包括:将所述三维分块纹理信息与所述间接纹理信息合并存储至纹理资源信息中。The combining and storing the lighting information captured by the probe grid of the spatial voxel into the texture resource information according to the viewpoint position in the game scene specifically includes: combining the three-dimensional block texture information with the indirect texture The information is merged into the texture resource information.
进一步地,所述根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息展开到三维分块数据集,形成多层级树形结构的三维分块纹理信息,具体包括:利用所述探针网格中有效光照探针采样游戏场景中的光照数据,并对所述光照数据进行插值运算,得到游戏场景中视点位置的第一光照信息;利用所述探针网格中虚拟光照探针对所述空间体素中处于层级内近距离体素所采样的光照数据进行无缝插值,得到游戏场景中视点位置的第二光照信息;将所述游戏场景中视点位置的第一光照信息和第二光照信息展开到三维分块数据集,形成多层级树形结构的三维分块纹理信息。Further, according to the viewpoint position in the game scene, the lighting information captured by the probe grid of the spatial voxel is expanded into a three-dimensional block data set to form a three-dimensional block texture information of a multi-level tree structure, which specifically includes: : use the effective illumination probes in the probe grid to sample the illumination data in the game scene, and perform interpolation operation on the illumination data to obtain the first illumination information of the viewpoint position in the game scene; use the probe grid The middle virtual light probe performs seamless interpolation on the lighting data sampled by the close-range voxels in the space voxels, so as to obtain the second lighting information of the viewpoint position in the game scene; The first illumination information and the second illumination information are expanded into a three-dimensional block data set to form three-dimensional block texture information of a multi-level tree structure.
进一步地,所述利用所述纹理资源信息建立渲染任务,对所述游戏场景中光照信息进行渲染,具体包括:利用所述纹理资源信息建立渲染任务,从所述间接纹理信息中获取三维分块纹理信息映射的层级关系;根据所述三维分块纹理信息映射的层级关系,查询所述三维纹理信息在树形结构中的位置信息;按照所述三维纹理信息在树形结构中的位置位置从所述三维分块纹理信息中采样所述空间体素的探针网格所捕获的光照信息,对所述光照信息进行渲染。Further, establishing a rendering task by using the texture resource information to render the lighting information in the game scene specifically includes: establishing a rendering task by using the texture resource information, and obtaining three-dimensional blocks from the indirect texture information The hierarchical relationship of texture information mapping; according to the hierarchical relationship of the three-dimensional block texture information mapping, query the position information of the three-dimensional texture information in the tree structure; according to the position of the three-dimensional texture information in the tree structure from The illumination information captured by the probe grid of the spatial voxel is sampled from the three-dimensional block texture information, and the illumination information is rendered.
进一步地,所述根据所述三维分块纹理信息映射的层级关系,查询所述三维纹理信息在树形结构中的位置信息,具体包括:根据所述三维分块纹理信息映射的层级关系,提取所述三维分块纹理信息在树形结构中所处层级和偏移量;根据所述三维分块纹理信息在树形结构中所处层级和偏移量,计算所述三维纹理信息在树形结构中的位置信息。Further, the querying the position information of the three-dimensional texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping, specifically includes: extracting the three-dimensional block texture information according to the hierarchical relationship of the three-dimensional block texture information mapping. The level and offset of the three-dimensional block texture information in the tree structure; according to the level and offset of the three-dimensional block texture information in the tree structure, calculate the three-dimensional texture information in the tree structure. Location information in the structure.
根据本申请的第三个方面,提供了一种游戏场景中光照信息的渲染装置,包括:According to a third aspect of the present application, an apparatus for rendering lighting information in a game scene is provided, including:
提取单元,用于利用游戏场景中空间区域的数据结构对所述空间区域进行切分,提取包含有物体的空间体素,所述数据结构为包含有多个层级的网格数据;an extraction unit, used for segmenting the spatial region by using the data structure of the spatial region in the game scene, and extracting the spatial voxels containing objects, and the data structure is grid data containing multiple levels;
第一设置单元,用于遍历所述多个层级的网格数据,针对所述包含有物体的空间体素设置有效光照探针,得到空间区域的第一光照探针网格,所述第一光照探针网格包含有效光照探针;The first setting unit is used for traversing the grid data of the multiple levels, setting effective illumination probes for the spatial voxels containing objects, and obtaining a first illumination probe grid of the spatial area, the first The light probe grid contains valid light probes;
第二设置单元,用于针对未包含物体的空间体素补充设置虚拟光照探针,得到空间区域的第二光照探针网格,所述第二光照探针网格包含有效光照探针和虚拟光照探针;The second setting unit is used to supplementally set virtual light probes for spatial voxels that do not contain objects, so as to obtain a second light probe grid of the spatial area, where the second light probe grid includes effective light probes and virtual light probes. light probe;
第一渲染单元,用于将所述第二光照探针网格所采集的光照信息传输至纹理资源信息中,并根据所述纹理资源信息对游戏场景中的光照信息进行渲染。The first rendering unit is configured to transmit the lighting information collected by the second lighting probe grid to the texture resource information, and render the lighting information in the game scene according to the texture resource information.
进一步地,所述数据结构为所述空间区域所形成的树形结构,所述提取单元包括:切分模块,用于利用所述空间区域所形成的树形结构对所述空间区域进行多层级切分,形成多个层级的空间体素;第一判断模块,用于在多层级空间区域的切分过程中,判断切分后层级内的空间体素是否包含有物体;提取模块,用于若是,则对切分后层级内的空间体素进行下一层级切分,直至层级数量达到预设阈值,提取包含有物体的空间体素。Further, the data structure is a tree structure formed by the spatial region, and the extraction unit includes: a segmentation module, configured to perform multi-level multi-level analysis on the spatial region by using the tree structure formed by the spatial region Segmentation to form spatial voxels of multiple levels; the first judgment module is used to judge whether the spatial voxels in the divided levels contain objects during the segmentation process of the multi-level spatial area; the extraction module is used to If so, the space voxels in the segmented level are segmented to the next level until the number of levels reaches a preset threshold, and the space voxels containing objects are extracted.
进一步地,所述第一设置单元包括:第一获取模块,用于针对包含有物体的空间体素,获取所述空间体素在多个层级的网格数据中所处的网格位置;第一设置模块,用于在所述第一网格位置中的顶点设置有效光照探针,得到空间区域的第一光照探针网格。Further, the first setting unit includes: a first acquisition module, for acquiring the grid positions of the spatial voxels in the grid data of multiple levels for the spatial voxels containing objects; A setting module, configured to set valid light probes at vertices in the first grid position to obtain a first light probe grid of the spatial region.
进一步地,所述第二设置单元包括:第二获取模块,用于遍历所述多个层级的网格数据,针对每个层级中未包含物体的空间体素,获取所述空间体素在多个层级的网格数据中所处的第二网格位置;第二判断模块,用于判断所述网格位置的四个顶点处是否设置有效光照探针;第二设置模块,用于若否,则针对网格位置中未设置有效光照探针的顶点补充设置虚拟光照探针,得到空间区域的第二光照探针网格。Further, the second setting unit includes: a second acquisition module, used for traversing the grid data of the multiple levels, and for the spatial voxels that do not contain objects in each level, acquiring the spatial voxel in the multi-level. The second grid position in the grid data of each level; the second judgment module is used for judging whether the four vertices of the grid position are set with valid light probes; the second setting module is used for if not , then a virtual light probe is additionally set for the vertices in the grid position where the valid light probe is not set to obtain the second light probe mesh of the space area.
进一步地,所述装置还包括:抽取单元,用于在所述将所述第二光照探针网格所采集的光照信息传输至纹理资源信息中,并根据所述纹理资源信息对游戏场景中的光照信息进行渲染之前,抽取所述第二光照探针网格中光照信息所映射的空间逻辑关系,并将所述空间逻辑关系存储至纹理资源信息中。Further, the apparatus further includes: an extraction unit, configured to transmit the illumination information collected by the second illumination probe grid to the texture resource information, and perform an extraction method according to the texture resource information in the game scene. Before rendering the illumination information of the second illumination probe, the spatial logical relationship mapped by the illumination information in the second illumination probe grid is extracted, and the spatial logical relationship is stored in the texture resource information.
进一步地,所述第一渲染单元包括:展开模块,用于按照所述空间逻辑关系将所述纹理资源信息中光照信息展开到三维分块数据集中,并利用间接纹理记录三维分块数据集之间层级关系;合并模块,用于利用所述间接纹理中三维分块数据集之间层级关系合并所述三维分块数据集,形成树形结构的三维分块纹理信息,所述三维分块纹理信息中记录有光照信息在游戏场景中的空间位置;读取模块,用于根据视点位置在游戏场景中的空间位置,从所述树形结构的三维分块纹理信息中读取相应空间位置的光照信息进行渲染。Further, the first rendering unit includes: an expansion module, configured to expand the lighting information in the texture resource information into a three-dimensional block data set according to the spatial logical relationship, and record the three-dimensional block data set using an indirect texture. The merging module is used for merging the three-dimensional block data sets by using the hierarchical relationship between the three-dimensional block data sets in the indirect texture to form three-dimensional block texture information in a tree structure, and the three-dimensional block texture information The information records the spatial position of the lighting information in the game scene; the reading module is used to read the corresponding spatial position from the three-dimensional block texture information of the tree structure according to the spatial position of the viewpoint position in the game scene. Lighting information for rendering.
进一步地,所述展开模块,具体用于根据所述空间逻辑关系,提取所述第二光照探针网格中有效光照探针和虚拟光照探针的层级分布;所述展开模块,具体还用于按照所述第二光照探针网格中有效光照探针和虚拟光照探针的层级分布,将所述纹理资源信息中光照信息展开到三维分块数据中,并利用间接纹理记录三维分块数据集之间层级关系。Further, the expansion module is specifically configured to extract the hierarchical distribution of the effective illumination probes and the virtual illumination probes in the second illumination probe grid according to the spatial logical relationship; In accordance with the hierarchical distribution of the effective light probes and the virtual light probes in the second light probe grid, the light information in the texture resource information is expanded into the three-dimensional block data, and the indirect texture is used to record the three-dimensional blocks. Hierarchical relationships between datasets.
进一步地,所述读取模块,具体用于根据视点位置在游戏场景中的空间位置,从所述树形结构的三维分块纹理信息中获取表征三维分块数据集之间层级关系的间接纹理;所述读取模块,具体还用于利用所述表征三维分块数据集之间层级关系的间接纹理,读取所述树形结构的三维分块纹理信息中相应空间位置的光照信息进行渲染。Further, the reading module is specifically configured to obtain the indirect texture representing the hierarchical relationship between the three-dimensional block data sets from the three-dimensional block texture information of the tree structure according to the spatial position of the viewpoint position in the game scene. The reading module is specifically also used to use the indirect texture representing the hierarchical relationship between the three-dimensional block data sets to read the illumination information of the corresponding spatial position in the three-dimensional block texture information of the tree structure for rendering .
根据本申请的第四个方面,提供了一种游戏场景中光照信息的渲染装置,包括:According to a fourth aspect of the present application, an apparatus for rendering lighting information in a game scene is provided, including:
获取单元,用于获取游戏场景中空间体素包含的近距离体素,所述近距离体素为游戏场景中空间体素分割所形成预设层级的体素中符合距离条件的体素,所述距离条件为体素的包围盒与游戏场景中物体包围盒相交;The obtaining unit is used to obtain the close-range voxels included in the space voxels in the game scene, and the close-range voxels are the voxels that meet the distance conditions in the voxels of the preset level formed by the division of space voxels in the game scene, so The distance condition is that the bounding box of the voxel intersects the bounding box of the object in the game scene;
创建单元,用于为所述空间体素包含的近距离体素创建有效光照探针和虚拟光照探针,生成空间体素的探针网格,所述探针网格用于捕获游戏场景中的光照信息;The creation unit is used to create effective light probes and virtual light probes for the close-range voxels contained in the spatial voxels, and generate a probe grid of the spatial voxels, and the probe grid is used to capture the scene in the game scene. light information;
存储单元,用于根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中;a storage unit, configured to combine and store the illumination information captured by the probe grid of the spatial voxel into the texture resource information according to the viewpoint position in the game scene;
第二渲染单元,用于响应于光照信息的渲染指令,利用所述纹理资源信息建立渲染任务,对所述游戏场景中光照信息进行渲染。The second rendering unit is configured to, in response to a rendering instruction of the lighting information, establish a rendering task by using the texture resource information, and render the lighting information in the game scene.
进一步地,所述获取单元包括:分割模块,用于获取游戏场景中待挂接物体覆盖的空间区域,将所述空间区域内的每个空间体素分割为预设层级的体素;第三判断模块,用于遍历预设层级内的每个体素,判断分割后体素的包围盒与游戏场景中物体包围盒相交;确定模块,用于若是,则确定所述分割后体素为游戏场景中物体表面的近距离体素。Further, the acquisition unit includes: a segmentation module, configured to acquire the spatial area covered by the object to be attached in the game scene, and segment each spatial voxel in the spatial area into voxels of a preset level; third The judgment module is used to traverse each voxel in the preset level, and judge that the bounding box of the divided voxel intersects the bounding box of the object in the game scene; the determination module is used to determine that the divided voxel is the game scene Close-up voxels on the surface of the object.
进一步地,所述创建单元包括:创建模块,用于针对所述空间体素中处于层级内的近距离体素,创建有效光照探针;增设模块,用于为所述空间体素增设层级对应的虚拟体素,针对所述虚拟体素中符合添加条件的体素创建虚拟光照探针,所述虚拟光照探针用于对所述空间体素中处于层级内近距离体素所采样的光照数据进行无缝插值。Further, the creation unit includes: a creation module for creating effective illumination probes for close-range voxels in the spatial voxels in a hierarchical level; an addition module for adding hierarchical correspondence to the spatial voxels virtual voxels, create virtual light probes for voxels that meet the addition conditions in the virtual voxels, and the virtual light probes are used to sample the lighting of the close-range voxels in the space voxels The data is seamlessly interpolated.
进一步地,所述增设模块包括:增设子模块,用于针对所述空间体素中大于一阶的层级,增设层级对应的虚拟体素,所述虚拟体素与所述空间体素中对应层级的体素相映射;判断子模块,用于遍历层级对应的虚拟体素,判断所述空间体素中相映射体素是否存在有效光照探针;创建子模块,用于若否,则针对虚拟体素创建虚拟光照探针。Further, the adding module includes: adding a sub-module for adding a virtual voxel corresponding to the hierarchical level for the hierarchical level greater than the first order in the spatial voxel, the virtual voxel and the corresponding hierarchical level in the spatial voxel The voxel phase mapping of Voxels create virtual light probes.
进一步地,所述装置还包括:展开单元,用于在所述根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中之前,根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息展开到三维分块数据集,形成多层级树形结构的三维分块纹理信息;记录单元,用于在展开到三维分块数据集的过程中,将所述三维分块数据集映射的层级关系记录至间接纹理信息中;所述存储单元,还用于将所述三维分块纹理信息与所述间接纹理信息合并存储至纹理资源信息中。Further, the device further includes: an expansion unit, configured to combine and store the lighting information captured by the probe grid of the spatial voxel into the texture resource information according to the viewpoint position in the game scene, according to the game scene The viewpoint position in the scene expands the illumination information captured by the probe grid of the space voxel into a three-dimensional block data set to form a three-dimensional block texture information of a multi-level tree structure; the recording unit is used to expand to three-dimensional block texture information; In the process of dividing the data set, the hierarchical relationship mapped by the three-dimensional dividing data set is recorded in the indirect texture information; the storage unit is further configured to combine the three-dimensional dividing texture information and the indirect texture information Stored in the texture resource information.
进一步地,所述展开单元包括:运算模块,用于利用所述探针网格中有效光照探针采样游戏场景中的光照数据,并对所述光照数据进行插值运算,得到游戏场景中视点位置的第一光照信息;插值模块,用于利用所述探针网格中虚拟光照探针对所述空间体素中处于层级内近距离体素所采样的光照数据进行无缝插值,得到游戏场景中视点位置的第二光照信息;展开模块,用于将所述游戏场景中视点位置的第一光照信息和第二光照信息展开到三维分块数据集,形成多层级树形结构的三维分块纹理信息。Further, the expansion unit includes: an operation module for sampling the illumination data in the game scene by using the effective illumination probes in the probe grid, and performing interpolation operation on the illumination data to obtain the position of the viewpoint in the game scene The first illumination information; an interpolation module, used to seamlessly interpolate the illumination data sampled by the close-range voxels in the space voxels by using the virtual illumination probe in the probe grid to obtain the game scene The second illumination information of the viewpoint position; the expansion module is used to expand the first illumination information and the second illumination information of the viewpoint position in the game scene into a three-dimensional block data set, forming a three-dimensional block of a multi-level tree structure texture information.
进一步地,所述第二渲染单元包括:获取模块,用于利用所述纹理资源信息建立渲染任务,从所述间接纹理信息中获取三维分块纹理信息映射的层级关系;查询模块,用于根据所述三维分块纹理信息映射的层级关系,查询所述三维纹理信息在树形结构中的位置信息;采样模块,用于按照所述三维纹理信息在树形结构中的位置位置从所述三维分块纹理信息中采样所述空间体素的探针网格所捕获的光照信息,对所述光照信息进行渲染。Further, the second rendering unit includes: an acquisition module, used for establishing a rendering task by using the texture resource information, and acquiring the hierarchical relationship of the three-dimensional block texture information mapping from the indirect texture information; a query module, used for according to The hierarchical relationship of the three-dimensional block texture information mapping is to query the position information of the three-dimensional texture information in the tree structure; the sampling module is used to select the three-dimensional texture information from the three-dimensional texture information according to the position of the three-dimensional texture information in the tree structure. Lighting information captured by the probe grid of the spatial voxel is sampled from the block texture information, and the lighting information is rendered.
进一步地,所述查询模块包括:提取子模块,用于根据所述三维分块纹理信息映射的层级关系,提取所述三维分块纹理信息在树形结构中所处层级和偏移量;计算子模块,用于根据所述三维分块纹理信息在树形结构中所处层级和偏移量,计算所述三维纹理信息在树形结构中的位置信息。Further, the query module includes: an extraction sub-module, configured to extract the level and offset of the three-dimensional block texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping; calculate The sub-module is configured to calculate the position information of the three-dimensional texture information in the tree structure according to the level and offset of the three-dimensional block texture information in the tree structure.
根据本申请的第五个方面,提供了一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述第一方面所述方法的步骤。According to a fifth aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in the first aspect when the processor executes the computer program .
根据本申请的第六个方面,提供了一种可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面所述的方法的步骤。According to a sixth aspect of the present application, there is provided a readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of the method described in the first aspect above.
在游戏场景中,光照是一个影响较大的因素,也是视觉风格不可缺失的一部分,通常情况下,游戏场景中的静态和动态物体都存在体积大小不一、或者模型结构复杂的可能,这些美术资产都很难烘焙成有效的光照贴图,而逐像素采样的光照探针可以避免运动物体的光照效果和整个使用静态光照贴图的场景不协调的感觉,能够给场景带来统一的间接光照,同时简化了渲染管线的复杂度,提升渲染效率。在光照探针运行过程中,可以针对某一光照探针所在的位置点上对光照信息进行采样,然后从该光照探针相邻的其他光照探针的位置上对光照信息进行采样,然后把这些采样得到的光照信息进行插值运算,以计算出这些光照探针之间某个位置的光照信息。In game scenes, lighting is an important factor and an indispensable part of visual style. Usually, static and dynamic objects in game scenes may have different sizes or complex model structures. These art Assets are difficult to bake into valid lightmaps, and per-pixel sampling light probes can avoid the lighting effects of moving objects and the incongruity of the entire scene using static lightmaps, and can bring uniform indirect lighting to the scene, while at the same time Simplifies the complexity of the rendering pipeline and improves rendering efficiency. During the operation of the light probe, the light information can be sampled at the position of a light probe, and then the light information can be sampled from the positions of other light probes adjacent to the light probe, and then These sampled lighting information is interpolated to calculate the lighting information of a certain position between these light probes.
作为光照探针采集光照信息的一种方式,可以针对游戏场景中逐个物体进行采样,具体包括逐个物体对应参数采样和逐个物体3D纹理采样,在逐个物体对应参数采样的过程中,光照变化取决于物体表面法线,在解算阶段都需要利用物体表面的法线,针对小型物体来说是足够的,但可能会导致与相邻较大的模型出现光照不匹配和不连续的情况,所以在CPU端进行一对一的收集、更新、采样,针对每个相关物体都有其对应插值后的SH系数(Spherical Harmonic,球面调和函数),相对容易维护、成本低廉;在逐个物体3D纹理采样的过程中,利用了硬件加速功能在GPU端进行采样插值计算,相比上述逐个物体对应参数采样的方式,从一定程度上改善了光照信息的采样效果。As a way for light probes to collect lighting information, it can sample objects one by one in the game scene, including object-by-object parameter sampling and object-by-object 3D texture sampling. In the process of object-by-object parameter sampling, illumination changes depend on The surface normal of the object needs to be used in the solution stage. It is sufficient for small objects, but it may cause lighting mismatch and discontinuity with adjacent larger models. Therefore, in the The CPU side performs one-to-one collection, update, and sampling, and has its corresponding interpolated SH coefficient (Spherical Harmonic, spherical harmonic function) for each related object, which is relatively easy to maintain and low-cost; in the object-by-object 3D texture sampling In the process, the hardware acceleration function is used to perform sampling interpolation calculation on the GPU side, which improves the sampling effect of lighting information to a certain extent compared with the above-mentioned method of sampling corresponding parameters one by one.
作为光照探针的采集光照信息的另一种方式,可以针对游戏场景中逐个像素进行采样,由于屏幕像素是固定的,以像素为单位代替以物体单位采集光照信息的方式,能够提供更加精确的光照探针,并在像素或计算着色器中,多个光照探针之间进行线性插值时,可以使用GPU硬件来快速采样每帧数百万个光照探针捕获的光照信息。As another way of collecting lighting information for light probes, sampling can be performed pixel by pixel in the game scene. Since the screen pixels are fixed, the method of collecting lighting information by pixel units instead of object units can provide more accurate Light probes, and in pixel or compute shaders, when linearly interpolating between multiple light probes, GPU hardware can be used to quickly sample the lighting information captured by millions of light probes per frame.
借由上述技术方案,本申请提供的一种游戏场景中光照信息的渲染方法、装置及设备,与现有方式使用逐物体采样光照信息的方式相比,本申请通过使用逐像素采样光照信息的方式,一方面能够为大量及复杂物体提供间接光照,适用多种光照采集场景,另一方面避免了3D纹理从CPU端至GPU端的更新成本、传输带宽所限制逐个物体采样的物体总数。与现有方式使用逐像素采样光照信息的方式相比,本申请通过获取游戏场景中空间体素包含的近距离体素,该近距离体素为靠近物体表面的体素,需要更多数量的光照探针,进一步为空间体素包含的近距离体素创建有效光照探针和虚拟光照探针,生成空间体素的探针网格,能够自适应布局光照探针和虚拟光照探针,该虚拟光照探针作为辅助有效光照探针,为游戏场景提供无缝插值,并根据游戏场景中视点位置将空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中,该纹理资源信息能够应对不同游戏场景的光照信息采样,以使得同屏像素根据其在不同的空间位置采样到不同面密度的插值结果,进而在响应于光照信息的渲染指令时,利用纹理资源信息建立渲染任务,对游戏场景中光照信息进行渲染,该纹理资源信息中缓存了游戏场景的三维纹理地址,由于游戏场景中像素纹理的数量决定了光照探针的数量,而大量的体素通过自适应布局光照探针,能够节省光照探针数量,无需GPU硬件快速采样每帧数百万个光照探针,降低游戏场景中光照信息采样的更新、传输和存储成本,提高光照信息的渲染效率。With the above technical solutions, the present application provides a method, device and device for rendering lighting information in a game scene. Compared with the existing method of using object-by-object sampling lighting information, the present application uses pixel-by-pixel sampling lighting information. On the one hand, it can provide indirect lighting for a large number of and complex objects, and is suitable for a variety of lighting collection scenarios. Compared with the existing method of using pixel-by-pixel sampling illumination information, the present application obtains the close-range voxels contained in the spatial voxels in the game scene, and the close-range voxels are voxels close to the surface of the object, which requires a larger number of Light probes, further create effective light probes and virtual light probes for close-range voxels contained in space voxels, generate probe grids for space voxels, and can adaptively layout light probes and virtual light probes. As an auxiliary effective light probe, the virtual light probe provides seamless interpolation for the game scene, and combines and stores the light information captured by the probe grid of the spatial voxel into the texture resource information according to the viewpoint position in the game scene. The resource information can deal with the lighting information sampling of different game scenes, so that the pixels on the same screen can sample interpolation results of different surface densities according to their different spatial positions, and then use the texture resource information to create rendering in response to the rendering instructions of the lighting information. The task is to render the lighting information in the game scene. The texture resource information caches the 3D texture address of the game scene. Since the number of pixel textures in the game scene determines the number of light probes, and a large number of voxels are arranged through adaptive layout Light probes can save the number of light probes, without the need for GPU hardware to quickly sample millions of light probes per frame, reduce the update, transmission and storage costs of lighting information sampling in game scenes, and improve the rendering efficiency of lighting information.
上述说明仅是本申请技术方案的概述,为了能够更清楚了解本申请的技术手段,而可依照说明书的内容予以实施,并且为了让本申请的上述和其它目的、特征和优点能够更明显易懂,以下特举本申请的具体实施方式。The above description is only an overview of the technical solution of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the description, and in order to make the above-mentioned and other purposes, features and advantages of the present application more obvious and easy to understand , and the specific embodiments of the present application are listed below.
附图说明Description of drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The schematic embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the attached image:
图1示出了本申请实施例提供的一种游戏场景中光照信息的渲染方法的流程示意图;1 shows a schematic flowchart of a method for rendering lighting information in a game scene provided by an embodiment of the present application;
图2a-2c示出了本申请实施例提供的游戏场景中光照探针的创建过程示意图;2a-2c show schematic diagrams of a process of creating a light probe in a game scene provided by an embodiment of the present application;
图3示出了本申请实施例提供的另一种游戏场景中光照信息的渲染方法的流程示意图;FIG. 3 shows a schematic flowchart of another method for rendering lighting information in a game scene provided by an embodiment of the present application;
图4示出了本申请实施例提供的另一种游戏场景中光照信息的渲染方法的流程示意图;FIG. 4 shows a schematic flowchart of another method for rendering lighting information in a game scene provided by an embodiment of the present application;
图5a-5b示出了本申请实施例提供的游戏场景中光照信息的渲染过程示意图;5a-5b show schematic diagrams of a rendering process of lighting information in a game scene provided by an embodiment of the present application;
图6示出了本申请实施例提供的一种游戏场景中光照信息的渲染装置的结构示意图;FIG. 6 shows a schematic structural diagram of an apparatus for rendering lighting information in a game scene provided by an embodiment of the present application;
图7示出了本申请实施例提供的另一种游戏场景中光照信息的渲染装置的结构示意图;FIG. 7 shows a schematic structural diagram of another apparatus for rendering lighting information in a game scene provided by an embodiment of the present application;
图8示出了本申请实施例提供的另一种游戏场景中光照信息的渲染装置的结构示意图;FIG. 8 shows a schematic structural diagram of another apparatus for rendering lighting information in a game scene provided by an embodiment of the present application;
图9示出了本申请实施例提供的另一种游戏场景中光照信息的渲染装置的结构示意图;FIG. 9 shows a schematic structural diagram of another apparatus for rendering lighting information in a game scene provided by an embodiment of the present application;
图10示出了本发明实施例提供的一种计算机设备的装置结构示意图。FIG. 10 shows a schematic diagram of an apparatus structure of a computer device provided by an embodiment of the present invention.
具体实施方式Detailed ways
现在将参照若干示例性实施例来论述本发明的内容。应当理解,论述了这些实施例仅是为了使得本领域普通技术人员能够更好地理解且因此实现本发明的内容,而不是暗示对本发明的范围的任何限制。The present invention will now be discussed with reference to several exemplary embodiments. It should be understood that these embodiments are discussed only to enable those of ordinary skill in the art to better understand and thus implement the content of the present invention, and do not imply any limitation on the scope of the present invention.
如本文中所使用的,术语“包括”及其变体要被解读为意味着“包括但不限于”的开放式术语。术语“基于”要被解读为“至少部分地基于”。术语“一个实施例”和“一种实施例”要被解读为“至少一个实施例”。术语“另一个实施例”要被解读为“至少一个其他实施例”。As used herein, the term "including" and variations thereof are to be read as open-ended terms meaning "including, but not limited to." The term "based on" is to be read as "based at least in part on". The terms "one embodiment" and "one embodiment" are to be read as "at least one embodiment." The term "another embodiment" is to be read as "at least one other embodiment."
本实施例提供了一种游戏场景中光照信息的渲染方法,如图1所示,该方法应用于场景渲染工具的客户端,包括如下步骤:This embodiment provides a method for rendering lighting information in a game scene. As shown in FIG. 1 , the method is applied to a client of a scene rendering tool, and includes the following steps:
101、利用游戏场景中空间区域的数据结构对所述空间区域进行切分,提取包含有物体的空间体素。101. Use the data structure of the spatial region in the game scene to segment the spatial region, and extract the spatial voxels containing objects.
102、遍历所述多个层级的网格数据,针对所述包含有物体的空间体素设置有效光照探针,得到空间区域的第一光照探针网格。102. Traverse the grid data of the multiple levels, set an effective illumination probe for the spatial voxel containing the object, and obtain a first illumination probe grid of the spatial region.
103、针对未包含物体的空间体素补充设置虚拟光照探针,得到空间区域的第二光照探针网格。103. Supplementary setting of virtual light probes for spatial voxels that do not contain objects, to obtain a second light probe grid of the spatial region.
104、将所述第二光照探针网格所采集的光照信息传输至纹理资源信息中,并根据所述纹理资源信息对游戏场景中的光照信息进行渲染。104. Transmit the lighting information collected by the second lighting probe grid into texture resource information, and render the lighting information in the game scene according to the texture resource information.
本发明实施例提供的游戏场景中光照信息的渲染方法,通过利用游戏场景中空间区域的数据结构对空间区域进行切分,提取包含有物体的空间体素,该数据结构包含有多个层级的网格数据,每个层级包含相应层级数量的空间体素,能够利用网格数据形成空间区域内空间体素与物体的相对空间位置关系,以获取到光照变化较强的空间位置,并针对包含有物体的空间体素设置有效光照探针,得到第一光照探针网格,以使得光照变化较强的空间位置能够自适应布置光照探针,遍历多个层级的网格数据,针对未包含物体的空间体素补充设置虚拟光照探针,得到空间区域的第二光照探针网格,以使得不同层级之间空间体素在光照信息采样过程中可以有效插值过渡,针对游戏场景中光照密度分布不均匀的位置,能够提供更有效的光照信息采样结果,将第二光照探针网格所采集的光照信息传输至纹理资源信息,根据纹理资源信息对游戏场景中的光照信息进行渲染,由于光照信息为围绕物体周围所设置有效光照探针所采集,无需使用大量有效光照探针即可采集到符合条件的光照信息,简化渲染的复杂度,而虚拟光照探针能够在有效光照探针采集光照信息的过程中提供补充插值的效果,保证实时渲染的丰富表现力。The method for rendering lighting information in a game scene provided by the embodiment of the present invention divides the space area by using the data structure of the space area in the game scene, and extracts the space voxels containing objects, and the data structure includes multiple levels of Grid data, each level contains the corresponding number of spatial voxels, the grid data can be used to form the relative spatial position relationship between the spatial voxels and objects in the spatial area, so as to obtain the spatial position with strong illumination changes, and The space voxels with objects are set up with effective light probes, and the first light probe grid is obtained, so that the light probes can be adaptively arranged in the spatial positions with strong light changes, and the grid data of multiple levels is traversed. The space voxels of the object are supplemented with virtual light probes to obtain the second light probe grid in the space area, so that the space voxels between different levels can be effectively interpolated and transitioned during the lighting information sampling process, aiming at the light density in the game scene. Unevenly distributed positions can provide more effective lighting information sampling results, transmit the lighting information collected by the second lighting probe grid to the texture resource information, and render the lighting information in the game scene according to the texture resource information. Lighting information is collected by the effective light probes set around the object. It is not necessary to use a large number of effective light probes to collect qualified light information, which simplifies the complexity of rendering, and the virtual light probe can be collected in the effective light probe. In the process of lighting information, the effect of supplementary interpolation is provided to ensure the rich expressiveness of real-time rendering.
本发明实施例中空间区域的数据结构可以为空间区域所形成的树形结构,可以为四叉树、八叉树、十六叉树等,具体在对空间区域进行切分过程中,利用空间区域所形成的树形结构对空间区域进行多层级切分,形成多个层级的空间体素,并在层级空间区域切分过程中,判断切分后层级内的空间体素是否包含有物体,若是,则对切分后层级内的空间体素进行下一层级切分,直至层级数量达到预设阈值,提取包含有物体的空间体素,这里包含有物体指的是靠近物体表面的空间体素。In this embodiment of the present invention, the data structure of the space area may be a tree structure formed by the space area, and may be a quad tree, an octree, a hexadecimal tree, etc. The tree structure formed by the area divides the space area at multiple levels to form multiple levels of space voxels, and during the division of the level space area, it is judged whether the space voxels in the level after division contain objects. If yes, perform next-level segmentation on the spatial voxels in the split level until the number of levels reaches the preset threshold, and extract the spatial voxels that contain objects, where the contained objects refer to the spatial volume close to the surface of the object white.
可以理解的是,在对空间区域进行切分过程中,首先从一个大的体素作为开始,这里大的体素作为最开始进行分割的空间区域,可以基于最小空间体素的层级所设置的,例如,最小空间体素为1*1*1,空间区域的层级数量为3,空间区域为8*8*8,还可以自定义设置。然后在对大的体素进行切分之前,判断空间区域是否包含物体,如果是,则对大的体素进行切分,否则,不对大的体素进行切分,进一步针对切分后形成的两个子体素,分别判断每个子体素中是否物体,同样的,如果是,则对子体素进行切分,否则,不对子体素进行切分,每经过一次体素的切分,会形成一个层级的空间体素,这里空间体素的体素大小随着层级的增大而不断变小,例如,第一层级的空间体素,也就是最开始的大的空间体素,对应有最大体素,而最高层级的空间体素,也就是对空间区域多次切分后对应的空间体素,对应有最小体素,并且没增加一个层级,体素的大小翻倍缩小,最终每个空间区域经过分割后都会形成多个层级的网格数据,但该网格数据中层级分布式不均匀的,只有围绕物体附近的空间区域才会被切分,并且切分后的空间体素的层级分布也是不均等的,例如,针对8*8*8的空间区域,该空间区域包含物体的位置在左上角,且处于第二层级,第一次切分后形成4个的4*4*4空间体素,即为第一层级的空间体素,针对第一层级的空间体素,只有包含物体的空间体素才会被切分为第二层级的空间体素,也就是处于第一层级的其他3个空间体素并不会被切分,第二次切分后形成4个的2*2*2空间体素,同理,针对第二层级的空间体素,也是只有包含物体的空间体素才会被切分为第三层级的空间体素,如果第二层级上的4个空间体素都包含有物体,那么对4个空间体素进行切分后形成的第三层级的空间体素,即每一个第二层级的空间体素都会形成4个1*1*1空间体素。It can be understood that in the process of dividing the space area, first start with a large voxel, where the large voxel is used as the space area to be divided at the beginning, which can be set based on the level of the minimum space voxel. , for example, the minimum spatial voxel is 1*1*1, the number of levels of the spatial area is 3, and the spatial area is 8*8*8, which can also be customized. Then, before segmenting the large voxels, determine whether the space area contains objects. If so, segment the large voxels. Otherwise, do not segment the large voxels. Two sub-voxels, respectively determine whether each sub-voxel is an object. Similarly, if it is, the sub-voxels are segmented. Otherwise, the sub-voxels are not segmented. A spatial voxel of a level is formed, where the voxel size of the spatial voxel keeps getting smaller as the level increases. For example, the spatial voxel of the first level, that is, the first large spatial voxel, corresponds to The largest voxel, and the highest-level spatial voxel, that is, the corresponding spatial voxel after the spatial region is divided multiple times, corresponds to the smallest voxel, and does not increase a level, the size of the voxel is doubled and reduced, and finally each After each space area is divided, multiple levels of grid data will be formed, but the distribution of levels in the grid data is uneven, only the space area around the object will be divided, and the divided space voxels will be divided. The level distribution is also unequal. For example, for the 8*8*8 space area, the location of the space area containing the object is in the upper left corner, and it is in the second level. After the first division, 4 pieces of 4*4 are formed. *4 The space voxel is the space voxel of the first level. For the space voxel of the first level, only the space voxel containing the object will be divided into the space voxel of the second level, that is, the space voxel in the first level. The other 3 spatial voxels at the first level will not be segmented. After the second segmentation, 4 2*2*2 spatial voxels are formed. Similarly, for the second level spatial voxels, only the The space voxels of the object will be divided into the third-level space voxels. If the 4 space voxels on the second level all contain objects, then the third space formed by dividing the 4 space voxels will be formed. Hierarchical spatial voxels, that is, each second-level spatial voxel will form four 1*1*1 spatial voxels.
由于网格数据中层级分布是不均匀的,为了在游戏场景中分布不同密度的光照探针,可以遍历多个层级的网格数据,针对包含有物体的空间体素,获取空间体素在多个层级的网格数据中所处的网格位置,在网格位置的四个顶点设置有效光照探针,得到空间区域的第一光照探针网格,这里空间体素处于不同层级,可能会出现重复的顶点,例如,空间区域的四个顶点位置可能只处于第一层级,也可能在切分过程中处于第二层级或者第三层级,而针对多个层级的网格数据,获取空间体素在多个层级的网格数据中所处的网格位置,判断网格位置的四个顶点处是否设置有效光照探针,若否,则针对网格位置中未设置有效光照探针的顶点补充设置虚拟光照探针,得到空间区域的第二光照探针网格,以使得多层级的网格数据被有效光照探针和虚拟光照探针填满,这里虚拟光照探针并不会捕获光照信息,而是为了后续在利用有效光照探针进行光照信息采样过程中,使用虚拟光照探针进行无缝插值,以提高光照信息的采样结果。Due to the uneven distribution of levels in grid data, in order to distribute light probes of different densities in the game scene, it is possible to traverse the grid data of multiple levels, and for the spatial voxels containing objects, obtain the spatial voxels in the multi-level. For the grid position in the grid data of each level, set valid light probes at the four vertices of the grid position to obtain the first light probe grid of the spatial area, where the spatial voxels are at different levels, which may Duplicate vertices appear. For example, the positions of the four vertices in the spatial region may only be at the first level, or may be at the second or third level during the segmentation process. For mesh data of multiple levels, the spatial volume is obtained. The grid position where the pixel is located in the grid data of multiple levels, and it is judged whether a valid light probe is set at the four vertices of the grid position. Supplementary setting of virtual light probes to obtain the second light probe grid in the space area, so that the multi-level grid data is filled with valid light probes and virtual light probes, where virtual light probes do not capture light The purpose is to use virtual light probes for seamless interpolation in the subsequent process of using effective light probes to sample light information, so as to improve the sampling results of light information.
下面以2D四叉树作为具体应用场景进行举例,如图2a-2c所示,首先针对空间区域的切分过程,如图2a所示,将空间区域所形成的空间体素作为第一层级的空间体素,由于第一层级空间体素包含物体,接着对第一层级的空间体素进行切分,形成4个第二层级的空间体素,进一步判断每个第二层级的空间体素是否包含物体,若是,则对第二层级的空间体素进行切分,直至达到第三层级的空间体素;其次,针对空间体素内自适应设置光照探针(有效光照探针和虚拟光照探针),如图2b所示,这里以实线圆圈表示有效光照探针,由于第一层级空间体素中包含有物体,则在第一层级空间体素的四个角落摆放有效光照探针,而针对第二层级的空间体素,只有包含物体的空间体素的四个角落摆放有效光照探针,如图2c中的实线部分,只有处于实线位置的交点摆放有效光照探针,此时可能会出现与第一层级相同的位置,无需重复摆放有效光照探针,而针对不同层级上未摆放有效光照探针的空间体素,如图2c中的虚线部分,补充设置虚拟光照探针,也就是处于虚线位置的交点摆放虚拟光照探针,这里以虚线圆圈表示虚拟光照探针,最终形成包含有效光照探针和虚拟光照探针的光照探针网格。The following takes 2D quadtree as an example of a specific application scenario. As shown in Figures 2a-2c, first of all, for the segmentation process of the spatial region, as shown in Figure 2a, the spatial voxels formed by the spatial region are used as the first level Spatial voxels, since the first-level spatial voxels contain objects, then the first-level spatial voxels are segmented to form 4 second-level spatial voxels, and it is further determined whether each second-level spatial voxel is Contains objects, if so, segment the second-level space voxels until reaching the third-level space voxels; secondly, adaptively set light probes (effective light probes and virtual light probes) for the space voxels needle), as shown in Figure 2b, where the solid line circles represent the effective light probes. Since the first-level space voxels contain objects, the effective light probes are placed at the four corners of the first-level space voxels. , and for the space voxel of the second level, only the four corners of the space voxel containing the object are placed with valid light probes, as shown in the solid line part in Figure 2c, only the intersections at the solid line position are placed with valid light probes. At this time, the same position as the first level may appear, and there is no need to repeatedly place valid light probes, but for the spatial voxels where no valid light probes are placed on different levels, as shown in the dotted line in Figure 2c, Supplement Set the virtual light probe, that is, place the virtual light probe at the intersection of the dotted line. Here, the virtual light probe is represented by a dotted circle, and finally a light probe grid containing effective light probes and virtual light probes is formed.
进一步地,由于光照信息的采集过程受到光照探针网格中光照探位置的影响,不同空间位置的光照信息相互之间也会受到影响,需要在对光照信息进行渲染之前,抽取第二光照探针网格中光照信息所映射的空间逻辑关系,并将空间逻辑关系存储至纹理资源信息中,进而后续在对光照信息进行渲染的过程中,按照空间逻辑关系将纹理资源信息中光照信息展开到三维分块数据集中,并利用间接纹理记录三维分块数据集之间层级关系,进一步利用间接纹理中三维分块数据集之间层级关系合并三维分块数据集,形成树形结构的三维分块纹理信息,该三维分块纹理信息中记录有光照信息在游戏场景中的空间位置,根据视点位置在游戏场景中的空间位置,该视点位置相当于视频设备视角所对应的空间位置,并以该空间位置作为光照采集位置,从树形结构的三维分块纹理信息中读取相应空间位置的光照信息进行渲染,通过预先存储光照信息的空间逻辑关系,无需耗费大量资源去存储和传输探针数据,节省存储和传输开销的同时,保证了渲染精度。Further, since the collection process of illumination information is affected by the position of the illumination probe in the illumination probe grid, the illumination information of different spatial positions will also be affected by each other, so it is necessary to extract the second illumination probe before rendering the illumination information. According to the spatial logical relationship mapped by the lighting information in the grid, the spatial logical relationship is stored in the texture resource information, and then in the process of rendering the lighting information, the lighting information in the texture resource information is expanded to the following according to the spatial logical relationship. In the 3D block data set, the indirect texture is used to record the hierarchical relationship between the 3D block data sets, and the hierarchical relationship between the 3D block data sets in the indirect texture is further used to merge the 3D block data sets to form a tree-structured 3D block. Texture information, the three-dimensional block texture information records the spatial position of the lighting information in the game scene. According to the spatial position of the viewpoint position in the game scene, the viewpoint position is equivalent to the spatial position corresponding to the viewing angle of the video device, and is based on the spatial position of the viewpoint position in the game scene. The spatial position is used as the lighting collection position, and the lighting information of the corresponding spatial position is read from the three-dimensional block texture information of the tree structure for rendering. , while saving storage and transmission overhead, while ensuring rendering accuracy.
进一步地,考虑到第二光照探针网格中有效光照探针和虚拟光照探针的分布情况,在按照空间逻辑关系将纹理资源信息中光照信息展开到三维分块数据集中,并利用间接纹理记录每三维分块数据集之间层级关系的过程中,首先根据空间逻辑关系,提取第二光照探针网格中有效光照探针和虚拟光照探针的层级分布,然后按照第二光照探针网格中有效光照探针和虚拟光照探针的层级分布,将纹理资源信息中光照信息展开到三维分块数据中,并利用间接纹理记录三维分块数据集之间层级关系。由于间接纹理并不是直接的纹理信息,在传输纹理资源信息的过程可以无需传输大量纹理信息,以提高后续渲染过程中光照信息的传输效率和采样效率。Further, considering the distribution of effective light probes and virtual light probes in the second light probe grid, the light information in the texture resource information is expanded into the three-dimensional block data set according to the spatial logical relationship, and the indirect texture is used. In the process of recording the hierarchical relationship between each 3D block data set, first, according to the spatial logical relationship, the hierarchical distribution of the effective light probes and virtual light probes in the second light probe grid is extracted, and then the second light probe The hierarchical distribution of the effective light probes and virtual light probes in the grid, expand the light information in the texture resource information into the 3D block data, and use the indirect texture to record the hierarchical relationship between the 3D block data sets. Since indirect textures are not direct texture information, there is no need to transmit a large amount of texture information in the process of transmitting texture resource information, so as to improve the transmission efficiency and sampling efficiency of lighting information in the subsequent rendering process.
进一步地,为了准确获取到游戏世界中实际光照信息,在根据视点位置在游戏场景中的空间位置,从树形结构的三维分块纹理信息中读取相应空间位置的光照信息进行渲染的过程中,首先根据视点位置在游戏场景中的空间位置,从树形结构的三维分块纹理信息中获取表征三维分块数据集之间层级关系的间接纹理,然后利用表征三维分块数据集之间层级关系的间接纹理,读取树形结构的三维分块纹理信息中相应空间位置的光照信息进行渲染。由于间接纹理存储有三维分块数据在树形结构中的层级和偏移量,可根据屏幕像素的世界空间位置采样间接纹理中相应层级和偏移量去获取有效光照探针采集到的光照信息。Further, in order to accurately obtain the actual lighting information in the game world, according to the spatial position of the viewpoint position in the game scene, the lighting information of the corresponding spatial position is read from the three-dimensional block texture information of the tree structure for rendering. , first, according to the spatial position of the viewpoint position in the game scene, the indirect texture representing the hierarchical relationship between the three-dimensional block data sets is obtained from the three-dimensional block texture information of the tree structure, and then the indirect texture representing the hierarchical relationship between the three-dimensional block data sets is used to represent the hierarchical relationship between the three-dimensional block data sets. The indirect texture of the relationship reads the lighting information of the corresponding spatial position in the three-dimensional block texture information of the tree structure for rendering. Since the indirect texture stores the level and offset of the 3D block data in the tree structure, the corresponding level and offset in the indirect texture can be sampled according to the world space position of the screen pixels to obtain the lighting information collected by the effective light probe. .
本实施例提供了另一种游戏场景中光照信息的渲染方法,如图3所示,该方法应用于场景渲染工具的客户端,包括如下步骤:This embodiment provides another method for rendering lighting information in a game scene. As shown in FIG. 3 , the method is applied to the client of the scene rendering tool, and includes the following steps:
201、获取游戏场景中空间体素包含的近距离体素。201. Acquire the close-range voxels contained in the space voxels in the game scene.
游戏是实时的、动态的、互动的计算机模拟,很多三维游戏使用三维三角网格表述物体表面,这种表述物体表面的细节层被存储在纹理中,在进行着色的时候,需要首先考虑到光线与之相交的物体,然后选择该物体表面对应的细节层次的多级纹理进行着色计算,空间体素作为游戏空间中纹理渲染的体积单元,包含空间体素的对象可通过立体渲染或者提取给定阈值轮廓的多边形等值面表现出来。Games are real-time, dynamic, and interactive computer simulations. Many 3D games use 3D triangular meshes to represent the surface of objects. The detail layer that represents the surface of objects is stored in textures. When shading, light needs to be considered first. The object intersected with it, and then select the multi-level texture of the level of detail corresponding to the surface of the object for shading calculation. The spatial voxel is used as the volume unit of texture rendering in the game space. The object containing the spatial voxel can be rendered by stereo rendering or extraction. The polygonal isosurface of the thresholded contour is represented.
针对游戏场景涉及的光照效果,通常使用全局光照进行渲染,全局光照考虑了光线的直射与尽可能多的漫反射效果,最终呈现出来的光影效果更接近于现实世界。具体全局光照指的是对游戏场景周围光线反射的计算,负责制作出实现环境中的许多细微着色特效、气氛以及有光泽的金属反射效果。现有全局光照方式中,所有间接光照是预先计算的,存储于有光线贴图的纹理信息中,光线贴图让游戏场景能够具备类似全局光照的效果,由于预先计算的,所以只在静态物体上有效。而针对非静态物体的全局光照,使用光照探针可以模拟使用光照贴图的效果,该光照探针可以对照亮在3D空间中的某一个指定点的光照信息在运行前的预计算阶段进行采样,然后将采集到的信息通过球谐函数进行编译打包存。在游戏运行时,通过着色器程序可以把这些光照信息编码快速地重建出光照效果。与光照贴图类似,光照探针存储了场景中的光照信息,而不用的是光照贴图存储的是灯光照射到物体表面的光照信息,而光照探针存储的是灯光穿过真空区域时的光照信息。For the lighting effects involved in the game scene, global illumination is usually used for rendering. The global illumination considers the direct illumination of the light and as many diffuse reflection effects as possible, and the final light and shadow effect is closer to the real world. Specific global illumination refers to the calculation of light reflections around the game scene, responsible for creating many subtle shading effects, atmospheres, and shiny metal reflections in the environment. In the existing global illumination method, all indirect lighting is pre-calculated and stored in the texture information with light maps. The light map enables the game scene to have a similar effect to global illumination. Because of the pre-calculation, it is only valid on static objects. . For the global illumination of non-static objects, the use of light probes can simulate the effect of using lightmaps. The light probes can sample the lighting information that illuminates a specified point in the 3D space in the pre-calculation stage before running. , and then compile and pack the collected information through spherical harmonics. When the game is running, the shader program can encode the lighting information to quickly reconstruct the lighting effect. Similar to lightmaps, light probes store the lighting information in the scene, instead of the lightmaps that store the lighting information of the light hitting the surface of the object, the light probes store the lighting information when the light passes through the vacuum area. .
其中,游戏场景中空间体素相当于游戏世界中的立体空间单位,近距离体素为游戏场景中空间体素分割所形成预设层级的体素中符合距离条件的体素,相当于靠近物体表面的体素,该距离条件作为判定靠近物体表面体素的依据,可以为体素的包围盒与游戏场景中物体包围盒相交,通过在空间体素在分割过程中会形成,会根据距离条件对待分割像素以及已分割像素进行判断,若体素的包围盒与游戏场景中物体包围盒相交,则说明该体素靠近物体表面,即为近距离体素。Among them, the space voxels in the game scene are equivalent to the three-dimensional space units in the game world, and the close-range voxels are the voxels that meet the distance conditions among the voxels of the preset level formed by the division of space voxels in the game scene, which are equivalent to close objects. The voxels of the surface, the distance condition is used as the basis for judging the voxels close to the surface of the object, which can be the intersection of the bounding box of the voxel and the bounding box of the object in the game scene. The pixels to be divided and the pixels that have been divided are judged. If the bounding box of the voxel intersects the bounding box of the object in the game scene, it means that the voxel is close to the surface of the object, that is, it is a close-range voxel.
本申请实施例中,对于游戏世界中光照探针的摆放,通常是人工手动摆放,并根据实际光照信息的渲染结果进行摆放位置的调整,时间和空间浪费非常严重,并且探针不能沿着物体表面进行有效覆盖,通过获取游戏场景中空间体素包含的近距离体素,可以从游戏世界中定位到物体表面的区域,并针对物体表面的区域自适应布置光照探针,以采集到游戏场景中更具有环境影响力的光照信息,提高光照信息的采样效率。In the embodiment of the present application, the placement of the light probes in the game world is usually done manually, and the placement position is adjusted according to the rendering result of the actual light information. The waste of time and space is very serious, and the probes cannot be Effective coverage along the surface of the object, by obtaining the close-range voxels contained in the spatial voxels in the game scene, you can locate the area on the surface of the object from the game world, and adaptively arrange light probes for the area on the surface of the object to collect To the lighting information with more environmental influence in the game scene, improve the sampling efficiency of lighting information.
对于本实施例的执行主体可以为游戏场景中光照信息的渲染装置或设备,可以配置在场景渲染工具的客户端,游戏场景在布置好后,需要布置光照探针在游戏场景中的位置信息,由于光照探针不能直接挂载到游戏对象上,通常需要依赖游戏场景中指定的空间区域,当向游戏场景中添加光照探针时,可针对指定的空间区域,获取游戏场景中空间像素包含的近距离体素,该近距离体素在游戏场景中的位置作为放置光照探针的优选位置,能够采集到更符合游戏场景需求的光照信息,提高光照渲染效果。The execution subject of this embodiment may be a rendering device or device for lighting information in the game scene, and may be configured on the client side of the scene rendering tool. After the game scene is arranged, the position information of the lighting probe in the game scene needs to be arranged. Since the light probe cannot be directly mounted on the game object, it usually needs to rely on the specified spatial area in the game scene. When adding a light probe to the game scene, you can obtain the spatial pixels contained in the game scene for the specified spatial area. The close-range voxel, the position of the close-range voxel in the game scene is used as the preferred position for placing the light probe, which can collect lighting information more in line with the requirements of the game scene and improve the lighting rendering effect.
202、为所述空间体素包含的近距离体素创建有效光照探针和虚拟光照探针,生成空间体素的探针网格。202. Create an effective illumination probe and a virtual illumination probe for the close-range voxels included in the spatial voxels, and generate a probe grid of the spatial voxels.
其中,有效光照探针为在游戏世界中具有真实位置的采样点所布置的光照收集器,能够在采样点从各个方向捕捉光线,并将捕捉到光线的颜色信息编码为一组可在游戏运行过程中快速评估的系数,由于空间像素包含预设层级的近距离体素,为了保证不同层级间所布置有效光照探针采样光照信息的插值效果,虚拟光照探针为辅助有效光照探针后续在GPU采样时可以有效插值过渡而形成增设的光照收集器,能够为游戏场景中更大层级体素和更小层级体素之间采样时提供无缝插值。Among them, the effective light probe is a light collector arranged at a sampling point with a real position in the game world, which can capture light from all directions at the sampling point, and encode the color information of the captured light into a set of lights that can be run in the game. The coefficients that are quickly evaluated in the process. Since the spatial pixels contain close-range voxels at the preset level, in order to ensure the interpolation effect of the sampling illumination information of the effective light probes arranged between different levels, the virtual light probe is an auxiliary effective light probe. GPU sampling can effectively interpolate transitions to form additional light collectors, which can provide seamless interpolation when sampling between larger voxels and smaller voxels in the game scene.
在本申请实例中,空间体素的探针网格相当于树形结构的网格,该树形结构即为空间体素分割所形成预设层级,例如,八叉树结构对应预设层级为3,即空间体素被分割为8个体素,将每个体素的边角形成2*2*2个探针网格,为了在游戏世界中分布不同密度的光照探针,以及自适应最小化创建总数,当分割空间体素过程中,会记录近距离体素,近距离体素具有更优的光照信息采样效果,进一步针对近距离体素上创建有效光照探针。In the example of this application, the probe grid of spatial voxels is equivalent to a grid of tree structure, and the tree structure is the preset level formed by the division of spatial voxels. For example, the corresponding preset level of the octree structure is: 3, that is, the space voxels are divided into 8 voxels, and the corners of each voxel are formed into 2*2*2 probe grids, in order to distribute light probes of different densities in the game world, and adaptive minimization Create the total number. During the process of dividing space voxels, close-range voxels will be recorded. Close-range voxels have better lighting information sampling effect, and further create effective light probes for close-range voxels.
可以理解的是,有效光照探针虽然可以提供具有插值效果的光照信息,但仍需要千兆字节以上的资源占用,为了能够胜任各种规模、类型的游戏场景,以及降低资源占用,通过在空间像素不同层级间增设虚拟光照探针,该虚拟光照探针能够关联各个层级内有效光照探针,并根据有效光照探针在游戏世界中不同空间像素采样不同密度的采样插值结果,以减少光照信息采集过程的资源开销。It is understandable that although an effective light probe can provide light information with interpolation effect, it still requires more than gigabytes of resources. Virtual light probes are added between different levels of spatial pixels. The virtual light probes can be associated with effective light probes in each level, and sample interpolation results of different densities in different spatial pixels in the game world according to the effective light probes to reduce lighting. The resource overhead of the information collection process.
203、根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中。203. Combine and store the lighting information captured by the probe grid of the spatial voxel into texture resource information according to the viewpoint position in the game scene.
其中,游戏场景中的视点位置为游戏场景中设置光照信息的任一采样位置,针对视点位置,有效光照探针会不断采集游戏场景中变化的光照数据,然后在对光照数据进行插值过程中,利用虚拟光照探针对有效光照探针采集的光照数据提供不同密度的采样插值结果,以形成探针网格捕获的光照信息合并存储至纹理资源信息中。Among them, the viewpoint position in the game scene is any sampling position where the lighting information is set in the game scene. For the viewpoint position, the effective light probe will continuously collect the lighting data that changes in the game scene, and then in the process of interpolating the lighting data, The virtual light probe is used to provide sampling interpolation results of different densities for the light data collected by the effective light probe, so as to form the light information captured by the probe grid and store it in the texture resource information.
可以理解的是,空间体素的探针网格所捕获的光照信息包括预先计算的光照数据,许多预算开销尽在编辑时产生,不会出现在运行时,光照探针会存储穿过场景空间的光照数据,并将其整合到纹理资源信息中,该纹理资源信息相当于动态物体的光照贴图,同样包含场景内投射到物体表面的直接光源,以及不同物体间反射的间接光源,可透过物体材质上的着色器描述物体的表面信息和凹凸信息。Understandably, the lighting information captured by the spatial voxel probe grid includes pre-computed lighting data. Much of the budget overhead is generated at edit time, not at runtime. Light probes are stored across the scene space. The lighting data is integrated into the texture resource information. The texture resource information is equivalent to the light map of the dynamic object. It also includes the direct light source projected on the surface of the object in the scene, and the indirect light source reflected between different objects. The shader on the object material describes the surface information and bump information of the object.
204、响应于光照信息的渲染指令,利用所述纹理资源信息建立渲染任务,对所述游戏场景中光照信息进行渲染。204. In response to the rendering instruction of the lighting information, create a rendering task by using the texture resource information, and render the lighting information in the game scene.
由于纹理资源信息可用准确当前游戏场景中的光照信息,进一步利用纹理资源信息建立渲染任务,对游戏场景中光照信息进行渲染。可以理解的是,以同样的方式,游戏场景中每个场景数据帧都会建立渲染任务,并由场景渲染工具将游戏场景中的场景空间一次提交到渲染队列中,每个可渲染的场景空间,除了自身的网格、材质外,还有包围盒以及其在游戏场景中的矩阵等。Since the texture resource information can be used with accurate lighting information in the current game scene, a rendering task is further established by using the texture resource information, and the lighting information in the game scene is rendered. It can be understood that, in the same way, each scene data frame in the game scene will create a rendering task, and the scene rendering tool will submit the scene space in the game scene to the rendering queue at one time, and each renderable scene space, In addition to its own meshes and materials, there are also bounding boxes and their matrices in the game scene.
本申请实施例提供的游戏场景中光照信息的渲染方法,与现有方式使用逐物体采样光照信息的方式相比,本申请通过使用逐像素采样光照信息的方式,一方面能够为大量及复杂物体提供间接光照,适用多种光照采集场景,另一方面避免了3D纹理从CPU端至GPU端的更新成本、传输带宽所限制逐个物体采样的物体总数。与现有方式使用逐像素采样光照信息的方式相比,本申请通过获取游戏场景中空间体素包含的近距离体素,该近距离体素为靠近物体表面的体素,需要更多数量的光照探针,进一步为空间体素包含的近距离体素创建有效光照探针和虚拟光照探针,生成空间体素的探针网格,能够自适应布局光照探针和虚拟光照探针,该虚拟光照探针作为辅助有效光照探针,为游戏场景提供无缝插值,并根据游戏场景中视点位置将空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中,该纹理资源信息能够应对不同游戏场景的光照信息采样,以使得同屏像素根据其在不同的空间位置采样到不同面密度的插值结果,进而在响应于光照信息的渲染指令时,利用纹理资源信息建立渲染任务,对游戏场景中光照信息进行渲染,该纹理资源信息中缓存了游戏场景的三维纹理地址,由于游戏场景中像素纹理的数量决定了光照探针的数量,而大量的体素通过自适应布局光照探针,能够节省光照探针数量,无需GPU硬件快速采样每帧数百万个光照探针,降低游戏场景中光照信息采样的更新、传输和存储成本,提高光照信息的渲染效率。The method for rendering lighting information in a game scene provided by the embodiment of the present application, compared with the existing method of sampling lighting information by object, the present application uses the method of sampling lighting information by pixel, on the one hand, it can provide a large number of complex objects. Provides indirect lighting and is suitable for a variety of lighting collection scenarios. On the other hand, it avoids the update cost of 3D textures from the CPU side to the GPU side, and the total number of objects sampled one by one limited by the transmission bandwidth. Compared with the existing method of using pixel-by-pixel sampling illumination information, the present application obtains the close-range voxels contained in the spatial voxels in the game scene, and the close-range voxels are voxels close to the surface of the object, which requires a larger number of Light probes, further create effective light probes and virtual light probes for close-range voxels contained in space voxels, generate probe grids for space voxels, and can adaptively layout light probes and virtual light probes. As an auxiliary effective light probe, the virtual light probe provides seamless interpolation for the game scene, and combines and stores the light information captured by the probe grid of the spatial voxel into the texture resource information according to the viewpoint position in the game scene. The resource information can deal with the lighting information sampling of different game scenes, so that the pixels on the same screen can sample interpolation results of different surface densities according to their different spatial positions, and then use the texture resource information to create rendering in response to the rendering instructions of the lighting information. The task is to render the lighting information in the game scene. The texture resource information caches the 3D texture address of the game scene. Since the number of pixel textures in the game scene determines the number of light probes, and a large number of voxels are arranged through adaptive layout Light probes can save the number of light probes, without the need for GPU hardware to quickly sample millions of light probes per frame, reduce the update, transmission and storage costs of lighting information sampling in game scenes, and improve the rendering efficiency of lighting information.
进一步的,作为上述实施例具体实施方式的细化和扩展,为了完整说明本实施例的具体实施过程,本实施例提供了另一种游戏场景中光照信息的渲染方法,如图4所示,该方法包括:Further, as a refinement and extension of the specific implementation of the above-mentioned embodiment, in order to fully describe the specific implementation process of this embodiment, this embodiment provides another method for rendering lighting information in a game scene, as shown in FIG. 4 , The method includes:
301、获取游戏场景中待挂接物体覆盖的空间区域,将所述空间区域内的每个空间体素分割为预设层级的体素。301. Acquire a spatial area covered by an object to be attached in a game scene, and divide each spatial voxel in the spatial area into voxels of a preset level.
游戏场景由物体组成,有些物体是固态的,例如,一块砖头,有些物体无固定形状,例如,一缕烟,但所有物体都占据三维空间的体积,物体可以是不透明的,即光不能通过该物体,也可以是透明的,即光能通过该物体。在渲染不透明物体时,只需要考虑其表面,无需知道物体内部是怎样的,当渲染透明或者半透明物体时,便需要考虑光线通过物体时所造成的反射、折射、散射、吸收等行为,需要结合物体内部结构及属性知识。A game scene consists of objects, some objects are solid, for example, a brick, some objects have no fixed shape, for example, a puff of smoke, but all objects occupy a volume in three-dimensional space, objects can be opaque, that is, light cannot pass through the Objects can also be transparent, i.e. light can pass through the object. When rendering an opaque object, you only need to consider its surface, without knowing what the inside of the object is like. When rendering a transparent or translucent object, you need to consider the reflection, refraction, scattering, absorption and other behaviors caused by light passing through the object. Combine the knowledge of the internal structure and properties of objects.
游戏场景中光线可以控制角色的活动,影响玩家心情,也可以影响感知各种事件的方式,游戏引擎作为游戏开发的工具,可以在制作游戏当中就实时观察到的各种效果,包括强度、颜色、阴影等都可以在制作成中灵活调整。通常情况下,针对游戏场景中的静态物体,可以使用全局光照来烘焙光照贴图,当烘焙一张光照贴图时,游戏场景内物体会基于光的影响算出一张贴图结果,并迭在游戏场景中物体上建立照明效果,该光照贴图可以包含场景内投射到物体表面的直接光源,以及不同物体间反射的间接光源,可透过物体材质上的着色器描述物体的表面信息和凹凸信息。虽然静态物体的光照贴图无法在游戏执行时改变游戏场景光照条件,但预先计算的实时全局光照系统能实时运算复杂的场景光源互动,通过预计算全局光照,能够建立游戏环境带有丰富的全局光照反射,并实时反映光源的改变。而针对游戏场景中的动态物体,可以在指定区域设置光照探针的采样点,来收集指定区域的明暗信息,该指定区域可以为游戏场景中待挂接物体覆盖的空间区域,由于游戏场景中光照变化小的地方所产生的光照信息较少,布置过多光照探针会产生浪费,优选位置是在光照变化、阴影处和光照过渡区域设置密集的光照探针。这里可以针对待挂接区域覆盖的空间区域来选取相应的优选位置,并将空间区域内的每个空间体素分割为预设层级的体素,这里预设层级为树形结构的限制深度,具体可根据实际应用场景来设置,层级数量越高,所需光照探针数量越多。Light in the game scene can control the activities of the characters, affect the mood of the players, and also affect the way of perceiving various events. The game engine, as a tool for game development, can observe various effects in real time during the production of games, including intensity, color, etc. , shadows, etc. can be flexibly adjusted in the production. Under normal circumstances, for static objects in the game scene, global illumination can be used to bake lightmaps. When baking a lightmap, the objects in the game scene will calculate a map result based on the influence of light, and stack them in the game scene. The lighting effect is established on the object. The light map can include the direct light source projected to the surface of the object in the scene, and the indirect light source reflected between different objects. The surface information and bump information of the object can be described through the shader on the object material. Although the lightmaps of static objects cannot change the lighting conditions of the game scene during the execution of the game, the pre-computed real-time global illumination system can calculate complex scene light source interactions in real time. Reflection, and reflect changes in the light source in real time. For dynamic objects in the game scene, the sampling points of the light probe can be set in the designated area to collect the light and shade information of the designated area. The designated area can be the space area covered by the object to be attached in the game scene. Places with small illumination changes generate less illumination information, and placing too many illumination probes will be wasteful. The preferred location is to set up dense illumination probes in illumination changes, shadows, and illumination transition areas. Here, a corresponding preferred position can be selected for the space area covered by the area to be attached, and each space voxel in the space area is divided into voxels of a preset level, where the preset level is the limit depth of the tree structure, It can be set according to the actual application scenario. The higher the number of layers, the more light probes are required.
302、遍历预设层级内的每个体素,判断分割后体素的包围盒与游戏场景中物体包围盒相交。302. Traverse each voxel in the preset level, and determine that the bounding box of the divided voxel intersects the bounding box of the object in the game scene.
可以理解的是,为了在靠近物体表面的空间像素布置更多的光照探针,而空旷的空间像素布置少量光照探针,针对预设层级内的每个体素,对其进行距离条件判定,这里分割后体素的包围盒相当于包围分割后体素且平行于坐标轴的最小六面体,游戏场景中物体包围盒相当于包围物体且平行于坐标轴的最小六面体,包围盒构造简单,存储空间小,不适合包含软体变形的复杂虚拟环境,通过判断分割后体素的包围盒与游戏场景中物体的包围盒是否相交,可以空间体素内是否有物体,对应没有物体的空间体素无需对其进行分割,也无需布置光照探针。It can be understood that, in order to arrange more light probes in the spatial pixels close to the surface of the object, and arrange a small number of light probes in the empty space pixels, the distance condition is determined for each voxel in the preset level, here The bounding box of the divided voxel is equivalent to the smallest hexahedron that surrounds the divided voxel and is parallel to the coordinate axis. In the game scene, the bounding box of the object is equivalent to the smallest hexahedron that surrounds the object and is parallel to the coordinate axis. The structure of the bounding box is simple and the storage space is small. , it is not suitable for complex virtual environments including soft body deformation. By judging whether the bounding box of the segmented voxel intersects the bounding box of the object in the game scene, it can be determined whether there is an object in the space voxel, and the corresponding space voxel without objects does not need to be Segmentation is performed without having to place light probes.
303、若是,则确定所述分割后体素为游戏场景中物体表面的近距离体素。303. If yes, determine that the segmented voxel is a close-range voxel of the surface of the object in the game scene.
上述判定过程可以在对空间体素进行分割前以及分割后执行,并对符合判定条件的体素进行重复分割,若不符合判定条件的体素则不进行分割,首先,针对一个大的体素开始,作为待分割的原始空间体素,接着对其进行均匀分割,分割原则就是如果靠近物体表面,则对其进行细分,对每一个子体素进行重复分割,直至到达指定最小体素大小,也就是预设层级,该过程会产生预设层级的树形结构。The above determination process can be performed before and after the segmentation of the spatial voxels, and the voxels that meet the determination conditions are repeatedly segmented. If the voxels that do not meet the determination conditions are not segmented, first, for a large voxel Start, as the original space voxel to be divided, and then divide it evenly. The division principle is that if it is close to the surface of the object, it is subdivided, and each sub-voxel is repeatedly divided until it reaches the specified minimum voxel size. , that is, the preset level, this process will generate a tree structure of the preset level.
304、为所述空间体素包含的近距离体素创建有效光照探针和虚拟光照探针,生成空间体素的探针网格。304. Create an effective illumination probe and a virtual illumination probe for the close-range voxels included in the spatial voxels, and generate a probe grid of the spatial voxels.
在本申请实施例中,有效光照探针作为游戏场景中布置的光照探针,通常会接近物体表面,以获取物体表面的光照明暗情况,具体可以针对空间体素中处于层级内的近距离体素,创建有效光照探针,为空间体素增设层级对应的虚拟体素,针对虚拟体素中符合添加条件的体素创建虚拟光照探针,该虚拟光照探针用于对空间体素中处于层级内近距离体素所采样的光照数据进行无缝插值。In the embodiment of the present application, the effective light probe, as the light probe arranged in the game scene, is usually close to the surface of the object to obtain the light and dark conditions on the surface of the object. voxels, create valid light probes, add virtual voxels corresponding to the level for space voxels, and create virtual light probes for voxels that meet the addition conditions in the virtual voxels. Lighting data sampled by close-range voxels within the hierarchy is seamlessly interpolated.
具体在为空间体素增设层级对应的虚拟体素,针对虚拟体素中符合添加条件的体素创建虚拟光照探针过程中,可以针对空间体素中大于一阶的层级,增设层级对应的虚拟体素,该虚拟体素与空间体素中对应层级的体素相映射,进一步遍历层级对应的虚拟体素,判断空间体素中相映射体素是否存在有效光照探针,若否,则针对虚拟体素创建虚拟光照探针。这里可以针对不同层级的体素以不同颜色显示,并针对不同层级增设虚拟体素和虚拟光照探针,针对创建有效光照探针的近距离体素周围不存在有效光光照探针的地方,补充创建虚拟光照探针。Specifically, in the process of adding virtual voxels corresponding to levels for spatial voxels, and creating virtual light probes for voxels that meet the addition conditions in the virtual voxels, you can add virtual voxels corresponding to the levels for levels greater than one level in the spatial voxels. Voxel, the virtual voxel is mapped with the voxel of the corresponding level in the space voxel, and further traverses the virtual voxel corresponding to the level to determine whether there is an effective light probe in the mapped voxel in the space voxel, if not, for Virtual voxels create virtual light probes. Here, voxels at different levels can be displayed in different colors, and virtual voxels and virtual light probes can be added for different levels. For places where there is no effective light probe around the close-range voxels that create effective light probes, add Create virtual light probes.
305、根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息展开到三维分块数据集,形成多层级树形结构的三维分块纹理信息。305. Expand the illumination information captured by the probe grid of the spatial voxel into a three-dimensional block data set according to the viewpoint position in the game scene, to form three-dimensional block texture information of a multi-level tree structure.
在本申请实施例中,具体可以利用探针网格中有效光照探针采样游戏场景中的光照数据,并对光照数据进行插值运算,得到游戏场景中视点位置的第一光照信息,利用探针网格中虚拟光照探针对空间体素中处于层级内近距离体素所采样的光照数据进行无缝插值,得到游戏场景中视点位置的第二光照信息,进一步将游戏场景中视点位置的第一光照信息和第二光照信息展开到三维分块数据集,形成多层级树形结构的三维分块纹理信息。In the embodiment of the present application, the effective illumination probe in the probe grid can be used to sample illumination data in the game scene, and the illumination data can be interpolated to obtain the first illumination information of the viewpoint position in the game scene. The virtual light probe in the grid seamlessly interpolates the lighting data sampled by the close-range voxels in the spatial voxels, and obtains the second lighting information of the viewpoint position in the game scene, and further converts the first position of the viewpoint position in the game scene. The first illumination information and the second illumination information are expanded into a three-dimensional block data set to form three-dimensional block texture information of a multi-level tree structure.
应说明的是,树形结构的三维纹理信息结合有效光照探针和虚拟光照探针所捕获的光照信息,并能够能够向GPU传输光照信息以形成文理资源信息。It should be noted that the three-dimensional texture information of the tree structure is combined with the lighting information captured by the effective lighting probe and the virtual lighting probe, and can transmit the lighting information to the GPU to form the textual resource information.
306、在展开到三维分块数据集的过程中,将所述三维分块数据集映射的层级关系记录至间接纹理信息中。306. In the process of expanding to the three-dimensional block data set, record the hierarchical relationship mapped by the three-dimensional block data set into indirect texture information.
应说明的是,为了完成三维分块数据集的存储,还需要利用树形结构来构建一个包含逐层级展开表示的间接纹理信息,运行时对间接纹理信息进行采样,获取的内容即为三维分块数据在树形结构中的层级关系,由此计算出三维分块数据中缓存光照探针的采样位置。It should be noted that, in order to complete the storage of the 3D block data set, it is also necessary to use a tree structure to construct an indirect texture information including a hierarchically expanded representation, and the indirect texture information is sampled at runtime, and the acquired content is the 3D data. The hierarchical relationship of the block data in the tree structure is used to calculate the sampling position of the cache light probe in the 3D block data.
307、将所述三维分块纹理信息与所述间接纹理信息合并存储至纹理资源信息中。307. Combine the three-dimensional block texture information and the indirect texture information and store them into texture resource information.
可以理解的是,该纹理资源信息存储有游戏场景中每个空间体素中的光照信息,然后通过烘焙到最近光照探针所捕获的光照信息之间进行插值,位于空间体素内任何位置所处的光照信息将在估算后投射到移动对象上。It can be understood that the texture resource information stores the lighting information in each spatial voxel in the game scene, and then interpolates between the lighting information captured by the nearest lighting probe, located at any position in the spatial voxel. Lighting information at will be projected onto moving objects after estimation.
308、响应于光照信息的渲染指令,利用所述纹理资源信息建立渲染任务,对所述游戏场景中光照信息进行渲染。308. In response to the rendering instruction of the lighting information, create a rendering task by using the texture resource information, and render the lighting information in the game scene.
在本申请实例中,具体可以利用纹理资源信息建立渲染任务,从间接纹理信息中获取三维分块纹理信息映射的层级关系,然后根据三维分块纹理信息映射的层级关系,查询三维纹理信息在树形结构中的位置信息,最后按照三维纹理信息在树形结构中的位置位置从三维分块纹理信息中采样空间体素的探针网格所捕获的光照信息,对光照信息进行渲染。In the example of this application, it is possible to use texture resource information to create a rendering task, obtain the hierarchical relationship of the three-dimensional block texture information mapping from the indirect texture information, and then query the three-dimensional texture information in the tree according to the hierarchical relationship of the three-dimensional block texture information mapping. Finally, according to the position of the three-dimensional texture information in the tree structure, the lighting information captured by the probe grid of the spatial voxel is sampled from the three-dimensional block texture information, and the lighting information is rendered.
具体在根据三维分块纹理信息映射的层级关系,查询三维纹理信息在树形结构中的位置信息的过程中,可以根据三维分块纹理信息映射的层级关系,提取三维分块纹理信息在树形结构中所处层级和偏移量,并根据三维分块纹理信息在树形结构中所处层级和偏移量,计算三维纹理信息在树形结构中的位置信息。Specifically, in the process of querying the position information of the three-dimensional texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping, the three-dimensional block texture information in the tree structure can be extracted according to the hierarchical relationship of the three-dimensional block texture information mapping. The level and offset in the structure, and the location information of the three-dimensional texture information in the tree structure is calculated according to the level and offset of the three-dimensional block texture information in the tree structure.
下面以2D四叉树作为具体应用场景进行举例,首先在游戏场景中空间体素内自适应创建有效光照探针,接着在每个体素角落摆放一个有效光照探针,具体可以将每个空间体素分割为4个体素,进一步针对每个体素重复分割,将空间体素形成八叉树结构,形成2*2*2的探针网格,记录接近物体表面的体素,并在这些体素节点上放置有效光照探针,然后在游戏场景中空间体素对应的层级增设虚拟体素和虚拟光照探针,该虚拟体素和虚拟光照探针能够在更大层级和更小层级体素之间采样时实现光照信息的无缝插值,进一步将有效光照探针和虚拟光照探针所捕获的光照信息合并存储至纹理资源信息,该纹理资源信息在渲染过程中可以逐层级展开,每一层级的纹理资源信息中每个三维分块数据都有单独编号,通常每一层级的三维分块数据都以合并了有效光照探针和虚拟光照探针所捕获的光照信息,对于未合并存储的三维分块数据,可以继续合并处理,由于展开后的三维分块数据集由具有相同分块尺寸布局的多个纹理组成的存储结构,该存储结构可以在渲染过程中实现间接寻址,以使得在完成三维分块数据缓存后,可从缓存中获取三维分块数据,整个渲染过程如图5a-5b所示,利用树形结构构建包含逐层级展开的间接纹理,渲染运行时对间接纹理进行采样,获取的内容即为三维分块数据中缓存在树形结构中层级和偏移量,由此可计算出分块缓存中用于光照探针的采样位置。The following uses a 2D quadtree as an example of a specific application scenario. First, an effective light probe is adaptively created in the space voxel in the game scene, and then an effective light probe is placed at the corner of each voxel. The voxels are divided into 4 voxels, and the segmentation is further repeated for each voxel. The spatial voxels are formed into an octree structure to form a 2*2*2 probe grid, and the voxels close to the surface of the object are recorded, and these voxels are recorded. Place an effective light probe on the voxel node, and then add virtual voxels and virtual light probes at the level corresponding to the spatial voxels in the game scene. The virtual voxels and virtual light probes can be used at larger and smaller levels Realize seamless interpolation of lighting information when sampling between the two, and further combine and store the lighting information captured by the effective light probe and the virtual light probe into the texture resource information. The texture resource information can be expanded layer by layer during the rendering process. Each 3D block data in the texture resource information of one level has a separate number. Usually, the 3D block data of each level is combined with the light information captured by the effective light probe and the virtual light probe. For the uncombined storage The 3D block data can continue to be merged and processed. Since the expanded 3D block data set consists of a storage structure composed of multiple textures with the same block size layout, the storage structure can achieve indirect addressing during the rendering process to After the completion of the 3D block data cache, the 3D block data can be obtained from the cache. The entire rendering process is shown in Figure 5a-5b. The tree structure is used to construct indirect textures including layer-by-level expansion. The texture is sampled, and the obtained content is the level and offset of the 3D block data cached in the tree structure, from which the sampling position of the light probe in the block cache can be calculated.
本申请实例通过将树形结构中带有层级关系的空间体素展开为光照探针集合,形成三维分块数据集,每个三维分块数据在树形结构的层级关系存储在间接映射纹理中,进而在游戏场景渲染过程中,每一帧场景数据根据视点位置更新树形结构中光照探针所捕获的光照信息,并展开到三维分块数据集,展开过程中层级关系记录到间接纹理,然后传输到GPU,采样时根据物体表面采样点的世界位置,先从间接纹理中获得对应树形结构中某一层级关系,最后利用层级关系到三维分块数据中采样最终光照探针所形成的光照信息,对其进行渲染。In the example of this application, a three-dimensional block data set is formed by expanding the spatial voxels with a hierarchical relationship in the tree structure into a light probe set, and each three-dimensional block data is stored in the indirect mapping texture in the hierarchical relationship of the tree structure , and then in the game scene rendering process, each frame of scene data updates the lighting information captured by the light probe in the tree structure according to the viewpoint position, and expands it to the 3D block data set, and the hierarchical relationship is recorded in the indirect texture during the expansion process. Then transfer it to the GPU. When sampling, according to the world position of the sampling point on the surface of the object, first obtain a certain hierarchical relationship in the corresponding tree structure from the indirect texture, and finally use the hierarchical relationship to sample the final light probe in the 3D block data. Lighting information to render it.
进一步的,作为图1方法的具体实现,本申请实施例提供了一种游戏场景中光照信息的渲染装置,如图6所示,该装置包括:提取单元41、第一设置单元42、第二设置单元43、第一渲染单元44。Further, as a specific implementation of the method in FIG. 1 , an embodiment of the present application provides an apparatus for rendering lighting information in a game scene. As shown in FIG. 6 , the apparatus includes: an
提取单元41,可以用于利用游戏场景中空间区域的数据结构对所述空间区域进行切分,提取包含有物体的空间体素,所述数据结构为包含有多个层级的网格数据;The
第一设置单元42,可以用于遍历所述多个层级的网格数据,针对所述包含有物体的空间体素设置有效光照探针,得到空间区域的第一光照探针网格,所述第一光照探针网格包含有效光照探针;The
第二设置单元43,可以用于针对未包含物体的空间体素补充设置虚拟光照探针,得到空间区域的第二光照探针网格,所述第二光照探针网格包含有效光照探针和虚拟光照探针;The
第一渲染单元44,可以用于将所述第二光照探针网格所采集的光照信息传输至纹理资源信息中,并根据所述纹理资源信息对游戏场景中的光照信息进行渲染。The
在具体的应用场景中,如图7所示,所述数据结构为所述空间区域所形成的树形结构,所述提取单元41包括:In a specific application scenario, as shown in FIG. 7 , the data structure is a tree structure formed by the spatial region, and the
切分模块411,可以用于利用所述空间区域所形成的树形结构对所述空间区域进行多层级切分,形成多个层级的空间体素;The
第一判断模块412,可以用于在多层级空间区域的切分过程中,判断切分后层级内的空间体素是否包含有物体;The
提取模块413,可以用于若是,则对切分后层级内的空间体素进行下一层级切分,直至层级数量达到预设阈值,提取包含有物体的空间体素。The
在具体的应用场景中,如图7所示,所述第一设置单元42包括:In a specific application scenario, as shown in FIG. 7 , the
第一获取模块421,可以用于针对包含有物体的空间体素,获取所述空间体素在多个层级的网格数据中所处的网格位置;The first obtaining
第一设置模块422,可以用于在所述第一网格位置中的顶点设置有效光照探针,得到空间区域的第一光照探针网格。The
在具体的应用场景中,如图7所示,所述第二设置单元43包括:In a specific application scenario, as shown in FIG. 7 , the
第二获取模块431,可以用于遍历所述多个层级的网格数据,针对每个层级中未包含物体的空间体素,获取所述空间体素在多个层级的网格数据中所处的第二网格位置;The
第二判断模块432,可以用于判断所述网格位置的四个顶点处是否设置有效光照探针;The
第二设置模块433,可以用于若否,则针对网格位置中未设置有效光照探针的顶点补充设置虚拟光照探针,得到空间区域的第二光照探针网格。The
在具体的应用场景中,如图7所示,所述装置还包括:In a specific application scenario, as shown in Figure 7, the device further includes:
抽取单元45,可以用于在所述将所述第二光照探针网格所采集的光照信息传输至纹理资源信息中,并根据所述纹理资源信息对游戏场景中的光照信息进行渲染之前,抽取所述第二光照探针网格中光照信息所映射的空间逻辑关系,并将所述空间逻辑关系存储至纹理资源信息中。The
在具体的应用场景中,如图7所示,所述第一渲染单元44包括:In a specific application scenario, as shown in FIG. 7 , the
展开模块441,可以用于按照所述空间逻辑关系将所述纹理资源信息中光照信息展开到三维分块数据集中,并利用间接纹理记录三维分块数据集之间层级关系;The
合并模块442,可以用于利用所述间接纹理中三维分块数据集之间层级关系合并所述三维分块数据集,形成树形结构的三维分块纹理信息,所述三维分块纹理信息中记录有光照信息在游戏场景中的空间位置;The merging
读取模块443,可以用于根据视点位置在游戏场景中的空间位置,从所述树形结构的三维分块纹理信息中读取相应空间位置的光照信息进行渲染。The
在具体的应用场景中,所述展开模块441,具体可以用于根据所述空间逻辑关系,提取所述第二光照探针网格中有效光照探针和虚拟光照探针的层级分布;In a specific application scenario, the
所述展开模块441,具体还可以用于按照所述第二光照探针网格中有效光照探针和虚拟光照探针的层级分布,将所述纹理资源信息中光照信息展开到三维分块数据中,并利用间接纹理记录三维分块数据集之间层级关系。The
在具体的应用场景中,所述读取模块443,具体可以用于根据视点位置在游戏场景中的空间位置,从所述树形结构的三维分块纹理信息中获取表征三维分块数据集之间层级关系的间接纹理;In a specific application scenario, the
所述读取模块443,具体还可以用于利用所述表征三维分块数据集之间层级关系的间接纹理,读取所述树形结构的三维分块纹理信息中相应空间位置的光照信息进行渲染。The
需要说明的是,本实施例提供的一种游戏场景中光照信息的渲染装置所涉及各功能单元的其它相应描述,可以参考图1中的对应描述,在此不再赘述。It should be noted that, for other corresponding descriptions of the functional units involved in the apparatus for rendering lighting information in a game scene provided by this embodiment, reference may be made to the corresponding descriptions in FIG. 1 , which will not be repeated here.
进一步的,作为图3和图4方法的具体实现,本申请实施例提供了一种游戏场景中光照信息的渲染装置,如图8所示,该装置包括:获取单元51、创建单元52、存储单元53、第二渲染单元54。Further, as a specific implementation of the methods in FIGS. 3 and 4 , an embodiment of the present application provides an apparatus for rendering lighting information in a game scene. As shown in FIG. 8 , the apparatus includes: an
获取单元51,可以用于获取游戏场景中空间体素包含的近距离体素,所述近距离体素为游戏场景中空间体素分割所形成预设层级的体素中符合距离条件的体素,所述距离条件为体素的包围盒与游戏场景中物体包围盒相交;The obtaining
创建单元52,可以用于为所述空间体素包含的近距离体素创建有效光照探针和虚拟光照探针,生成空间体素的探针网格,所述探针网格用于捕获游戏场景中的光照信息;The
存储单元53,可以用于根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中;The
第二渲染单元54,可以用于响应于光照信息的渲染指令,利用所述纹理资源信息建立渲染任务,对所述游戏场景中光照信息进行渲染。The
本发明实施例提供的游戏场景中光照信息的渲染装置,与现有方式使用逐物体采样光照信息的方式相比,本申请通过使用逐像素采样光照信息的方式,一方面能够为大量及复杂物体提供间接光照,适用多种光照采集场景,另一方面避免了3D纹理从CPU端至GPU端的更新成本、传输带宽所限制逐个物体采样的物体总数。与现有方式使用逐像素采样光照信息的方式相比,本申请通过获取游戏场景中空间体素包含的近距离体素,该近距离体素为靠近物体表面的体素,需要更多数量的光照探针,进一步为空间体素包含的近距离体素创建有效光照探针和虚拟光照探针,生成空间体素的探针网格,能够自适应布局光照探针和虚拟光照探针,该虚拟光照探针作为辅助有效光照探针,为游戏场景提供无缝插值,并根据游戏场景中视点位置将空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中,该纹理资源信息能够应对不同游戏场景的光照信息采样,以使得同屏像素根据其在不同的空间位置采样到不同面密度的插值结果,进而在响应于光照信息的渲染指令时,利用纹理资源信息建立渲染任务,对游戏场景中光照信息进行渲染,该纹理资源信息中缓存了游戏场景的三维纹理地址,由于游戏场景中像素纹理的数量决定了光照探针的数量,而大量的体素通过自适应布局光照探针,能够节省光照探针数量,无需GPU硬件快速采样每帧数百万个光照探针,降低游戏场景中光照信息采样的更新、传输和存储成本,提高光照信息的渲染效率。Compared with the existing method that uses the method of sampling lighting information per object, the present application uses the method of sampling lighting information per pixel, on the one hand, it can provide a large number of complex objects. Provides indirect lighting and is suitable for a variety of lighting collection scenarios. On the other hand, it avoids the update cost of 3D textures from the CPU side to the GPU side, and the total number of objects sampled one by one limited by the transmission bandwidth. Compared with the existing method of using pixel-by-pixel sampling illumination information, the present application obtains the close-range voxels contained in the spatial voxels in the game scene, and the close-range voxels are voxels close to the surface of the object, which requires a larger number of Light probes, further create effective light probes and virtual light probes for close-range voxels contained in space voxels, generate probe grids for space voxels, and can adaptively layout light probes and virtual light probes. As an auxiliary effective light probe, the virtual light probe provides seamless interpolation for the game scene, and combines and stores the light information captured by the probe grid of the spatial voxel into the texture resource information according to the viewpoint position in the game scene. The resource information can deal with the lighting information sampling of different game scenes, so that the pixels on the same screen can sample interpolation results of different surface densities according to their different spatial positions, and then use the texture resource information to create rendering in response to the rendering instructions of the lighting information. The task is to render the lighting information in the game scene. The texture resource information caches the 3D texture address of the game scene. Since the number of pixel textures in the game scene determines the number of light probes, and a large number of voxels are arranged through adaptive layout Light probes can save the number of light probes, without the need for GPU hardware to quickly sample millions of light probes per frame, reduce the update, transmission and storage costs of lighting information sampling in game scenes, and improve the rendering efficiency of lighting information.
在具体的应用场景中,如图9所示,所述获取单元51包括:In a specific application scenario, as shown in FIG. 9 , the obtaining
分割模块511,可以用于获取游戏场景中待挂接物体覆盖的空间区域,将所述空间区域内的每个空间体素分割为预设层级的体素;The
第三判断模块512,可以用于遍历预设层级内的每个体素,判断分割后体素的包围盒与游戏场景中物体包围盒相交;The
确定模块513,可以用于若是,则确定所述分割后体素为游戏场景中物体表面的近距离体素。The determining
在具体的应用场景中,如图9所示,所述创建单元52包括:In a specific application scenario, as shown in FIG. 9 , the creating
创建模块521,可以用于针对所述空间体素中处于层级内的近距离体素,创建有效光照探针;The
增设模块522,可以用于为所述空间体素增设层级对应的虚拟体素,针对所述虚拟体素中符合添加条件的体素创建虚拟光照探针,所述虚拟光照探针用于对所述空间体素中处于层级内近距离体素所采样的光照数据进行无缝插值。The adding
在具体的应用场景中,如图9所示,所述增设模块522包括:In a specific application scenario, as shown in FIG. 9 , the
增设子模块5221,可以用于针对所述空间体素中大于一阶的层级,增设层级对应的虚拟体素,所述虚拟体素与所述空间体素中对应层级的体素相映射;A sub-module 5221 is added, which can be used to add virtual voxels corresponding to the levels in the spatial voxels that are greater than the first order, and the virtual voxels are mapped with voxels of the corresponding levels in the spatial voxels;
判断子模块5222,可以用于遍历层级对应的虚拟体素,判断所述空间体素中相映射体素是否存在有效光照探针;The judging submodule 5222 can be used to traverse the virtual voxels corresponding to the level, and judge whether there is an effective illumination probe in the phase-mapped voxels in the spatial voxels;
创建子模块5223,可以用于若否,则针对虚拟体素创建虚拟光照探针。Create sub-module 5223, which can be used to create virtual light probes for virtual voxels if not.
在具体的应用场景中,如图9所示,所述装置还包括:In a specific application scenario, as shown in FIG. 9 , the device further includes:
展开单元55,可以用于在所述根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息合并存储至纹理资源信息中之前,根据游戏场景中视点位置将所述空间体素的探针网格所捕获的光照信息展开到三维分块数据集,形成多层级树形结构的三维分块纹理信息;The
记录单元56,可以用于在展开到三维分块数据集的过程中,将所述三维分块数据集映射的层级关系记录至间接纹理信息中;The
所述存储单元53,还可以用于将所述三维分块纹理信息与所述间接纹理信息合并存储至纹理资源信息中。The
在具体的应用场景中,如图9所示,所述展开单元55包括:In a specific application scenario, as shown in FIG. 9 , the
运算模块551,可以用于利用所述探针网格中有效光照探针采样游戏场景中的光照数据,并对所述光照数据进行插值运算,得到游戏场景中视点位置的第一光照信息;The
插值模块552,可以用于利用所述探针网格中虚拟光照探针对所述空间体素中处于层级内近距离体素所采样的光照数据进行无缝插值,得到游戏场景中视点位置的第二光照信息;The
展开模块553,可以用于将所述游戏场景中视点位置的第一光照信息和第二光照信息展开到三维分块数据集,形成多层级树形结构的三维分块纹理信息。The
在具体的应用场景中,如图9所示,所述第二渲染单元54包括:In a specific application scenario, as shown in FIG. 9 , the
获取模块541,可以用于利用所述纹理资源信息建立渲染任务,从所述间接纹理信息中获取三维分块纹理信息映射的层级关系;The obtaining
查询模块542,可以用于根据所述三维分块纹理信息映射的层级关系,查询所述三维纹理信息在树形结构中的位置信息;The
采样模块543,可以用于按照所述三维纹理信息在树形结构中的位置位置从所述三维分块纹理信息中采样所述空间体素的探针网格所捕获的光照信息,对所述光照信息进行渲染。The
在具体的应用场景中,如图9所示,所述查询模块542包括:In a specific application scenario, as shown in FIG. 9 , the
提取子模块5421,可以用于根据所述三维分块纹理信息映射的层级关系,提取所述三维分块纹理信息在树形结构中所处层级和偏移量;The
计算子模块5422,可以用于根据所述三维分块纹理信息在树形结构中所处层级和偏移量,计算所述三维纹理信息在树形结构中的位置信息。The
需要说明的是,本实施例提供的一种游戏场景中光照信息的渲染装置所涉及各功能单元的其它相应描述,可以参考图1-图2中的对应描述,在此不再赘述。It should be noted that, for other corresponding descriptions of the functional units involved in the apparatus for rendering lighting information in a game scene provided by this embodiment, reference may be made to the corresponding descriptions in FIG. 1 to FIG. 2 , which will not be repeated here.
基于上述如图1所示方法,相应的,本申请实施例还提供了一种存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述如图1所示的游戏场景中光照信息的渲染方法。Based on the above method shown in FIG. 1 , correspondingly, an embodiment of the present application further provides a storage medium on which a computer program is stored, and when the program is executed by a processor, realizes the lighting in the game scene shown in FIG. 1 above. The rendering method of the information.
基于上述如图3-图4所示方法,相应的,本申请实施例还提供了一种存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述如图3-图4所示的游戏场景中光照信息的渲染方法。Based on the above methods as shown in FIGS. 3 to 4 , correspondingly, an embodiment of the present application further provides a storage medium on which a computer program is stored. The rendering method of lighting information in the game scene shown.
基于这样的理解,本申请的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施场景所述的方法。Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, and the software product can be stored in a non-volatile storage medium (which may be CD-ROM, U disk, mobile hard disk, etc.), including several The instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in various implementation scenarios of this application.
基于上述如图1、图3-图4所示的方法,以及图6-图9所示的虚拟装置实施例,为了实现上述目的,本申请实施例还提供了一种游戏场景中光照信息的渲染的实体设备,具体可以为计算机,智能手机,平板电脑,智能手表,服务器,或者网络设备等,该实体设备包括存储介质和处理器;存储介质,用于存储计算机程序;处理器,用于执行计算机程序以实现上述如图1、图3-图4所示的游戏场景中光照信息的渲染方法。Based on the methods shown in FIG. 1, FIG. 3-FIG. 4, and the virtual device embodiments shown in FIG. 6-FIG. 9, in order to achieve the above-mentioned purpose, the embodiment of the present application further provides a method of lighting information in a game scene. The rendered physical device can specifically be a computer, a smart phone, a tablet computer, a smart watch, a server, or a network device, etc. The physical device includes a storage medium and a processor; a storage medium for storing computer programs; a processor for The computer program is executed to realize the above-mentioned rendering method of lighting information in the game scene shown in FIG. 1 and FIG. 3-FIG. 4 .
可选的,该实体设备还可以包括用户接口、网络接口、摄像头、射频(RadioFrequency,RF)电路,传感器、音频电路、WI-FI模块等等。用户接口可以包括显示屏(Display)、输入单元比如键盘(Keyboard)等,可选用户接口还可以包括USB接口、读卡器接口等。网络接口可选的可以包括标准的有线接口、无线接口(如WI-FI接口)等。Optionally, the physical device may further include a user interface, a network interface, a camera, a radio frequency (Radio Frequency, RF) circuit, a sensor, an audio circuit, a WI-FI module, and the like. The user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, and the like. Optional network interfaces may include standard wired interfaces, wireless interfaces (such as WI-FI interfaces), and the like.
在示例性实施例中,参见图10,上述实体设备包括通信总线、处理器、存储器和通信接口,还可以包括、输入输出接口和显示设备,其中,各个功能单元之间可以通过总线完成相互间的通信。该存储器存储有计算机程序,处理器,用于执行存储器上所存放的程序,执行上述实施例中的画作挂载方法。In an exemplary embodiment, referring to FIG. 10 , the above-mentioned physical device includes a communication bus, a processor, a memory, and a communication interface, and may also include an input/output interface and a display device, wherein each functional unit can communicate with each other through the bus. Communication. The memory stores a computer program and a processor, which is used for executing the program stored in the memory and executing the painting mounting method in the above-mentioned embodiment.
本领域技术人员可以理解,本实施例提供的一种游戏场景中光照信息的渲染的实体设备结构并不构成对该实体设备的限定,可以包括更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the entity device structure for rendering lighting information in a game scene provided by this embodiment does not constitute a limitation on the entity device, and may include more or less components, or combine some components , or a different component arrangement.
存储介质中还可以包括操作系统、网络通信模块。操作系统是管理上述店铺搜索信息处理的实体设备硬件和软件资源的程序,支持信息处理程序以及其它软件和/或程序的运行。网络通信模块用于实现存储介质内部各组件之间的通信,以及与信息处理实体设备中其它硬件和软件之间通信。The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the physical device for processing the above-mentioned store search information, and supports the operation of the information processing program and other software and/or programs. The network communication module is used to realize the communication between various components in the storage medium, as well as the communication with other hardware and software in the information processing entity device.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本申请可以借助软件加必要的通用硬件平台的方式来实现,也可以通过硬件实现。通过应用本申请的技术方案,与目前现有方式相比,本申请中对于游戏场景中地形元素未发生变更的地形数据帧,说明场景地形并未发生变动,可以使用上一次变更的地形数据帧形成的混合纹理信息来执行游戏场景渲染,无需对每帧地形场景执行多纹理混合运算,减少了纹理渲染过程的时间占用,提高游戏场景中光照信息的渲染速度。From the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, and can also be implemented by hardware. By applying the technical solution of the present application, compared with the current existing methods, for the terrain data frame in which the terrain elements in the game scene have not changed, it means that the scene terrain has not changed, and the last changed terrain data frame can be used. The resulting mixed texture information is used to perform game scene rendering, and there is no need to perform multi-texture mixing operations on each frame of terrain scene, which reduces the time occupied by the texture rendering process and improves the rendering speed of lighting information in the game scene.
本领域技术人员可以理解附图只是一个优选实施场景的示意图,附图中的模块或流程并不一定是实施本申请所必须的。本领域技术人员可以理解实施场景中的装置中的模块可以按照实施场景描述进行分布于实施场景的装置中,也可以进行相应变化位于不同于本实施场景的一个或多个装置中。上述实施场景的模块可以合并为一个模块,也可以进一步拆分成多个子模块。Those skilled in the art can understand that the accompanying drawing is only a schematic diagram of a preferred implementation scenario, and the modules or processes in the accompanying drawing are not necessarily necessary to implement the present application. Those skilled in the art can understand that the modules in the device in the implementation scenario may be distributed in the device in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the implementation scenario with corresponding changes. The modules of the above implementation scenarios may be combined into one module, or may be further split into multiple sub-modules.
上述本申请序号仅仅为了描述,不代表实施场景的优劣。以上公开的仅为本申请的几个具体实施场景,但是,本申请并非局限于此,任何本领域的技术人员能思之的变化都应落入本申请的保护范围。The above serial numbers in the present application are only for description, and do not represent the pros and cons of the implementation scenarios. The above disclosures are only a few specific implementation scenarios of the present application, however, the present application is not limited thereto, and any changes that can be conceived by those skilled in the art should fall within the protection scope of the present application.
Claims (11)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210325539.9A CN115131482B (en) | 2021-03-30 | 2021-03-30 | Method, device and equipment for rendering lighting information in game scenes |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210325539.9A CN115131482B (en) | 2021-03-30 | 2021-03-30 | Method, device and equipment for rendering lighting information in game scenes |
CN202110342331.3A CN113034657B (en) | 2021-03-30 | 2021-03-30 | Rendering method, device and equipment for illumination information in game scene |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110342331.3A Division CN113034657B (en) | 2021-03-30 | 2021-03-30 | Rendering method, device and equipment for illumination information in game scene |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115131482A true CN115131482A (en) | 2022-09-30 |
CN115131482B CN115131482B (en) | 2025-02-18 |
Family
ID=76452932
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110342331.3A Active CN113034657B (en) | 2021-03-30 | 2021-03-30 | Rendering method, device and equipment for illumination information in game scene |
CN202210325539.9A Active CN115131482B (en) | 2021-03-30 | 2021-03-30 | Method, device and equipment for rendering lighting information in game scenes |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110342331.3A Active CN113034657B (en) | 2021-03-30 | 2021-03-30 | Rendering method, device and equipment for illumination information in game scene |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN113034657B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117876572A (en) * | 2024-03-13 | 2024-04-12 | 腾讯科技(深圳)有限公司 | Illumination rendering method, device, equipment and storage medium |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114299220B (en) * | 2021-11-19 | 2024-11-15 | 腾讯科技(成都)有限公司 | Lightmap data generation method, device, equipment, medium and program product |
CN116740255A (en) * | 2022-03-02 | 2023-09-12 | 腾讯科技(深圳)有限公司 | Rendering processing method, device, equipment and medium |
CN116934946A (en) * | 2022-04-02 | 2023-10-24 | 腾讯科技(深圳)有限公司 | Illumination rendering method and device for virtual terrain, storage medium and electronic equipment |
CN114782615A (en) * | 2022-04-21 | 2022-07-22 | 广东三维家信息科技有限公司 | Real-time rendering method and device of indoor scene, electronic equipment and storage medium |
CN118096985B (en) * | 2023-07-11 | 2024-12-06 | 北京艾尔飞康航空技术有限公司 | Real-time rendering method and device for virtual forest scene |
CN118070403B (en) * | 2024-04-17 | 2024-07-23 | 四川省建筑设计研究院有限公司 | BIM-based method and system for automatically generating lamp loop influence area space |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106204701A (en) * | 2016-06-22 | 2016-12-07 | 浙江大学 | A kind of rendering intent based on light probe interpolation dynamic calculation indirect reference Gao Guang |
EP3337585A2 (en) * | 2015-08-17 | 2018-06-27 | Lego A/S | Method of creating a virtual game environment and interactive game system employing the method |
CN111340926A (en) * | 2020-03-25 | 2020-06-26 | 北京畅游创想软件技术有限公司 | Rendering method and device |
CN111744183A (en) * | 2020-07-02 | 2020-10-09 | 网易(杭州)网络有限公司 | Illumination sampling method and device in game and computer equipment |
CN112169324A (en) * | 2020-09-22 | 2021-01-05 | 完美世界(北京)软件科技发展有限公司 | Rendering method, device and equipment of game scene |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103198515B (en) * | 2013-04-18 | 2016-05-25 | 北京尔宜居科技有限责任公司 | In a kind of instant adjusting 3D scene, object light is according to the method for rendering effect |
US9390548B2 (en) * | 2014-06-16 | 2016-07-12 | Sap Se | Three-dimensional volume rendering using an in-memory database |
CN104574489B (en) * | 2014-12-16 | 2017-11-03 | 中国人民解放军理工大学 | Landform and motion vector integrated approach based on lamination quaternary tree atlas |
CN111798558A (en) * | 2020-06-02 | 2020-10-20 | 完美世界(北京)软件科技发展有限公司 | Data processing method and device |
-
2021
- 2021-03-30 CN CN202110342331.3A patent/CN113034657B/en active Active
- 2021-03-30 CN CN202210325539.9A patent/CN115131482B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3337585A2 (en) * | 2015-08-17 | 2018-06-27 | Lego A/S | Method of creating a virtual game environment and interactive game system employing the method |
CN106204701A (en) * | 2016-06-22 | 2016-12-07 | 浙江大学 | A kind of rendering intent based on light probe interpolation dynamic calculation indirect reference Gao Guang |
CN111340926A (en) * | 2020-03-25 | 2020-06-26 | 北京畅游创想软件技术有限公司 | Rendering method and device |
CN111744183A (en) * | 2020-07-02 | 2020-10-09 | 网易(杭州)网络有限公司 | Illumination sampling method and device in game and computer equipment |
CN112169324A (en) * | 2020-09-22 | 2021-01-05 | 完美世界(北京)软件科技发展有限公司 | Rendering method, device and equipment of game scene |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117876572A (en) * | 2024-03-13 | 2024-04-12 | 腾讯科技(深圳)有限公司 | Illumination rendering method, device, equipment and storage medium |
CN117876572B (en) * | 2024-03-13 | 2024-08-16 | 腾讯科技(深圳)有限公司 | Illumination rendering method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113034657B (en) | 2022-04-22 |
CN113034657A (en) | 2021-06-25 |
CN115131482B (en) | 2025-02-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114549723B (en) | Method, device and equipment for rendering lighting information in game scenes | |
CN115131482B (en) | Method, device and equipment for rendering lighting information in game scenes | |
US11804002B2 (en) | Techniques for traversing data employed in ray tracing | |
CN111340928B (en) | Ray tracing-combined real-time hybrid rendering method and device for Web end and computer equipment | |
US12190435B2 (en) | Enhanced techniques for traversing ray tracing acceleration structures | |
CN108986195B (en) | Single-lens mixed reality implementation method combining environment mapping and global illumination rendering | |
US8570322B2 (en) | Method, system, and computer program product for efficient ray tracing of micropolygon geometry | |
US12159342B2 (en) | Ray tracing hardware acceleration for supporting motion blur and moving/deforming geometry | |
US11663770B2 (en) | Hardware-based techniques applicable for ray tracing for efficiently representing and processing an arbitrary bounding volume | |
JP6864495B2 (en) | Drawing Global Illumination in 3D scenes | |
US11508112B2 (en) | Early release of resources in ray tracing hardware | |
WO2025025724A1 (en) | Lighting rendering method and apparatus, and terminal and storage medium | |
CN112927352B (en) | Three-dimensional scene local area dynamic flattening method and device based on flattening polygons | |
US20240009226A1 (en) | Techniques for traversing data employed in ray tracing | |
WO2025055518A1 (en) | Virtual screen generation method and apparatus, electronic device, computer readable storage medium, and computer program product | |
CN118037962A (en) | A lightweight three-dimensional model construction method, system and medium for experimental equipment | |
CN117523074A (en) | Method and device for dynamically switching building white mold textures in batches for Web end | |
CN119251367A (en) | A VR optimized rendering method based on vertex optimization | |
WO2001033509A1 (en) | Improvements relating to computer graphics |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
EE01 | Entry into force of recordation of patent licensing contract |
Application publication date: 20220930 Assignee: Beijing Xuanguang Technology Co.,Ltd. Assignor: Perfect world (Beijing) software technology development Co.,Ltd. Contract record no.: X2022990000514 Denomination of invention: Rendering method, device and device of lighting information in game scene License type: Exclusive License Record date: 20220817 |
|
EE01 | Entry into force of recordation of patent licensing contract | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |