CN116934946A - Illumination rendering method and device for virtual terrain, storage medium and electronic equipment - Google Patents
Illumination rendering method and device for virtual terrain, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN116934946A CN116934946A CN202210344253.5A CN202210344253A CN116934946A CN 116934946 A CN116934946 A CN 116934946A CN 202210344253 A CN202210344253 A CN 202210344253A CN 116934946 A CN116934946 A CN 116934946A
- Authority
- CN
- China
- Prior art keywords
- probe
- probe point
- points
- target
- current
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000009877 rendering Methods 0.000 title claims abstract description 147
- 238000005286 illumination Methods 0.000 title claims abstract description 142
- 238000000034 method Methods 0.000 title claims abstract description 89
- 239000000523 sample Substances 0.000 claims abstract description 977
- 230000006870 function Effects 0.000 claims description 26
- 230000015654 memory Effects 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 21
- 238000001514 detection method Methods 0.000 claims description 15
- 238000001914 filtration Methods 0.000 claims description 8
- 238000013507 mapping Methods 0.000 claims description 2
- 230000000694 effects Effects 0.000 description 18
- 230000008569 process Effects 0.000 description 16
- 238000012545 processing Methods 0.000 description 16
- 238000010586 diagram Methods 0.000 description 11
- 238000004364 calculation method Methods 0.000 description 10
- 230000002159 abnormal effect Effects 0.000 description 9
- 238000012216 screening Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 238000005070 sampling Methods 0.000 description 6
- 230000005540 biological transmission Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 2
- 238000010168 coupling process Methods 0.000 description 2
- 238000005859 coupling reaction Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000007781 pre-processing Methods 0.000 description 2
- 239000004576 sand Substances 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- 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
- G06T15/506—Illumination models
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/10—Geometric effects
- G06T15/20—Perspective computation
- G06T15/205—Image-based rendering
-
- 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
- G06T17/05—Geographic models
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
- G06T17/20—Finite element generation, e.g. wire-frame surface description, tesselation
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Graphics (AREA)
- General Physics & Mathematics (AREA)
- Geometry (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Remote Sensing (AREA)
- Image Generation (AREA)
Abstract
The application discloses a method and a device for illumination rendering of virtual terrain, a storage medium and electronic equipment. Wherein the method comprises the following steps: acquiring a candidate probe point set of a target virtual terrain sub-block; determining probe points corresponding to all vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set; obtaining spherical harmonic base coefficients of all the probe points in the candidate probe point set, merging the probe points in the candidate probe point set to obtain a target probe point set, obtaining a second index relation set, and carrying out illumination rendering on the target virtual topography subblocks according to the spherical harmonic base coefficients of all the probe points in the target probe point set and the second index relation set. The method solves the technical problem of low illumination rendering efficiency of the virtual terrain.
Description
Technical Field
The present application relates to the field of computers, and in particular, to a method and apparatus for rendering illumination of virtual terrain, a storage medium, and an electronic device.
Background
In the light rendering scene of the virtual terrain, the light rendering of the virtual terrain pixel by pixel is generally performed by using a light map (lightmap) mode, but the mode generally occupies a large amount of memory and storage space, and needs higher calculation amount for supporting, so that the problem of lower light rendering efficiency of the virtual terrain occurs. Therefore, there is a problem in that the illumination rendering efficiency of the virtual terrain is low.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the application provides a method and a device for rendering illumination of virtual terrain, a storage medium and electronic equipment, and aims to at least solve the technical problem of low illumination rendering efficiency of the virtual terrain.
According to an aspect of an embodiment of the present application, there is provided an illumination rendering method of a virtual terrain, including: acquiring a candidate probe point set of a target virtual terrain sub-block, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual terrain sub-block; determining probe points corresponding to all the vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set, wherein each index relation in the first index relation set represents the vertexes and the probe points with corresponding relations; acquiring spherical harmonic base coefficients of each probe point in the candidate probe point set, and determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficients of each probe point;
combining the probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set to obtain a target probe point set, and modifying the vertex with a corresponding relation in the first index relation set and the probe point before combination into the vertex with the corresponding relation and the probe point after combination to obtain a second index relation set; and carrying out illumination rendering on the target virtual terrain sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set.
According to another aspect of the embodiment of the present application, there is also provided an illumination rendering apparatus for a virtual terrain, including: the first acquisition unit is used for acquiring a candidate probe point set of the target virtual topography sub-block, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual topography sub-block; a determining unit, configured to determine probe points corresponding to each vertex in the target virtual terrain sub-block in the candidate probe point set, to obtain a first index relationship set, where each index relationship in the first index relationship set represents a vertex and a probe point that have a corresponding relationship; the second acquisition unit is used for acquiring the spherical harmonic base coefficient of each probe point in the candidate probe point set and determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficient of each probe point; the merging unit is used for merging the probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set to obtain a target probe point set, and modifying the vertex with a corresponding relation in the first index relation set and the probe point before merging into the vertex with the corresponding relation and the probe point after merging to obtain a second index relation set; and the rendering unit is used for carrying out illumination rendering on the target virtual terrain subblock according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set.
As an alternative, the merging unit includes: the repeating module is configured to repeatedly perform the following steps until the number of probe points in the candidate probe point set is less than or equal to a preset number threshold, where the current probe point set is initialized to the candidate probe point set: the first determining module is used for determining two probe points to be combined according to the difference degree of every two probe points in the current probe point set, wherein the two probe points to be combined comprise a first current probe point and a second current probe point, and the first current probe point is the probe point to be combined to the second current probe point; the searching module is used for deleting the first current probe point from the current probe point set, searching the vertex with a corresponding relation with the first current probe point from the first index relation set, and modifying the corresponding relation of the searched vertex in the first index relation set from the corresponding relation with the first current probe point to the corresponding relation with the second current probe point.
As an alternative, the first determining module includes: the first determining submodule is used for determining the two probe points with the smallest difference degree in the current probe point set, and determining the two probe points with the smallest difference degree as the two probe points to be combined; or the second determining submodule is used for searching the two detection points with the difference degree smaller than or equal to a preset difference degree threshold value in the current detection point set, and determining the two detection points with the difference degree smaller than or equal to the preset difference degree threshold value as the two detection points to be combined under the condition that the two detection points with the difference degree smaller than or equal to the preset difference degree threshold value are searched.
As an alternative, the determining unit includes: the execution module is configured to execute the following steps for each two probe points in the candidate probe point set, where, when executing the following steps, each two probe points includes a third current probe point and a fourth current probe point, where the third current probe point is a probe point to be combined to the fourth current probe point: the first acquisition module is used for acquiring a target difference value obtained by subtracting the spherical harmonic basis coefficient of the third current probe point from the spherical harmonic basis coefficient of the fourth current probe point; and the second determining module is used for determining the difference degree between the third current probe point and the fourth current probe point according to the target difference value.
As an alternative, the second determining module includes: the first acquisition sub-module is used for acquiring a triangle set associated with the third current probe point, wherein the target virtual terrain sub-block is divided into a group of triangles, and the triangle set comprises triangles in which vertexes with corresponding relations with the third current probe point are positioned in the group of triangles; the second acquisition submodule is used for acquiring the normal vector of each triangle in the triangle set and the preset weight corresponding to each triangle; and the third determining submodule is used for determining the difference degree between the third current probe point and the fourth current probe point according to the target difference value, the normal vector of each triangle and the preset weight corresponding to each triangle.
As an alternative, the third determining sub-module includes: a first determining subunit, configured to determine, according to a preset difference function, a difference between the third current probe point and the fourth current probe point according to the target difference value, the normal vector of each triangle, and a preset weight corresponding to each triangle, where the third current probe point is not located at the boundary of the target virtual terrain sub-block; the second determining subunit is configured to determine, according to a preset difference function and according to the target difference value, the normal vector of each triangle, and a preset weight corresponding to each triangle, an initial difference between the third current probe point and the fourth current probe point when the third current probe point is located at the boundary of the target virtual terrain sub-block; and a third determining subunit, configured to determine a difference between the third current probe point and the fourth current probe point to be equal to a product of the initial difference and a preset constant, where the preset constant is greater than 1.
As an alternative, the rendering unit includes: the storage module is used for storing the spherical harmonic basis coefficients of all the probe points in the target probe point set as a target map; the third determining module is used for determining spherical harmonic base coefficients of probe points corresponding to all vertexes in the target virtual topography sub-block from the target map according to the second index relation set when the target virtual topography sub-block is required to be rendered; a fourth determining module, configured to determine spherical harmonic basis coefficients of each vertex in the target virtual terrain sub-block according to spherical harmonic basis coefficients of probe points corresponding to each vertex in the target virtual terrain sub-block; and the rendering module is used for carrying out illumination rendering on the target virtual topography sub-block according to the spherical harmonic base coefficients of all the vertexes in the target virtual topography sub-block.
As an alternative, the fourth determining module includes: an execution sub-module, configured to execute the following steps for each vertex in the target virtual terrain sub-block, where when the following steps are executed, each vertex is a current vertex: a fourth determining submodule, configured to determine a spherical harmonic basis coefficient of the current vertex to be equal to a spherical harmonic basis coefficient of one probe point when the current vertex has a correspondence with one probe point in the target probe point set; or a fifth determining submodule, configured to determine, when the current vertex has a correspondence with a plurality of probe points in the target set of probe points, a spherical harmonic basis coefficient of the current vertex to be equal to a weighted sum of spherical harmonic basis coefficients of the plurality of probe points.
As an alternative, the determining unit includes: the first recording module is used for searching one probe point closest to each vertex in the candidate probe point set, and recording each vertex and the corresponding searched probe point in the first index relation set as index relations; or the second recording module is used for searching a plurality of probe points closest to each vertex in the candidate probe point set, setting corresponding weights for the plurality of probe points, and recording the corresponding weights of each vertex, the corresponding searched plurality of probe points and the plurality of probe points as index relations in the first index relation set.
As an alternative, the first obtaining unit includes: the second acquisition module is used for acquiring an original probe point set of the target virtual terrain sub-block, wherein the target virtual terrain sub-block is divided into a group of triangles, and the original probe point set comprises one or more probe points corresponding to each triangle in the group of triangles; and the third acquisition module is used for filtering invalid probe points from the original probe point set to obtain the candidate probe point set.
According to yet another aspect of embodiments of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the illumination rendering method of the virtual terrain as above.
According to still another aspect of the embodiment of the present application, there is further provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the above-mentioned illumination rendering method of virtual terrain through the computer program.
In the embodiment of the application, a candidate probe point set of a target virtual terrain sub-block is obtained, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual terrain sub-block; determining probe points corresponding to all the vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set, wherein each index relation in the first index relation set represents the vertexes and the probe points with corresponding relations; the method comprises the steps of obtaining spherical harmonic base coefficients of all probe points in the candidate probe point set, determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficients of all probe points, merging the probe points in the candidate probe point set to obtain a target probe point set, modifying the vertex with a corresponding relation in the first index relation set and the probe point before merging into the vertex with the corresponding relation and the probe point after merging to obtain a second index relation set, carrying out illumination rendering on a target virtual topography sub-block according to the spherical harmonic base coefficients of all probe points in the target probe point set and the second index relation set, merging a large number of probe points according to the characteristic of high repeatability of virtual topography, so that the number of probe points for illumination rendering is reduced, the purpose of reducing the calculated amount of the spherical harmonic base coefficients of the probe points is achieved, the technical effect of improving the illumination efficiency of the virtual topography is achieved, and the technical problem that the illumination efficiency of the virtual topography is lower is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a schematic illustration of an application environment of an alternative illumination rendering method for virtual terrain, according to an embodiment of the application;
FIG. 2 is a schematic illustration of a flow of an alternative illumination rendering method of a virtual terrain, according to an embodiment of the application;
FIG. 3 is a schematic diagram of an alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the present application;
FIG. 4 is a schematic diagram of another alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the present application;
FIG. 5 is a schematic diagram of another alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the application;
FIG. 6 is a schematic diagram of another alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the application;
FIG. 7 is a schematic diagram of another alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the application;
FIG. 8 is a schematic diagram of another alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the application;
FIG. 9 is a schematic diagram of another alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the present application;
FIG. 10 is a schematic diagram of another alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the application;
FIG. 11 is a schematic diagram of another alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the application;
FIG. 12 is a schematic diagram of another alternative method of illumination rendering of virtual terrain in accordance with an embodiment of the application;
FIG. 13 is a schematic diagram of an alternative virtual terrain lighting rendering apparatus, according to an embodiment of the present application;
fig. 14 is a schematic structural view of an alternative electronic device according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of the embodiment of the present application, there is provided a method for rendering illumination of a virtual terrain, optionally, as an optional implementation manner, the method for rendering illumination of a virtual terrain may be applied, but is not limited to, in an environment as shown in fig. 1. Including but not limited to a user device 102, wherein the user device 102 may include but is not limited to a display 108, a processor 106, and a memory 104.
The specific process comprises the following steps:
step S102, the user equipment 102 obtains an illumination rendering request triggered by the target virtual terrain sub-block 1024, where the target virtual terrain sub-block 1024 is a sub-block of the target virtual terrain 1022, and the target virtual terrain 1022 may include, but is not limited to, a plurality of sub-blocks;
step S104, the user equipment 102 responds to the illumination rendering request and acquires a candidate probe point set of the target virtual terrain sub-block through the memory 104;
step S106-S112, the user equipment 102 determines probe points corresponding to each vertex in the target virtual terrain sub-block in the candidate probe point set through the processor 106 to obtain a first index relation set, obtains spherical harmonic basis coefficients of each probe point in the candidate probe point set, determines the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic basis coefficients of each probe point, combines the probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set to obtain a target probe point set, and modifies the vertex with a corresponding relation in the first index relation set and the probe point before combination into a vertex with a corresponding relation and a combined probe point to obtain a second index relation set; further carrying out illumination rendering on the target virtual terrain sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set to obtain an illumination rendering result; the processor 106 in the user device 102 displays a screen corresponding to the result of the illumination rendering in the display 108 and the result of the illumination rendering in the memory 104.
In addition to the example shown in fig. 1, the above steps may be performed with assistance of a server, that is, the steps of obtaining the first set of index relationships, obtaining the second set of index relationships, obtaining the result of illumination rendering, and the like are performed by the server, so as to reduce the processing pressure of the server. The user device 102 includes, but is not limited to, a handheld device (e.g., a mobile phone), a notebook computer, a desktop computer, a vehicle-mounted device, etc., and the application is not limited to a particular implementation of the user device 102.
Optionally, as an optional implementation manner, as shown in fig. 2, the illumination rendering method of the virtual terrain includes:
s202, acquiring a candidate probe point set of a target virtual terrain sub-block, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual terrain sub-block;
s204, determining probe points corresponding to all the vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set, wherein each index relation in the first index relation set represents the vertexes and the probe points with corresponding relations;
s206, acquiring spherical harmonic base coefficients of each probe point in the candidate probe point set, and determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficients of each probe point;
S208, combining the probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set to obtain a target probe point set, and modifying the vertex with the corresponding relation in the first index relation set and the probe point before combination into the vertex with the corresponding relation and the probe point after combination to obtain a second index relation set;
and S210, carrying out illumination rendering on the target virtual topography sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set.
Optionally, in this embodiment, the above-mentioned illumination rendering method of virtual terrain may be, but not limited to, applied to a terrain rendering scene in a three-dimensional (3D) game, and a pre-processing illumination rendering mode is proposed for a specific object such as terrain, where the terrain has a very broad characteristic, its illumination data has very high repeatability in a relatively large range, and further, the good property of spherical harmonic illumination is utilized, and a smaller number of spherical harmonic coefficients are solved by means of difference degree comparison, so as to reduce the calculation amount in the illumination rendering process, and the object attached to the object surface may multiplex the above-mentioned illumination rendering mode, so as to further improve the illumination rendering efficiency.
Alternatively, in this embodiment, the target virtual terrain sub-block may be, but is not limited to, any one of a plurality of sub-blocks understood as the target virtual terrain, where the target virtual terrain may be, but is not limited to, a whole in appearance, but is divided into a plurality of small blocks structures during logic processing and rendering, the plurality of small blocks structures may be, but is not limited to, a plurality of sub-blocks understood as the target virtual terrain, and the plurality of sub-blocks may be, but is not limited to, implementing illumination rendering in parallel or linearly by the above-mentioned illumination rendering method of the virtual terrain, so as to implement whole illumination rendering of the target virtual terrain; in addition, the shape of the target virtual terrain sub-block may be, but is not limited to, triangular, rectangular, circular, trapezoidal, or polygonal, without limitation.
Optionally, in this embodiment, the probe point may be, but is not limited to, a three-dimensional space point that is understood to be a space for collecting illumination information, and is further used for illumination rendering of the target virtual terrain sub-block.
Optionally, in this embodiment, the target virtual terrain sub-block may be, but not limited to being, divided into a plurality of triangles for processing, and each triangle may be, but not limited to, a corresponding plurality of vertices, where one vertex may be, but not limited to, associated with a plurality of probe points, and one probe point may be, but not limited to, associated with a plurality of vertices; the process of obtaining the candidate probe point set of the target virtual terrain sub-block can be also understood as, but is not limited to, obtaining the candidate probe point of each triangle into which the target virtual terrain sub-block is divided;
Further by way of example, as shown in fig. 3, triangle 302 is one of a plurality of triangles into which the target virtual terrain sub-block is divided, taking this triangle 302 as an example, as shown in fig. 3 (a), O is the centroid of triangle 302, and a, b, c are the midpoints of line segments AO, BO, CO of triangle 302, respectively; further as shown in fig. 3 (b), a, b, c are shifted by a preset unit along the normal direction of the triangle 302, thereby obtaining 3 candidate probe points a ', b ', c '; similarly, referring to the above-mentioned method for obtaining candidate probe points of the triangle 302, obtaining candidate probe points of each triangle into which the target virtual terrain sub-block is divided;
furthermore, in this embodiment, the areas of the triangles into which the target virtual terrain sub-block is divided may be different, and the acquisition manners of the candidate probe points of the triangles may be different for different areas, for example, in view of improving performance, the candidate probe points with areas smaller than or equal to the target threshold may be generated, but not limited to, a first number of candidate probe points (for example, candidate probe points obtained by offsetting the centroid of the triangle in the normal direction of the triangle) may be generated, and the triangles with areas larger than the target threshold may be generated, but not limited to, a second number of candidate probe points, where the second number is larger than the first number.
Optionally, in this embodiment, the manner of determining the probe points corresponding to each vertex in the target virtual terrain sub-block in the candidate probe point set may, but is not limited to, acquiring all the probe points corresponding to each vertex in the target virtual terrain sub-block from the candidate probe point set, or in the case that all the probe points are acquired, screening all the probe points to obtain a part of the probe points, thereby providing a better probe point for the subsequent illumination rendering operation, so as to improve the overall efficiency of illumination rendering, where the screening manner may, but is not limited to, include random screening, conditional screening, and the like;
further by way of example, optionally, for example, 10 probe points (all probe points) have been obtained, and target probe points having a compactness reaching a target threshold are screened out from the 10 probe points, wherein the compactness may be, but is not limited to, the compactness of the correspondence between the probe points and the vertices.
Alternatively, in this embodiment, the spherical harmonic basis coefficients may be, but are not limited to, coefficients of a basis function in spherical harmonic illumination, or may be, but are not limited to, understood as sampling illumination into N coefficients, and then restoring the sampled illumination with the spherical harmonic basis coefficients at the time of rendering, so as to complete rendering.
Alternatively, in this embodiment, the difference between every two probe points may be understood as, but not limited to, the difference between every two probe points, for example, the spherical harmonic base coefficient of probe point a is A1, and the spherical harmonic base coefficient of probe point B is B1, and the difference between probe point a and probe point B may be understood as, but not limited to, |a1-b1|; the difference degree of every two probe points can be understood as the difference degree of target parameters corresponding to the spherical harmonic basis coefficients of every two probe points, for example, the spherical harmonic basis coefficient of the probe point a is A1, the spatial position parameter of the probe point a is A2, the target parameter of the probe point a is a1×a2, the spherical harmonic basis coefficient of the probe point B is B1, the spatial position parameter of the probe point B (which can be understood as spatial position information on a target virtual topography sub-block) is B2, and the target parameter of the probe point B is b1×b2, where the difference degree of the probe point a and the probe point B can be understood as |a1×a2-b1×b2|, the target parameter can be any parameter related to the spherical harmonic basis coefficient immediately, or calculated by the spherical harmonic basis coefficient, and the spatial position parameter is only a distance illustration and is not limited.
Optionally, in this embodiment, the manner of merging the probe points in the candidate probe point set may, but is not limited to, merging at least two probe points into at least one probe point, where the at least two probe points may, but are not limited to, not include the at least one probe point, for example, merging the probe point a and the probe point B (at least two probe points) into the probe point C (at least one probe point), and modifying the index relationship (the index relationship in the first index relationship set) of the probe point a and the probe point B to the probe point C, or the probe point C has the index relationship of the probe point a and the probe point B; or, the at least two probe points may include, but are not limited to, the at least one probe point, for example, the probe point a and the probe point B (at least two probe points) are combined into the probe point a (at least one probe point), and the index relationship (the index relationship in the first index relationship set) of the probe point B is modified to the probe point a, or the probe point a has both the original index relationship of the probe point a and the index relationship of the probe point B.
Optionally, in this embodiment, the illumination rendering is performed on the target virtual terrain sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and a second index relation set, where the index relation in the second index relation set may, but is not limited to, be used to determine an index (corresponding) relation between each probe point in the target probe point set and each vertex in the target virtual terrain sub-block, and render, based on the index relation, each corresponding vertex using the spherical harmonic base coefficient of each probe point.
Optionally, in this embodiment, after the target probe set is obtained, the probe points in the target probe set are transferred to a baker for baking, where the probe points in the target probe set are converted into probe points in world space, and basic functions provided by the baker are utilized to determine light receiving conditions of the probe points in the target probe set, so as to obtain spherical harmonic base coefficients of the probe points in the target probe set, and obtain spherical harmonic base coefficients of each probe point in the target probe set; in addition, in the case that the target virtual terrain sub-block is one of a plurality of terrain sub-blocks in the target scene, in order to improve the data processing efficiency, probe points of all terrain sub-blocks in the target scene may be transferred to the roaster;
Optionally, in this embodiment, since the probe points in the target probe point set are probe points under a single topographic sub-block space, if the target virtual topographic sub-block is one of several topographic sub-blocks in the target scene, the probe points under the single topographic sub-block space do not relate to the probe points under other topographic sub-block spaces, and when all the topographic sub-blocks in the target scene are baked, an abnormal situation may occur in which the probe points in the target probe point set are located inside the other topographic sub-blocks, and the probe points under the abnormal situation belong to ineffective probe points;
further to the abnormal situation, the recording may be performed, but not limited to, on target data of probe points in a set of target probe points, wherein the target data includes at least one of: the nearest distance from the probe point to the target virtual terrain sub-block and other probe points which can be associated with the probe point; when baking, if a certain probe point is invalid due to the abnormal condition, firstly, searching for another effective probe point in the nearest distance range; if not, a weighted average is performed by traversing all associable and practically valid probe points (inversely proportional to the square of the distance).
It should be noted that, the virtual terrain generally does not need to display a finer object model, but is often displayed in the form of a distant object, and the distant object often has a higher repeatability, such as sand in desert terrain, vegetation in grassland terrain, and so on, so that at least the following characteristics exist in the virtual terrain: and the object to be rendered is repeatedly higher. And by utilizing the characteristics of the virtual terrain, a large number of probe points are combined through the difference degree, so that the calculated amount of spherical harmonic base coefficients of the probe points is reduced, and the technical effect of improving the illumination rendering efficiency of the virtual terrain is realized.
Further illustratively, as shown in fig. 4, optionally, a target virtual terrain sub-block 404 is determined from the target virtual terrain 402, and a candidate probe point set of the target virtual terrain sub-block 404 is obtained, where the probe points in the candidate probe point set are shown in fig. 4 (a), and are used for performing illumination rendering on the target virtual terrain sub-block 404; further as shown in fig. 4 (b), the probe points in the candidate probe point set are primarily screened, so that the probe points corresponding to the various vertexes in the target virtual terrain sub-block 404 are determined, and a first index relation set is obtained, wherein each index relation in the first index relation set represents the vertex and the probe point with corresponding relation; the spherical harmonic base coefficient of each probe point in the candidate probe point set is obtained, the difference degree of every two probe points in the candidate probe point set is determined according to the spherical harmonic base coefficient of each probe point, the probe points in the candidate probe point set are combined to obtain a target probe point set, the vertex with the corresponding relation in the first index relation set and the probe points before combination are modified to be the vertex with the corresponding relation and the probe points after combination, and a second index relation set is obtained, wherein the probe points in the second index relation set are shown in (c) in fig. 4.
According to the embodiment provided by the application, the candidate probe point set of the target virtual terrain sub-block is obtained, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual terrain sub-block; determining probe points corresponding to all the vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set, wherein each index relation in the first index relation set represents the vertexes and the probe points with corresponding relations; the method comprises the steps of obtaining spherical harmonic base coefficients of all probe points in a candidate probe point set, determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficients of all probe points, merging the probe points in the candidate probe point set to obtain a target probe point set, modifying vertexes with corresponding relations in the first index relation set and probe points before merging into vertexes with corresponding relations and probe points after merging to obtain a second index relation set, carrying out illumination rendering on target virtual topography sub-blocks according to the spherical harmonic base coefficients of all probe points in the target probe point set and the second index relation set, merging a large number of probe points according to the difference degree by utilizing the characteristic of high repeatability of virtual topography, and further achieving the purpose of reducing the calculation amount of the spherical harmonic base coefficients of the probe points, and accordingly achieving the technical effect of improving the illumination rendering efficiency of virtual topography.
As an alternative, according to the difference degree of every two probe points in the candidate probe point set, merging the probe points in the candidate probe point set to obtain a target probe point set, and modifying the vertex with a corresponding relationship in the first index relationship set and the probe point before merging into the vertex with a corresponding relationship and the probe point after merging to obtain a second index relationship set, including:
repeating the following steps until the number of probe points in the candidate probe point set is less than or equal to a preset number threshold, wherein the current probe point set is initialized to the candidate probe point set:
s1, determining two probe points to be combined according to the difference degree of every two probe points in a current probe point set, wherein the two probe points to be combined comprise a first current probe point and a second current probe point, and the first current probe point is the probe point to be combined to the second current probe point;
s2, deleting the first current probe point from the current probe point set, searching for the vertex with the corresponding relation with the first current probe point in the first index relation set, and modifying the corresponding relation of the searched vertex in the first index relation set from the corresponding relation with the first current probe point to the corresponding relation with the second current probe point.
Optionally, in this embodiment, to improve the efficiency of illumination rendering, the number of probe points in the candidate probe point set may be limited, or the number of probe points in the candidate probe point set may be limited to a smaller fixed value (a preset number threshold value), or a value below the fixed value.
It should be noted that, when the number of probe points in the candidate probe point set is greater than the preset number threshold, the merging process is continuously performed, if the result of the first merging process is that 10 probe points are obtained, but the preset number threshold is 5, the second merging process is performed based on the result of the first merging process (10 probe points); assuming that the result of the second merging process is 7 probe points, and the condition that the number of the probe points is smaller than or equal to the preset number threshold is still not satisfied, performing third merging process based on the result (7 probe points) of the second merging process; assuming that the result of the third merging processing is 5 probe points, and the condition that the number of the probe points is smaller than or equal to a preset number threshold is met, a target probe point set is obtained, and the vertex with the corresponding relation in the first index relation set and the probe points before merging are modified into the vertex with the corresponding relation and the probe points after merging, so that a second index relation set is obtained.
Further by way of example, an alternative, e.g., as shown in fig. 5, specific steps are as follows:
s502, acquiring a candidate probe point set of a target virtual terrain sub-block;
s504, determining probe points corresponding to all vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set;
s506, acquiring spherical harmonic basis coefficients of each probe point in the candidate probe point set, and determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic basis coefficients of each probe point;
s508, determining two probe points to be combined according to the difference degree of every two probe points in the current probe point set, wherein the two probe points to be combined comprise a first current probe point and a second current probe point, and the first current probe point is the probe point to be combined to the second current probe point;
s510, deleting a first current probe point from a current probe point set, searching for a vertex with a corresponding relation with the first current probe point in a first index relation set, and modifying the corresponding relation of the searched vertex in the first index relation set from the corresponding relation with the first current probe point to the corresponding relation with a second current probe point;
s512, judging whether the number of the probe points in the candidate probe point set is smaller than or equal to a preset number threshold, if yes, executing step S514, and if not, executing step S508, wherein the current probe point set is initialized to be the candidate probe point set;
S514, obtaining a target probe point set, and modifying the vertexes with the corresponding relation in the first index relation set and the probe points before combination into vertexes with the corresponding relation and the probe points after combination to obtain a second index relation set;
s516, performing illumination rendering on the target virtual terrain sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set.
By the embodiment provided by the application, the following steps are repeatedly executed until the number of the probe points in the candidate probe point set is smaller than or equal to a preset number threshold, wherein the current probe point set is initialized as the candidate probe point set: determining two probe points to be combined according to the difference degree of every two probe points in the current probe point set, wherein the two probe points to be combined comprise a first current probe point and a second current probe point, and the first current probe point is the probe point to be combined to the second current probe point; deleting the first current probe point from the current probe point set, searching for the vertex with the corresponding relation with the first current probe point from the first index relation set, and modifying the corresponding relation of the searched vertex in the first index relation set from the corresponding relation with the first current probe point to the corresponding relation with the second current probe point, thereby realizing the effect of improving the illumination rendering efficiency.
As an alternative, determining two probe points to be combined according to the difference degree of every two probe points in the current probe point set includes:
s1, determining two probe points with the smallest difference degree in a current probe point set, and determining the two probe points with the smallest difference degree as two probe points to be combined; or alternatively
S2, searching two probe points with the difference degree smaller than or equal to a preset difference degree threshold value in the current probe point set, and determining the two probe points with the difference degree smaller than or equal to the preset difference degree threshold value as two probe points to be combined under the condition that the two probe points with the difference degree smaller than or equal to the preset difference degree threshold value are searched.
Optionally, in this embodiment, the manner of selecting the two probe points to be combined may, but is not limited to, a manner of determining that the difference degree is minimum in the current probe point set, or a manner of searching for a difference degree less than or equal to a preset difference degree threshold in the current probe point set.
As an alternative, determining the degree of difference between every two probe points in the candidate probe point set according to the spherical harmonic basis coefficients of the probe points includes:
s1, executing the following steps on every two probe points in a candidate probe point set, wherein when executing the following steps, every two probe points comprise a third current probe point and a fourth current probe point, and the third current probe point is a probe point to be combined to the fourth current probe point:
S2, obtaining a target difference value obtained by subtracting the spherical harmonic basis coefficient of the third current probe point from the spherical harmonic basis coefficient of the fourth current probe point;
s3, determining the difference degree between the third current probe point and the fourth current probe point according to the target difference value.
Alternatively, in this embodiment, assuming that the third current probe point is the probe point a and the fourth current probe point is the probe point B, the target difference between the third current probe point and the fourth current probe point may be further calculated by referring to the following formula (1):
ΔSH l,m =SH l,m (B)-SH l,m (A) (1)
wherein SH l,m (A) And SH l,m (B) The spherical harmonic base coefficients of the probe point A and the probe point B are respectively, and the subscripts l and m are universal representations of the spherical harmonic base.
As an alternative, determining the difference between the third current probe point and the fourth current probe point according to the target difference value includes:
s1, acquiring a triangle set associated with a third current probe point, wherein a target virtual terrain sub-block is divided into a group of triangles, and the triangle set comprises triangles in which vertexes with corresponding relations with the third current probe point are positioned in the group of triangles;
s2, acquiring a normal vector of each triangle in the triangle set and a preset weight corresponding to each triangle;
s3, determining the difference degree between the third current probe point and the fourth current probe point according to the target difference value, the normal vector of each triangle and the preset weight corresponding to each triangle.
Optionally, in this embodiment, assuming that the third current probe point is a probe point a and the fourth current probe point is a probe point B, further on the basis of obtaining a target difference value between the probe point a and the probe point B, the following formula (2) is referred to calculate the degree of difference between the third current probe point and the fourth current probe point:
wherein SH l,m (A) And SH l,m (B) The spherical harmonic base coefficients of the probe point A and the probe point B are respectively, the subscripts l and m are universal representations of the spherical harmonic base, N is the number of triangles associated with the probe point A, and N i Is the normal vector (such as the direction vector of the normal) of the triangle associated with the probe point A, W i Is the weight;
alternatively, in the present embodiment described above, it is possible to employ, but not limited to, a third order spherical harmonic, so l is from 0 to 2. Since the areas of each triangle of terrain do not differ much, the effect of area can be, but is not limited to, ignored. The above formula (2) is a formula of a single color channel, and there are RGB 3 channels in practical application, so that an average value of the difference degrees of the three channels is also required. The formulas for the other channels may be, but are not limited to, the above formula (2).
As an alternative solution, determining the difference between the third current probe point and the fourth current probe point according to the target difference, the normal vector of each triangle, and the preset weight corresponding to each triangle includes:
S1, under the condition that a third current detection point is not located at the boundary of a target virtual terrain sub-block, determining the difference degree of the third current detection point and a fourth current detection point according to a target difference value, a normal vector of each triangle and a preset weight corresponding to each triangle through a preset difference degree function;
s2, under the condition that the third current probe point is located at the boundary of the target virtual terrain sub-block, determining the initial difference degree of the third current probe point and the fourth current probe point according to the target difference value, the normal vector of each triangle and the preset weight corresponding to each triangle through a preset difference degree function; and determining the difference degree of the third current probe point and the fourth current probe point to be equal to the product of the initial difference degree and a preset constant, wherein the preset constant is larger than 1.
Alternatively, in this embodiment, if the probe point combination is directly performed, it is likely that an abnormal phenomenon such as a seam will occur at the boundary between the target virtual terrain sub-block and other sub-blocks, and further, in order to make the boundary between the virtual terrain sub-blocks smooth, the difference may be corrected by, but not limited to, adopting the following formula (3) on the basis of the calculation of the difference by the formula (2):
ΔAB=ΔAB*C (3)
Wherein C may be, but is not limited to, a constant greater than 1.
It should be noted that, in order to make the condition of boundary fusion of the virtual terrain sub-blocks more severe, the initial difference is directly or indirectly corrected by a preset difference function.
Further by way of example, the effect of combining the probe points directly from the initial degree of difference may be seen in FIG. 6 (a), where the boundary seam between virtual terrain sub-block 602 and virtual terrain sub-block 604 is apparent; after the initial difference is directly or indirectly corrected by the preset difference function, the effect obtained by combining the probe points is that the boundary between the virtual topography sub-block 602 and the virtual topography sub-block 604 is smoother as shown in (b) of fig. 6.
According to the embodiment provided by the application, under the condition that the third current probe point is not positioned at the boundary of the target virtual terrain sub-block, determining the difference degree of the third current probe point and the fourth current probe point according to the target difference value, the normal vector of each triangle and the preset weight corresponding to each triangle through the preset difference degree function; under the condition that the third current probe point is located at the boundary of the target virtual terrain sub-block, determining the initial difference degree of the third current probe point and the fourth current probe point according to the target difference value, the normal vector of each triangle and the preset weight corresponding to each triangle through a preset difference degree function; and determining the difference degree of the third current probe point and the fourth current probe point to be equal to the product of the initial difference degree and a preset constant, wherein the preset constant is larger than 1, and the effect of improving the smoothness of the virtual terrain sub-block boundary is achieved.
As an alternative, according to the spherical harmonic base coefficient and the second index relation set of each probe point in the target probe point set, performing illumination rendering on the target virtual terrain sub-block, including:
s1, saving spherical harmonic basis coefficients of all probe points in a target probe point set as a target map;
s2, when the target virtual topography sub-block is required to be rendered, determining spherical harmonic basis coefficients of probe points corresponding to all vertexes in the target virtual topography sub-block from the target map according to the second index relation set;
s3, determining spherical harmonic base coefficients of all vertexes in the target virtual topography sub-block according to the spherical harmonic base coefficients of the probe points corresponding to all vertexes in the target virtual topography sub-block;
and S4, performing illumination rendering on the target virtual topography sub-block according to the spherical harmonic base coefficients of each vertex in the target virtual topography sub-block.
Optionally, in this embodiment, but not limited to, the probe points under the model space where the target virtual terrain sub-block is located are converted to the probe points under the target space, and the light receiving condition of each probe point is calculated by using the basic function provided by the roaster, so as to finally obtain the spherical harmonic coefficient of illumination; then, the spherical harmonic coefficients of all elements in the baked target virtual topography sub-block are saved as maps (the spherical harmonic coefficients of all elements are saved as one or more maps, or the spherical harmonic coefficients of one element are saved as one map, etc.); and when the method runs, according to the pre-stored index and weight data, sampling the spherical harmonic map, and performing dot product on the obtained coefficient and a basis function corresponding to the normal line to obtain illumination information, so as to complete illumination rendering on the target virtual topography sub-block.
Alternatively, in this embodiment, the spherical harmonic base coefficient may be, but not limited to, a spherical harmonic base coefficient including 3 stages, where the second order and third order coefficients of the spherical harmonic base coefficient may be, but not limited to, obtained by normalizing the first order coefficient;
further by way of example, the spherical harmonic basis coefficients of the optional 3-stage are shown in equation 702 in FIG. 7, wherein SH l,m The index is the spherical harmonic base coefficient, the subscripts L and m are the general representation of the spherical harmonic base, N is the number of triangles associated with the probe points, w (i) is the weight, for example, 4 pi, and L (i) is the incident illumination in a certain direction; as shown in equation 704 in fig. 7, the suffix portion of the spherical harmonic basis function is smaller than 1, so the spherical harmonic basis coefficients of higher orders (2 nd order and 3 rd order) can be normalized by the spherical harmonic basis coefficients of 1 st order.
Alternatively, in the present embodiment, in view of sampling efficiency, LOD, and integrating other functions, the data format of the spherical harmonic base coefficients may be encoded, but not limited to, in the following manner: the format of the first mapping can be, but not limited to, uint4, which is supported by hardware, so that the coding is convenient to carry out; further, for each group of spherical harmonic base coefficients, 2 pixels are usually required to be occupied, and then a low-order spherical harmonic base coefficient (a first spherical harmonic base sub-coefficient) and a high-order spherical harmonic base coefficient (a second spherical harmonic base sub-coefficient) are divided into two different pixels, so that lod can be conveniently performed, for example, a near object (a near virtual terrain sub-block) needs to perform complete and high-order spherical harmonic calculation, and a far object only needs to perform low-order spherical harmonic calculation, so that the sampling of the far object is only performed for 1 time; still further, but not limited to, splitting the higher order spherical harmonic basis coefficients into another map, so that the remote object only loads half of the map quantity;
Further illustratively, as optionally shown in fig. 8, the first spherical harmonic basis sub-coefficients 802 include 1 st and 2 nd order coefficients, the second spherical harmonic basis sub-coefficients 804 include 3 rd order coefficients, and further divide each order spherical harmonic basis coefficient of RGB 3 channels into two pixels of 16 bytes, such as dividing the first spherical harmonic basis sub-coefficient of RGB 3 channels into the first pixel 802 and dividing the second spherical harmonic basis sub-coefficient of RGB 3 channels into the second pixel 804;
specifically, for the first pixel 802, the storage space of 16 bytes is divided into three parts, the first part is 6 bytes, and is used for distributing 1-order spherical harmonic base coefficients of RGB 3 channels; a second part 9byte for distributing 2-order spherical harmonic basis coefficients of RGB 3 channels; the third part 1byte, which is reserved byte, can be used to store shadow data to realize a relatively coarse shadow effect based on the probe point;
furthermore, for the second pixel 804, the storage space of 16 bytes is divided into two parts, the first part is 15 bytes, and is used for distributing the 3-order spherical harmonic base coefficients of RGB 3 channels; the second part 1byte, used as reserved bytes, can be used to hold shadow data to achieve a relatively coarse shadow effect based on the probe point.
As an alternative, determining the spherical harmonic base coefficient of each vertex in the target virtual terrain sub-block according to the spherical harmonic base coefficient of the probe point corresponding to each vertex in the target virtual terrain sub-block includes:
Executing the following steps on each vertex in the target virtual terrain sub-block, wherein each vertex is the current vertex when executing the following steps:
s1, under the condition that a current vertex has a corresponding relation with one probe point in a target probe point set, determining a spherical harmonic basis coefficient of the current vertex as the spherical harmonic basis coefficient equal to the one probe point; or alternatively
S2, under the condition that the current vertex has a corresponding relation with a plurality of probe points in the target probe point set, determining the spherical harmonic basis coefficient of the current vertex as the weighted sum of the spherical harmonic basis coefficients of the plurality of probe points.
Optionally, in this embodiment, the present embodiment may be, but not limited to, distinguishing a case that the current vertex has a correspondence with one or more probe points in the target probe point set, and specifically determining a spherical harmonic basis coefficient of the current vertex as a spherical harmonic basis coefficient equal to one probe point in a case that the current vertex has a correspondence with one probe point in the target probe point set; in the case where the current vertex has a correspondence with a plurality of probe points in the set of target probe points, the spherical harmonic basis coefficient of the current vertex is determined to be equal to a weighted sum of the spherical harmonic basis coefficients of the plurality of probe points.
As an optional solution, determining, in the candidate probe point set, probe points corresponding to each vertex in the target virtual terrain sub-block, to obtain a first index relation set, including:
S1, searching a probe point closest to each vertex in a candidate probe point set, and recording each vertex and the corresponding searched probe point as an index relation in a first index relation set; or alternatively
S2, searching a plurality of probe points closest to each vertex in the candidate probe point set, setting corresponding weights for the plurality of probe points, and recording the weights corresponding to each vertex, the plurality of searched probe points and the plurality of probe points as index relations in the first index relation set.
Optionally, in this embodiment, the index and the weight of the relevant probe point may be added to the attribute of the vertex, for example, although the virtual terrain uses the virtual terrain sub-block as a structural unit, the coverage area of the virtual terrain sub-block is still generally larger, so that the attribute structure of the vertex is limited for lighting rendering to achieve both effect and efficiency, for example, if the attribute space of each vertex is assumed to be 32 bits (not fixed), in the 32bit attribute space, at least two attribute spaces of the probe point may be allocated, for example, an attribute space of a probe point A9bit is allocated, an attribute space of a probe point B9bit is allocated, and the remaining 14 bits are allocated, wherein 7 bits are used for allocating the weight, and then an attribute space of 7 bits is reserved for storing the shadow of the vertex; further reserving the shadows of the vertices is considered that the virtual terrain is usually an object terrain sub-block for rendering the distant view by illumination, so that the rendering effect obtained by the shadows generally meets the visual requirement of a user, the storage space is saved, the calculation amount of illumination rendering is reduced, the illumination rendering efficiency is further improved, the shadow effect is as shown in fig. 9, and in the rendering result of the target virtual terrain 902, the effect of the shadow 906 at the position where the object 904 is rendered is achieved.
Alternatively, in this embodiment, the weights corresponding to the plurality of probe points may be used to calculate a weighted sum of spherical harmonic basis coefficients of the plurality of probe points, but is not limited to.
It should be noted that, how to establish the index relationship between the vertex and the probe point may be, but not limited to, searching one probe point closest to each vertex in the candidate probe point set, and recording each vertex and the corresponding searched probe point as the index relationship in the first index relationship set; or searching a plurality of probe points closest to each vertex in the candidate probe point set, setting corresponding weights for the plurality of probe points, and recording the weights corresponding to each vertex, the plurality of searched probe points and the plurality of probe points as index relations in the first index relation set.
As an alternative, obtaining a candidate probe point set of the target virtual terrain sub-block includes:
s1, acquiring an original probe point set of a target virtual terrain sub-block, wherein the target virtual terrain sub-block is divided into a group of triangles, and the original probe point set comprises one or more probe points corresponding to each triangle in the group of triangles;
s2, filtering invalid probe points from the original probe point set to obtain a candidate probe point set.
Alternatively, in the present embodiment, the manner of filtering out invalid probe points may include, but is not limited to, filtering out probe points located in an invalid region of the target virtual terrain sub-block (such as an interior of the target virtual terrain sub-block, a backlight portion, etc.), filtering out probe points having a degree of association with the target virtual terrain sub-block lower than an effective threshold, and so on.
It should be noted that, the filtering of the probe points in the original probe point set can obtain a relatively high-quality probe point, which is more beneficial to the execution of subsequent illumination rendering.
Further by way of example, for an optional side cut of the target virtual terrain sub-block 1002, such as shown in fig. 10, for all candidate probe points of the target virtual terrain sub-block 1002, such as probe point e and probe point d, checking whether the candidate probe points are located inside the target virtual terrain sub-block 1002, where d is a probe point located outside the target virtual terrain sub-block 1002, and e is a probe point located inside the target virtual terrain sub-block 1002; in addition, illumination information for probe points within target virtual terrain sub-block 1002 is not valid and is also deleted from the candidate set of probe points.
According to the embodiment provided by the application, the original probe point set of the target virtual terrain sub-block is obtained, wherein the target virtual terrain sub-block is divided into a group of triangles, and the original probe point set comprises one or more probe points corresponding to each triangle in the group of triangles; invalid probe points are filtered from the original probe point set, a candidate probe point set is obtained, and the effect of improving the execution efficiency of illumination rendering is achieved.
As an alternative scheme, for the convenience of understanding, the illumination rendering method of the virtual terrain is applied to an illumination rendering scene of a 3D game, so that the game image quality performance and the sense of reality are improved, and meanwhile, a better effect is achieved on a model with a curved surface shape in space;
further by way of example, optionally as shown in fig. 11, the steps of the above-described illumination rendering method for virtual terrain applied in the illumination rendering scene of a 3D game are as follows:
step S1102, obtaining a terrain sub-block consisting of a plurality of triangles;
step S1104, generating all candidate probe points;
step S1106, invalid candidate probe points are removed, and the rest valid probe points are obtained;
step S1108-1, calculating indexes and weights of probe points associated with the terrain vertexes;
s1108-2, performing illumination calculation on all the probe points to obtain spherical harmonic base coefficients;
step S1110, combining probe combinations with differences less than a threshold
Step S1112, judging whether the number of the rest detection points is larger than a preset value, if yes, executing step S1114, otherwise, executing step S1116;
step S1114, find the probe point combination with the smallest difference, and combine;
step S1116, obtaining a final probe point list.
Optionally, in this embodiment, in the model space, a plurality of probe points are automatically calculated, where the color of each probe point in the model space may be, but not limited to, different, and the vertex color is the same as the associated maximum weighted probe point, and the vertex line segment may be, but not limited to, used to represent the normal direction; further according to the calculated probe points, calculating a plurality of probe points and weights associated with each vertex on the model, and storing the calculated probe point indexes and weights in model vertex data; furthermore, the scene is passed to a torrefaction, where the scene consists of several models, and multiple instances of the same model are possible. The method comprises the steps of converting a probe point in a model space into a world space, calculating the light receiving condition of the probe point by utilizing a basic function provided by a roaster, and finally obtaining the spherical harmonic coefficient of illumination;
alternatively, in the present embodiment, in the case where the spherical harmonic coefficients of all the baked virtual topography sub-blocks are saved as a map (all the spherical harmonic coefficients of the virtual topography sub-blocks are saved as one map, or one spherical harmonic coefficient of one virtual topography sub-block is saved as one map, or the spherical harmonic coefficients of a plurality of virtual topography sub-blocks are saved as a plurality of maps), as further shown in fig. 12, the spherical harmonic coefficients of the virtual topography sub-blocks 1202, 1204, and 1206 are saved as target maps 1208. Specifically, a certain compression algorithm is adopted to assemble coefficients into a plurality of posting graphs; and when the method is operated, according to the index and weight data stored by the vertexes, sampling the spherical harmonic map, and taking dot products of the obtained coefficients and the basis functions corresponding to the normals as illumination information.
It will be appreciated that in the specific embodiments of the present application, related data such as user information is involved, and when the above embodiments of the present application are applied to specific products or technologies, user permissions or consents need to be obtained, and the collection, use and processing of related data need to comply with related laws and regulations and standards of related countries and regions.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
According to another aspect of the embodiment of the present application, there is also provided an illumination rendering device for a virtual terrain for implementing the illumination rendering method for a virtual terrain. As shown in fig. 13, the apparatus includes:
a first obtaining unit 1302, configured to obtain a candidate probe point set of the target virtual terrain sub-block, where a probe point in the candidate probe point set is used to perform illumination rendering on the target virtual terrain sub-block;
A determining unit 1304, configured to determine probe points corresponding to each vertex in the target virtual terrain sub-block in the candidate probe point set, and obtain a first index relationship set, where each index relationship in the first index relationship set represents a vertex and a probe point that have a corresponding relationship;
a second obtaining unit 1306, configured to obtain spherical harmonic base coefficients of each probe point in the candidate probe point set, and determine a degree of difference between every two probe points in the candidate probe point set according to the spherical harmonic base coefficients of each probe point;
a merging unit 1308, configured to merge probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set, obtain a target probe point set, and modify a vertex with a corresponding relationship in the first index relationship set and a probe point before merging into a vertex with a corresponding relationship and a probe point after merging, so as to obtain a second index relationship set;
and the rendering unit 1310 is configured to perform illumination rendering on the target virtual terrain sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set.
Optionally, in this embodiment, the above-mentioned illumination rendering device for virtual terrain may be, but not limited to, applied to a terrain rendering scene in a three-dimensional (3D) game, and a pre-processing illumination rendering mode is proposed for a special object such as terrain, where the terrain has a very broad characteristic, its illumination data has very high repeatability in a relatively large range, and further, the good property of spherical harmonic illumination is utilized, and a smaller number of spherical harmonic coefficients are solved by means of difference degree comparison, so as to reduce the calculation amount in the illumination rendering process, and the object attached to the object surface may multiplex the above-mentioned illumination rendering mode, so as to further improve the illumination rendering efficiency.
Alternatively, in this embodiment, the target virtual terrain sub-block may be, but is not limited to, any one of a plurality of sub-blocks understood as the target virtual terrain, where the target virtual terrain may be, but is not limited to, a whole in appearance, but is divided into a plurality of small blocks structures during logic processing and rendering, the plurality of small blocks structures may be, but is not limited to, a plurality of sub-blocks understood as the target virtual terrain, and the plurality of sub-blocks may be, but is not limited to, parallel or linear implementation of illumination rendering by the illumination rendering device of the virtual terrain to implement whole illumination rendering of the target virtual terrain; in addition, the shape of the target virtual terrain sub-block may be, but is not limited to, triangular, rectangular, circular, trapezoidal, or polygonal, without limitation.
Optionally, in this embodiment, the probe point may be, but is not limited to, a three-dimensional space point that is understood to be a space for collecting illumination information, and is further used for illumination rendering of the target virtual terrain sub-block.
Optionally, in this embodiment, the target virtual terrain sub-block may be, but not limited to being, divided into a plurality of triangles for processing, and each triangle may be, but not limited to, a corresponding plurality of vertices, where one vertex may be, but not limited to, associated with a plurality of probe points, and one probe point may be, but not limited to, associated with a plurality of vertices; the process of obtaining the candidate probe point set of the target virtual terrain sub-block can be also understood as, but is not limited to, obtaining the candidate probe point of each triangle into which the target virtual terrain sub-block is divided;
Furthermore, in this embodiment, the areas of the triangles into which the target virtual terrain sub-block is divided may be different, and the acquisition manners of the candidate probe points of the triangles may be different for different areas, for example, in view of improving performance, the candidate probe points with areas smaller than or equal to the target threshold may be generated, but not limited to, a first number of candidate probe points (for example, candidate probe points obtained by offsetting the centroid of the triangle in the normal direction of the triangle) may be generated, and the triangles with areas larger than the target threshold may be generated, but not limited to, a second number of candidate probe points, where the second number is larger than the first number.
Optionally, in this embodiment, the manner of determining the probe points corresponding to each vertex in the target virtual terrain sub-block in the candidate probe point set may, but is not limited to, acquiring all the probe points corresponding to each vertex in the target virtual terrain sub-block from the candidate probe point set, or in the case that all the probe points are acquired, screening all the probe points to obtain a part of the probe points, thereby providing a better probe point for the subsequent illumination rendering operation, so as to improve the overall efficiency of illumination rendering, where the screening manner may, but is not limited to, include random screening, conditional screening, and the like;
Further by way of example, optionally, for example, 10 probe points (all probe points) have been obtained, and target probe points having a compactness reaching a target threshold are screened out from the 10 probe points, wherein the compactness may be, but is not limited to, the compactness of the correspondence between the probe points and the vertices.
Alternatively, in this embodiment, the spherical harmonic basis coefficients may be, but are not limited to, coefficients of a basis function in spherical harmonic illumination, or may be, but are not limited to, understood as sampling illumination into N coefficients, and then restoring the sampled illumination with the spherical harmonic basis coefficients at the time of rendering, so as to complete rendering.
Alternatively, in this embodiment, the difference between every two probe points may be understood as, but not limited to, the difference between every two probe points, for example, the spherical harmonic base coefficient of probe point a is A1, and the spherical harmonic base coefficient of probe point B is B1, and the difference between probe point a and probe point B may be understood as, but not limited to, |a1-b1|; the difference degree of every two probe points can be understood as the difference degree of target parameters corresponding to the spherical harmonic basis coefficients of every two probe points, for example, the spherical harmonic basis coefficient of the probe point a is A1, the spatial position parameter of the probe point a is A2, the target parameter of the probe point a is a1×a2, the spherical harmonic basis coefficient of the probe point B is B1, the spatial position parameter of the probe point B (which can be understood as spatial position information on a target virtual topography sub-block) is B2, and the target parameter of the probe point B is b1×b2, where the difference degree of the probe point a and the probe point B can be understood as |a1×a2-b1×b2|, the target parameter can be any parameter related to the spherical harmonic basis coefficient immediately, or calculated by the spherical harmonic basis coefficient, and the spatial position parameter is only a distance illustration and is not limited.
Optionally, in this embodiment, the manner of merging the probe points in the candidate probe point set may, but is not limited to, merging at least two probe points into at least one probe point, where the at least two probe points may, but are not limited to, not include the at least one probe point, for example, merging the probe point a and the probe point B (at least two probe points) into the probe point C (at least one probe point), and modifying the index relationship (the index relationship in the first index relationship set) of the probe point a and the probe point B to the probe point C, or the probe point C has the index relationship of the probe point a and the probe point B; or, the at least two probe points may include, but are not limited to, the at least one probe point, for example, the probe point a and the probe point B (at least two probe points) are combined into the probe point a (at least one probe point), and the index relationship (the index relationship in the first index relationship set) of the probe point B is modified to the probe point a, or the probe point a has both the original index relationship of the probe point a and the index relationship of the probe point B.
Optionally, in this embodiment, the illumination rendering is performed on the target virtual terrain sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and a second index relation set, where the index relation in the second index relation set may, but is not limited to, be used to determine an index (corresponding) relation between each probe point in the target probe point set and each vertex in the target virtual terrain sub-block, and render, based on the index relation, each corresponding vertex using the spherical harmonic base coefficient of each probe point.
Optionally, in this embodiment, after the target probe set is obtained, the probe points in the target probe set are transferred to a baker for baking, where the probe points in the target probe set are converted into probe points in world space, and basic functions provided by the baker are utilized to determine light receiving conditions of the probe points in the target probe set, so as to obtain spherical harmonic base coefficients of the probe points in the target probe set, and obtain spherical harmonic base coefficients of each probe point in the target probe set; in addition, in the case that the target virtual terrain sub-block is one of a plurality of terrain sub-blocks in the target scene, in order to improve the data processing efficiency, probe points of all terrain sub-blocks in the target scene may be transferred to the roaster;
optionally, in this embodiment, since the probe points in the target probe point set are probe points under a single topographic sub-block space, if the target virtual topographic sub-block is one of several topographic sub-blocks in the target scene, the probe points under the single topographic sub-block space do not relate to the probe points under other topographic sub-block spaces, and when all the topographic sub-blocks in the target scene are baked, an abnormal situation may occur in which the probe points in the target probe point set are located inside the other topographic sub-blocks, and the probe points under the abnormal situation belong to ineffective probe points;
Further to the abnormal situation, the recording may be performed, but not limited to, on target data of probe points in a set of target probe points, wherein the target data includes at least one of: the nearest distance from the probe point to the target virtual terrain sub-block and other probe points which can be associated with the probe point; when baking, if a certain probe point is invalid due to the abnormal condition, firstly, searching for another effective probe point in the nearest distance range; if not, a weighted average is performed by traversing all associable and practically valid probe points (inversely proportional to the square of the distance).
It should be noted that, the virtual terrain generally does not need to display a finer object model, but is often displayed in the form of a distant object, and the distant object often has a higher repeatability, such as sand in desert terrain, vegetation in grassland terrain, and so on, so that at least the following characteristics exist in the virtual terrain: and the object to be rendered is repeatedly higher. And by utilizing the characteristics of the virtual terrain, a large number of probe points are combined through the difference degree, so that the calculated amount of spherical harmonic base coefficients of the probe points is reduced, and the technical effect of improving the illumination rendering efficiency of the virtual terrain is realized.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
According to the embodiment provided by the application, the candidate probe point set of the target virtual terrain sub-block is obtained, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual terrain sub-block; determining probe points corresponding to all the vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set, wherein each index relation in the first index relation set represents the vertexes and the probe points with corresponding relations; the method comprises the steps of obtaining spherical harmonic base coefficients of all probe points in a candidate probe point set, determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficients of all probe points, merging the probe points in the candidate probe point set to obtain a target probe point set, modifying vertexes with corresponding relations in the first index relation set and probe points before merging into vertexes with corresponding relations and probe points after merging to obtain a second index relation set, carrying out illumination rendering on target virtual topography sub-blocks according to the spherical harmonic base coefficients of all probe points in the target probe point set and the second index relation set, merging a large number of probe points according to the difference degree by utilizing the characteristic of high repeatability of virtual topography, and further achieving the purpose of reducing the calculation amount of the spherical harmonic base coefficients of the probe points, and accordingly achieving the technical effect of improving the illumination rendering efficiency of virtual topography.
As an alternative, the merging unit 1308 includes:
the repeating module is used for repeatedly executing the following steps until the number of the probe points in the candidate probe point set is smaller than or equal to a preset number threshold value, wherein the current probe point set is initialized to be the candidate probe point set:
the first determining module is used for determining two probe points to be combined according to the difference degree of every two probe points in the current probe point set, wherein the two probe points to be combined comprise a first current probe point and a second current probe point, and the first current probe point is the probe point to be combined to the second current probe point;
the searching module is used for deleting the first current probe point from the current probe point set, searching the vertex with the corresponding relation with the first current probe point in the first index relation set, and modifying the corresponding relation of the searched vertex in the first index relation set from the corresponding relation with the first current probe point to the corresponding relation with the second current probe point.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
As an alternative, the first determining module includes:
the first determining submodule is used for determining two probe points with the smallest difference degree in the current probe point set, and determining the two probe points with the smallest difference degree as two probe points to be combined; or alternatively
The second determining submodule is used for searching two probe points with the difference degree smaller than or equal to a preset difference degree threshold value in the current probe point set, and determining the two probe points with the difference degree smaller than or equal to the preset difference degree threshold value as the two probe points to be combined under the condition that the two probe points with the difference degree smaller than or equal to the preset difference degree threshold value are searched.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
As an alternative, the determining unit 1304 includes:
the execution module is used for executing the following steps on every two probe points in the candidate probe point set, wherein when the following steps are executed, every two probe points comprise a third current probe point and a fourth current probe point, and the third current probe point is a probe point to be combined to the fourth current probe point:
the first acquisition module is used for acquiring a target difference value obtained by subtracting the spherical harmonic basis coefficient of the third current probe point from the spherical harmonic basis coefficient of the fourth current probe point;
the second determining module is used for determining the difference degree between the third current probe point and the fourth current probe point according to the target difference value.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
As an alternative, the second determining module includes:
the first acquisition sub-module is used for acquiring a triangle set associated with a third current probe point, wherein the target virtual terrain sub-block is divided into a group of triangles, and the triangle set comprises triangles in which vertexes with corresponding relations with the third current probe point are positioned in the group of triangles;
the second acquisition submodule is used for acquiring the normal vector of each triangle in the triangle set and the preset weight corresponding to each triangle;
and the third determining submodule is used for determining the difference degree between the third current probe point and the fourth current probe point according to the target difference value, the normal vector of each triangle and the preset weight corresponding to each triangle.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
As an alternative, the third determining sub-module includes:
the first determining subunit is configured to determine, according to a preset difference function and a target difference value, a normal vector of each triangle, and a preset weight corresponding to each triangle, a difference between the third current probe point and the fourth current probe point when the third current probe point is not located at a boundary of the target virtual terrain sub-block;
The second determining subunit is configured to determine, according to a preset difference function and a target difference value, a normal vector of each triangle, and a preset weight corresponding to each triangle, an initial difference between the third current probe point and the fourth current probe point when the third current probe point is located at a boundary of the target virtual terrain sub-block; and the third determining subunit is used for determining the difference degree of the third current probe point and the fourth current probe point to be equal to the product of the initial difference degree and a preset constant, wherein the preset constant is larger than 1.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
As an alternative, the rendering unit 1310 includes:
the storage module is used for storing the spherical harmonic basis coefficients of all the probe points in the target probe point set as a target map;
the third determining module is used for determining spherical harmonic base coefficients of probe points corresponding to all vertexes in the target virtual topography sub-block according to the second index relation set when the target virtual topography sub-block is required to be rendered;
the fourth determining module is used for determining the spherical harmonic base coefficient of each vertex in the target virtual topography sub-block according to the spherical harmonic base coefficient of the probe point corresponding to each vertex in the target virtual topography sub-block;
And the rendering module is used for carrying out illumination rendering on the target virtual terrain sub-block according to the spherical harmonic base coefficients of each vertex in the target virtual terrain sub-block.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
As an alternative, the fourth determining module includes:
the execution sub-module is used for executing the following steps on each vertex in the target virtual terrain sub-block, wherein each vertex is the current vertex when the following steps are executed:
a fourth determining submodule, configured to determine, under a condition that the current vertex has a correspondence with one probe point in the target probe point set, a spherical harmonic basis coefficient of the current vertex to be equal to the spherical harmonic basis coefficient of the one probe point; or alternatively
And a fifth determining sub-module, configured to determine, in a case where the current vertex has a correspondence relationship with a plurality of probe points in the target set of probe points, a spherical harmonic basis coefficient of the current vertex as a weighted sum of spherical harmonic basis coefficients of the plurality of probe points.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
As an alternative, the determining unit 1304 includes:
The first recording module is used for searching one probe point closest to each vertex in the candidate probe point set, and recording each vertex and the corresponding searched probe point as an index relation in the first index relation set; or alternatively
The second recording module is used for searching a plurality of probe points closest to each vertex in the candidate probe point set, setting corresponding weights for the plurality of probe points, and recording the weights corresponding to each vertex, the plurality of searched probe points and the plurality of probe points as index relations in the first index relation set.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
As an alternative, the first obtaining unit 1302 includes:
the second acquisition module is used for acquiring an original probe point set of the target virtual terrain sub-block, wherein the target virtual terrain sub-block is divided into a group of triangles, and the original probe point set comprises one or more probe points corresponding to each triangle in the group of triangles;
and the third acquisition module is used for filtering invalid probe points from the original probe point set to obtain a candidate probe point set.
Specific embodiments may refer to examples shown in the above-mentioned illumination rendering method of virtual terrain, and this example will not be described herein.
According to a further aspect of embodiments of the present application there is also provided an electronic device for implementing the above-described method of illumination rendering of a virtual terrain, as shown in fig. 14, the electronic device comprising a memory 1402 and a processor 1404, the memory 1402 having stored therein a computer program, the processor 1404 being arranged to perform the steps of any of the method embodiments described above by means of the computer program.
Alternatively, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, acquiring a candidate probe point set of a target virtual terrain sub-block, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual terrain sub-block;
s2, determining probe points corresponding to all the vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set, wherein each index relation in the first index relation set represents the vertexes and the probe points with corresponding relations;
S3, acquiring spherical harmonic base coefficients of each probe point in the candidate probe point set, and determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficients of each probe point;
s4, combining the probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set to obtain a target probe point set, and modifying the vertex with the corresponding relation in the first index relation set and the probe point before combination into the vertex with the corresponding relation and the probe point after combination to obtain a second index relation set;
and S5, carrying out illumination rendering on the target virtual topography sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set.
Alternatively, it will be understood by those skilled in the art that the structure shown in fig. 14 is only schematic, and the electronic device may also be a terminal device such as a smart phone (e.g. an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, and a mobile internet device (Mobile Internet Devices, MID), a PAD, etc. Fig. 14 is not limited to the structure of the electronic device described above. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 14, or have a different configuration than shown in FIG. 14.
The memory 1402 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for rendering the virtual terrain in the embodiment of the present application, and the processor 1404 executes the software programs and modules stored in the memory 1402 to perform various functional applications and data processing, that is, to implement the method for rendering the virtual terrain. Memory 1402 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 1402 may further include memory located remotely from processor 1404, which may be connected to the terminal through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. Wherein the memory 1402 may be specifically but not limited to for storing a candidate set of probe points, a first set of index relationships, and a second set of index relationships. As an example, as shown in fig. 14, the memory 1402 may include, but is not limited to, a first obtaining unit 1302, a determining unit 1304, a second obtaining unit 1306, a merging unit 1308, and a rendering unit 1314 in the lighting rendering device including the virtual terrain. In addition, other module units in the illumination rendering device of the virtual terrain may be further included, but are not limited to, and are not described in detail in this example.
Optionally, the transmission device 1406 is used to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 1406 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, the transmission device 1406 is a Radio Frequency (RF) module that is used to communicate wirelessly with the internet.
In addition, the electronic device further includes: a display 1408 for displaying the candidate probe point set, the first index relation set, and the second index relation set; and a connection bus 1410 for connecting the respective module parts in the above-described electronic device.
In other embodiments, the terminal device or the server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the plurality of nodes through a network communication. Among them, the nodes may form a Peer-To-Peer (P2P) network, and any type of computing device, such as a server, a terminal, etc., may become a node in the blockchain system by joining the Peer-To-Peer network.
According to one aspect of the present application, there is provided a computer program product comprising a computer program/instruction containing program code for executing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via a communication portion, and/or installed from a removable medium. When executed by a central processing unit, performs various functions provided by embodiments of the present application.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
It should be noted that the computer system of the electronic device is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
The computer system includes a central processing unit (Central Processing Unit, CPU) which can execute various appropriate actions and processes according to a program stored in a Read-Only Memory (ROM) or a program loaded from a storage section into a random access Memory (Random Access Memory, RAM). In the random access memory, various programs and data required for the system operation are also stored. The CPU, the ROM and the RAM are connected to each other by bus. An Input/Output interface (i.e., I/O interface) is also connected to the bus.
The following components are connected to the input/output interface: an input section including a keyboard, a mouse, etc.; an output section including a Cathode Ray Tube (CRT), a liquid crystal display (Liquid Crystal Display, LCD), and the like, and a speaker, and the like; a storage section including a hard disk or the like; and a communication section including a network interface card such as a local area network card, a modem, and the like. The communication section performs communication processing via a network such as the internet. The drive is also connected to the input/output interface as needed. Removable media such as magnetic disks, optical disks, magneto-optical disks, semiconductor memories, and the like are mounted on the drive as needed so that a computer program read therefrom is mounted into the storage section as needed.
In particular, the processes described in the various method flowcharts may be implemented as computer software programs according to embodiments of the application. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such embodiments, the computer program may be downloaded and installed from a network via a communication portion, and/or installed from a removable medium. The computer program, when executed by a central processing unit, performs the various functions defined in the system of the application.
According to one aspect of the present application, there is provided a computer-readable storage medium, from which a processor of a computer device reads the computer instructions, the processor executing the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.
Alternatively, in the present embodiment, the above-described computer-readable storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring a candidate probe point set of a target virtual terrain sub-block, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual terrain sub-block;
s2, determining probe points corresponding to all the vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set, wherein each index relation in the first index relation set represents the vertexes and the probe points with corresponding relations;
s3, acquiring spherical harmonic base coefficients of each probe point in the candidate probe point set, and determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficients of each probe point;
s4, combining the probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set to obtain a target probe point set, and modifying the vertex with the corresponding relation in the first index relation set and the probe point before combination into the vertex with the corresponding relation and the probe point after combination to obtain a second index relation set;
And S5, carrying out illumination rendering on the target virtual topography sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided by the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application, which are intended to be comprehended within the scope of the present application.
Claims (14)
1. An illumination rendering method of virtual terrain, comprising:
acquiring a candidate probe point set of a target virtual terrain sub-block, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual terrain sub-block;
determining probe points corresponding to all the vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set, wherein each index relation in the first index relation set represents the vertexes and the probe points with corresponding relations;
Acquiring spherical harmonic base coefficients of each probe point in the candidate probe point set, and determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficients of each probe point;
combining the probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set to obtain a target probe point set, and modifying the vertex with a corresponding relation in the first index relation set and the probe point before combination into the vertex with the corresponding relation and the probe point after combination to obtain a second index relation set;
and carrying out illumination rendering on the target virtual terrain sub-block according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set.
2. The method of claim 1, wherein the merging the probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set to obtain a target probe point set, and modifying the vertex with the corresponding relation in the first index relation set and the probe point before merging into the vertex with the corresponding relation and the probe point after merging to obtain a second index relation set, includes:
Repeating the following steps until the number of the probe points in the candidate probe point set is less than or equal to a preset number threshold, wherein the current probe point set is initialized to the candidate probe point set:
determining two probe points to be combined according to the difference degree of every two probe points in the current probe point set, wherein the two probe points to be combined comprise a first current probe point and a second current probe point, and the first current probe point is a probe point to be combined to the second current probe point;
deleting the first current probe point from the current probe point set, searching for a vertex with a corresponding relation with the first current probe point in the first index relation set, and modifying the corresponding relation of the searched vertex in the first index relation set from the corresponding relation with the first current probe point to the corresponding relation with the second current probe point.
3. The method according to claim 2, wherein the determining two probe points to be combined according to the degree of difference of each two probe points in the current probe point set comprises:
determining two probe points with the smallest difference degree in the current probe point set, and determining the two probe points with the smallest difference degree as the two probe points to be combined; or alternatively
Searching for two probe points with the difference degree smaller than or equal to a preset difference degree threshold value in the current probe point set, and determining the two probe points with the difference degree smaller than or equal to the preset difference degree threshold value as the two probe points to be combined under the condition that the two probe points with the difference degree smaller than or equal to the preset difference degree threshold value are searched for.
4. The method of claim 1, wherein said determining a degree of difference for each two probe points in the set of candidate probe points based on the spherical harmonic basis coefficients of the respective probe points comprises:
the following steps are performed for every two probe points in the candidate probe point set, wherein when the following steps are performed, every two probe points comprise a third current probe point and a fourth current probe point, and the third current probe point is a probe point to be combined to the fourth current probe point:
obtaining a target difference value obtained by subtracting the spherical harmonic basis coefficient of the third current probe point from the spherical harmonic basis coefficient of the fourth current probe point;
and determining the difference degree between the third current probe point and the fourth current probe point according to the target difference value.
5. The method of claim 4, wherein determining the degree of difference between the third current probe point and the fourth current probe point based on the target difference value comprises:
Acquiring a triangle set associated with the third current probe point, wherein the target virtual terrain sub-block is divided into a group of triangles, and the triangle set comprises triangles in which vertexes with a corresponding relation with the third current probe point are positioned in the group of triangles;
acquiring a normal vector of each triangle in the triangle set and a preset weight corresponding to each triangle;
and determining the difference degree between the third current probe point and the fourth current probe point according to the target difference value, the normal vector of each triangle and the preset weight corresponding to each triangle.
6. The method of claim 5, wherein determining the degree of difference between the third current probe point and the fourth current probe point according to the target difference, the normal vector of each triangle, and the preset weight corresponding to each triangle comprises:
under the condition that the third current detection point is not located at the boundary of the target virtual terrain sub-block, determining the difference degree of the third current detection point and the fourth current detection point according to the target difference value, the normal vector of each triangle and the preset weight corresponding to each triangle through a preset difference degree function;
Under the condition that the third current detection point is located at the boundary of the target virtual terrain sub-block, determining the initial difference degree of the third current detection point and the fourth current detection point according to the target difference value, the normal vector of each triangle and the preset weight corresponding to each triangle through a preset difference degree function; and determining the difference degree of the third current probe point and the fourth current probe point to be equal to the product of the initial difference degree and a preset constant, wherein the preset constant is larger than 1.
7. The method of claim 1, wherein the illuminating the target virtual terrain sub-block according to the spherical harmonic basis coefficients of each probe point in the target set of probe points and the second set of index relationships comprises:
the spherical harmonic basis coefficients of all the probe points in the target probe point set are stored as target mapping;
when the target virtual topography sub-block is required to be rendered, according to the second index relation set, determining spherical harmonic basis coefficients of probe points corresponding to all vertexes in the target virtual topography sub-block from the target map;
determining spherical harmonic base coefficients of all vertexes in the target virtual topography sub-block according to the spherical harmonic base coefficients of the probe points corresponding to all vertexes in the target virtual topography sub-block;
And carrying out illumination rendering on the target virtual terrain sub-block according to the spherical harmonic base coefficients of each vertex in the target virtual terrain sub-block.
8. The method of claim 7, wherein determining the spherical harmonic base coefficients for each vertex in the target virtual terrain sub-block from the spherical harmonic base coefficients for the probe points corresponding to each vertex in the target virtual terrain sub-block comprises:
executing the following steps on each vertex in the target virtual terrain sub-block, wherein when the following steps are executed, each vertex is a current vertex:
under the condition that the current vertex has a corresponding relation with one probe point in the target probe point set, determining the spherical harmonic base coefficient of the current vertex to be equal to the spherical harmonic base coefficient of the one probe point; or alternatively
And under the condition that the current vertex has a corresponding relation with a plurality of probe points in the target probe point set, determining the spherical harmonic base coefficient of the current vertex as the weighted sum of the spherical harmonic base coefficients of the plurality of probe points.
9. The method according to any one of claims 1 to 8, wherein determining probe points corresponding to each vertex in the target virtual terrain sub-block in the candidate probe point set, to obtain a first index relation set, comprises:
Searching one probe point closest to each vertex in the candidate probe point set, and recording each vertex and the corresponding searched probe point as index relations in the first index relation set; or alternatively
Searching a plurality of probe points closest to each vertex in the candidate probe point set, setting corresponding weights for the plurality of probe points, and recording the weights corresponding to each vertex, the corresponding searched plurality of probe points and the plurality of probe points as index relations in the first index relation set.
10. The method according to any one of claims 1 to 8, wherein the acquiring the candidate set of probe points for the target virtual terrain sub-block comprises:
acquiring an original probe point set of the target virtual terrain sub-block, wherein the target virtual terrain sub-block is divided into a group of triangles, and the original probe point set comprises one or more probe points corresponding to each triangle in the group of triangles;
and filtering invalid probe points from the original probe point set to obtain the candidate probe point set.
11. An illumination rendering device for a virtual terrain, comprising:
The first acquisition unit is used for acquiring a candidate probe point set of a target virtual terrain sub-block, wherein the probe points in the candidate probe point set are used for carrying out illumination rendering on the target virtual terrain sub-block;
the determining unit is used for determining the probe points corresponding to the vertexes in the target virtual terrain subblock in the candidate probe point set to obtain a first index relation set, wherein each index relation in the first index relation set represents the vertexes and the probe points with corresponding relations;
the second acquisition unit is used for acquiring the spherical harmonic base coefficient of each probe point in the candidate probe point set and determining the difference degree of every two probe points in the candidate probe point set according to the spherical harmonic base coefficient of each probe point;
the merging unit is used for merging the probe points in the candidate probe point set according to the difference degree of every two probe points in the candidate probe point set to obtain a target probe point set, and modifying the vertex with a corresponding relation in the first index relation set and the probe point before merging into the vertex with the corresponding relation and the probe point after merging to obtain a second index relation set;
and the rendering unit is used for carrying out illumination rendering on the target virtual terrain subblock according to the spherical harmonic base coefficient of each probe point in the target probe point set and the second index relation set.
12. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program when run performs the method of any one of claims 1 to 10.
13. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the method as claimed in any one of claims 1 to 10.
14. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 10 by means of the computer program.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210344253.5A CN116934946A (en) | 2022-04-02 | 2022-04-02 | Illumination rendering method and device for virtual terrain, storage medium and electronic equipment |
PCT/CN2023/077124 WO2023185317A1 (en) | 2022-04-02 | 2023-02-20 | Light rendering method and apparatus for virtual terrain, and medium, device and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210344253.5A CN116934946A (en) | 2022-04-02 | 2022-04-02 | Illumination rendering method and device for virtual terrain, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116934946A true CN116934946A (en) | 2023-10-24 |
Family
ID=88199152
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210344253.5A Pending CN116934946A (en) | 2022-04-02 | 2022-04-02 | Illumination rendering method and device for virtual terrain, storage medium and electronic equipment |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN116934946A (en) |
WO (1) | WO2023185317A1 (en) |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105989624A (en) * | 2015-02-11 | 2016-10-05 | 华为技术有限公司 | Method used for drawing global illumination scene and apparatus thereof |
CA2944435C (en) * | 2016-10-04 | 2024-01-09 | Square Enix, Ltd. | Methods, systems and computer-readable media for diffuse global illumination using probes |
CN111744183B (en) * | 2020-07-02 | 2024-02-09 | 网易(杭州)网络有限公司 | Illumination sampling method and device in game and computer equipment |
EP4040397A1 (en) * | 2021-02-08 | 2022-08-10 | Reactive Reality AG | Method and computer program product for producing a 3d representation of an object |
CN113034657B (en) * | 2021-03-30 | 2022-04-22 | 完美世界(北京)软件科技发展有限公司 | Rendering method, device and equipment for illumination information in game scene |
-
2022
- 2022-04-02 CN CN202210344253.5A patent/CN116934946A/en active Pending
-
2023
- 2023-02-20 WO PCT/CN2023/077124 patent/WO2023185317A1/en unknown
Also Published As
Publication number | Publication date |
---|---|
WO2023185317A1 (en) | 2023-10-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106780736B (en) | Map data processing method and device and three-dimensional map generation method and device | |
KR101637871B1 (en) | Estimating depth from a single image | |
CN107358649B (en) | Processing method and device of terrain file | |
CN111145090A (en) | Point cloud attribute encoding method, point cloud attribute decoding method, point cloud attribute encoding equipment and point cloud attribute decoding equipment | |
CN110211218B (en) | Picture rendering method and device, storage medium and electronic device | |
EP2947630A1 (en) | Method for compressing coordinate data | |
CN108063946B (en) | Image encoding method and apparatus, storage medium, and electronic apparatus | |
CN114286172B (en) | Data processing method and device | |
CN115908679A (en) | Texture mapping method, device, equipment and storage medium | |
CN112675545A (en) | Method and device for displaying surface simulation picture, storage medium and electronic equipment | |
CN114598883A (en) | Point cloud attribute prediction method, encoder, decoder and storage medium | |
CN116934946A (en) | Illumination rendering method and device for virtual terrain, storage medium and electronic equipment | |
CN110264430B (en) | Video beautifying method and device and electronic equipment | |
CN113613011B (en) | Light field image compression method and device, electronic equipment and storage medium | |
CN111353007A (en) | Geographic element picking method, encoding method and device based on vector slice and electronic equipment | |
CN111754423B (en) | High-modulus GPU (graphics processing unit) skin smoothing method and device and electronic equipment | |
CN109189524A (en) | Image resource generation method and device | |
CN116934947A (en) | Illumination rendering method and device of virtual model, storage medium and electronic equipment | |
CN115086716A (en) | Method and device for selecting neighbor points in point cloud and coder/decoder | |
CN113435515A (en) | Picture identification method and device, storage medium and electronic equipment | |
CN110363860A (en) | 3D model reconstruction method, device and electronic equipment | |
US20240037799A1 (en) | Point cloud coding/decoding method and apparatus, device and storage medium | |
EP3998458A2 (en) | Method and apparatus for generating zebra crossing in high resolution map, and electronic device | |
WO2023097694A1 (en) | Decoding method, encoding method, decoder, and encoder | |
CN118227905A (en) | Point cloud data processing method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40098470 Country of ref document: HK |