CN113052950B - Illumination calculation method and device, computer equipment and computer readable storage medium - Google Patents

Illumination calculation method and device, computer equipment and computer readable storage medium Download PDF

Info

Publication number
CN113052950B
CN113052950B CN202110348460.3A CN202110348460A CN113052950B CN 113052950 B CN113052950 B CN 113052950B CN 202110348460 A CN202110348460 A CN 202110348460A CN 113052950 B CN113052950 B CN 113052950B
Authority
CN
China
Prior art keywords
light source
polyhedron
target
light sources
polyhedrons
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110348460.3A
Other languages
Chinese (zh)
Other versions
CN113052950A (en
Inventor
吕峻宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Perfect World Beijing Software Technology Development Co Ltd
Original Assignee
Perfect World Beijing Software Technology Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Perfect World Beijing Software Technology Development Co Ltd filed Critical Perfect World Beijing Software Technology Development Co Ltd
Priority to CN202110348460.3A priority Critical patent/CN113052950B/en
Publication of CN113052950A publication Critical patent/CN113052950A/en
Application granted granted Critical
Publication of CN113052950B publication Critical patent/CN113052950B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Abstract

The application discloses an illumination calculation method, an illumination calculation device, computer equipment and a computer readable storage medium, relates to the technical field of image processing, and is characterized in that a viewing cone of a target scene is divided to obtain a plurality of polyhedrons, a light source list is generated by judging the relative relation between the polyhedrons and light sources, then the light source list corresponding to the polyhedron where a fragment is located is used for calculation, and the fragment is subjected to illumination calculation by using the cut light sources, so that the calculation amount is reduced, the possibility of serious performance problems in a complex scene is greatly reduced, and the bandwidth pressure is relieved. The method comprises the following steps: dividing a viewing cone of a target scene in a preset dimension to obtain a plurality of polyhedrons; judging the relative relation between the polyhedrons and the light sources in the target scene, and generating a plurality of light source lists according to the judgment result; determining a target fragment, and inquiring a target polyhedron to which the target fragment belongs from a plurality of polyhedrons; and performing illumination calculation on the target fragment based on a target light source list corresponding to the target polyhedron.

Description

Illumination calculation method and device, computer equipment and computer readable storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an illumination calculation method, an illumination calculation apparatus, a computer device, and a computer-readable storage medium.
Background
In recent years, image processing technology is continuously developed, and requirements for image quality are higher and higher for users and developers, so that illumination calculation and illumination rendering based on environmental lighting have become key points in image processing in order to improve the quality of computer animation and enhance the sense of reality.
In the related art, when lighting rendering is performed, forward rendering is generally performed. In the conventional forward rendering, firstly, all objects to be rendered in a scene are determined, and any object is selected from the determined objects. And then, performing intersection judgment on the selected object and all lights in the scene, determining the lights needing to be calculated on the object, performing illumination calculation on the object based on the lights, and rendering the next object after the calculation is finished until the illumination calculation and the illumination rendering of all the objects are finished.
In carrying out the present application, the applicant has found that the related art has at least the following problems:
the object in the scene has a large size, and a large object may be influenced by a plurality of small light sources, so that all fragments of the object need to be calculated to the plurality of small light sources during calculation, even if the small light sources do not influence the fragments; even if a small object is affected by only one light source, multiple times of intersection operation need to be performed according to the fragments, so that a large amount of redundant calculation is caused, a serious performance problem is caused in a complex scene, and a large pressure is brought to a bandwidth.
Disclosure of Invention
In view of this, the present application provides an illumination calculation method, an illumination calculation apparatus, a computer device, and a computer readable storage medium, and mainly aims to solve the problem that a large amount of redundant calculations are currently performed, which causes a serious performance problem in a complex scene and puts a great pressure on a bandwidth.
According to a first aspect of the present application, there is provided an illumination calculation method, the method comprising:
dividing a viewing cone of a target scene in a preset dimension to obtain a plurality of polyhedrons;
judging the relative relation between the polyhedrons and the light sources in the target scene, and generating a plurality of light source lists according to the judgment result, wherein each light source list in the plurality of light source lists comprises the light source indexes and the light source quantity of the light sources influencing a single polyhedron or a polyhedron set;
determining a target fragment, and inquiring a target polyhedron to which the target fragment belongs in the plurality of polyhedrons, wherein the target fragment is any fragment to be rendered of any entity model in the target scene;
and performing illumination calculation on the target fragment based on a target light source list corresponding to the target polyhedron.
Optionally, the dividing the view frustum of the target scene in the preset dimension to obtain a plurality of polyhedrons includes:
acquiring the preset dimension and preset division parameters, and determining at least one coordinate direction indicated by the preset dimension and a corresponding sub-parameter of the at least one coordinate direction in the preset division parameters;
for each coordinate direction in the at least one coordinate direction, dividing the view frustum into the number of parts indicated by the sub-parameters corresponding to the coordinate direction in the coordinate direction;
and dividing the view frustum in the at least one coordinate direction according to the corresponding sub-parameters to obtain the plurality of polyhedrons.
Optionally, the determining a relative relationship between the plurality of polyhedrons and a plurality of light sources in the target scene, and generating a plurality of light source lists according to a determination result includes:
for each polyhedron in the plurality of polyhedrons, reading the relative relationship between each light source in the plurality of light sources and the polyhedron, judging whether the light beam of each light source in the plurality of light sources influences the polyhedron under the relative relationship, and outputting a judgment result corresponding to each light source;
determining at least one first light source in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the light beam of the first light source influences the polyhedron;
counting the number of the light sources of the at least one first light source, acquiring a light source index of the at least one first light source, and generating a light source list comprising the number of the light sources and the light source index;
repeatedly executing the above process, and respectively generating a light source list including light source indexes and light source numbers affecting light sources of the polyhedrons for each polyhedron to obtain a plurality of light source lists;
and performing association storage on the plurality of polyhedrons and the plurality of light source lists, wherein the association storage can be realized based on a two-layer list structure or a three-layer list structure.
Optionally, the reading a relative relationship between each of the plurality of light sources and the polyhedron, determining whether a light beam of each of the plurality of light sources affects the polyhedron in the relative relationship, and outputting a determination result corresponding to each light source includes:
for each light source in the plurality of light sources, reading the relative relationship between the light source and the polyhedron, and judging the relative relationship;
if the relative relationship indicates that the light beam of the light source is positioned on the inner side of any face of the plurality of faces of the polyhedron, judging and determining that the light source influences the polyhedron, outputting a judgment result for indicating that the light source influences the polyhedron, and continuously judging whether other light sources in the plurality of light sources influence the polyhedron under the corresponding relative relationship;
if the relative relationship indicates that the light beam of the light source is positioned on the outer side of any one of the plurality of faces, judging and determining that the light source does not influence the polyhedron, outputting a judgment result for indicating that the light source does not influence the polyhedron, and continuously judging whether other light sources in the plurality of light sources influence the polyhedron under the corresponding relative relationship;
wherein the inner side is one of two sides of the plane where the arbitrary surface is located in a vertical direction, where the other of the plurality of surfaces is present, and the outer side is the other of the two sides excluding the inner side.
Optionally, the reading the relative relationship between each of the plurality of light sources and the polyhedron comprises:
for each polyhedron of the plurality of polyhedrons, constructing a spherical bounding box for the polyhedron;
and reading the relative relation between each light source in the plurality of light sources and the spherical bounding box as the relative relation between each light source and the polyhedron according to the relative position between each light source in the plurality of light sources and the spherical bounding box.
Optionally, the determining a relative relationship between the plurality of polyhedrons and a plurality of light sources in the target scene, and generating a plurality of light source lists according to a determination result includes:
responding to a merging generation request, and acquiring the merging number indicated by the merging generation request;
combining the continuous polyhedrons with the number meeting the combined number in the plurality of polyhedrons according to the arrangement mode of the plurality of polyhedrons to obtain a plurality of polyhedron sets;
for each polyhedron set in the plurality of polyhedron sets, reading the relative relation between each light source in the plurality of light sources and the polyhedron set, judging whether each light source in the plurality of light sources influences the polyhedron set under the relative relation, and outputting a judgment result corresponding to each light source;
determining at least one first light source in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the first light source influences the polyhedron set;
counting the number of the light sources of the at least one first light source, acquiring a light source index of the at least one first light source, and generating a light source list comprising the number of the light sources and the light source index;
repeatedly executing the above process, and respectively generating a light source list including light source indexes and light source numbers affecting light sources of the polyhedron set for each polyhedron set to obtain a plurality of light source lists;
and performing association storage on the plurality of polyhedron sets and the plurality of light source lists, wherein the association storage can be realized based on a two-layer list structure or a three-layer list structure.
Optionally, the reading the relative relationship between each light source in the plurality of light sources and the set of polyhedrons includes:
for each polyhedron set in the plurality of polyhedron sets, constructing a spherical bounding box for the polyhedron set;
and reading the relative relation between each light source in the plurality of light sources and the spherical bounding box as the relative relation between each light source and the polyhedron set according to the relative position between each light source in the plurality of light sources and the spherical bounding box.
Optionally, the performing illumination calculation on the target fragment based on the target light source list corresponding to the target polyhedron includes:
inquiring a light source list bound by the target polyhedron;
responding to a query to determine that the target polyhedron has a bound light source list, taking the target polyhedron bound light source list as the target light source list, and performing illumination calculation on the target fragment by adopting the number of light sources and light source indexes included in the target light source list;
and responding to the query to determine that the target polyhedron does not have a bound light source list, determining a target polyhedron set where the target polyhedron is located, taking the light source list bound by the target polyhedron set as the target light source list, and performing illumination calculation on the target fragment by adopting the number of light sources and the light source index included in the target light source list.
In accordance with a second aspect of the present application, there is provided an illumination computing apparatus, the apparatus comprising:
the device comprises a dividing module, a judging module and a judging module, wherein the dividing module is used for dividing a cone of view of a target scene in a preset dimension to obtain a plurality of polyhedrons;
a generating module, configured to determine a relative relationship between the plurality of polyhedrons and a plurality of light sources in the target scene, and generate a plurality of light source lists according to a determination result, where each light source list in the plurality of light source lists includes a light source index and a light source number that affect a light source of a single polyhedron or a set of polyhedrons;
a query module, configured to determine a target fragment, and query a target polyhedron to which the target fragment belongs from the multiple polyhedrons, where the target fragment is any fragment to be rendered of any entity model in the target scene;
and the calculation module is used for carrying out illumination calculation on the target fragment based on the target light source list corresponding to the target polyhedron.
Optionally, the dividing module is configured to obtain the preset dimension and a preset dividing parameter, and determine at least one coordinate direction indicated by the preset dimension and a sub-parameter corresponding to the at least one coordinate direction in the preset dividing parameter; for each coordinate direction in the at least one coordinate direction, dividing the view frustum into the number of parts indicated by the sub-parameters corresponding to the coordinate direction in the coordinate direction; and dividing the view frustum in the at least one coordinate direction according to the corresponding sub-parameters to obtain the plurality of polyhedrons.
Optionally, the generating module is configured to, for each polyhedron of the plurality of polyhedrons, read a relative relationship between each light source of the plurality of light sources and the polyhedron, determine whether a light beam of each light source of the plurality of light sources affects the polyhedron under the relative relationship, and output a determination result corresponding to each light source; determining at least one first light source in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the light beam of the first light source influences the polyhedron; counting the number of the light sources of the at least one first light source, acquiring a light source index of the at least one first light source, and generating a light source list comprising the number of the light sources and the light source index; repeatedly executing the above process, and respectively generating a light source list including light source indexes and light source numbers affecting light sources of the polyhedrons for each polyhedron to obtain a plurality of light source lists; and performing association storage on the plurality of polyhedrons and the plurality of light source lists, wherein the association storage can be realized based on a two-layer list structure or a three-layer list structure.
Optionally, the generating module is configured to, for each light source in the plurality of light sources, read a relative relationship between the light source and the polyhedron, and determine the relative relationship; if the relative relationship indicates that the light beam of the light source is positioned on the inner side of any face of the plurality of faces of the polyhedron, judging and determining that the light source influences the polyhedron, outputting a judgment result for indicating that the light source influences the polyhedron, and continuously judging whether other light sources in the plurality of light sources influence the polyhedron under the corresponding relative relationship; if the relative relationship indicates that the light beam of the light source is positioned on the outer side of any one of the plurality of faces, judging and determining that the light source does not influence the polyhedron, outputting a judgment result for indicating that the light source does not influence the polyhedron, and continuously judging whether other light sources in the plurality of light sources influence the polyhedron under the corresponding relative relationship; wherein the inner side is one of two sides of the plane where the arbitrary surface is located in a vertical direction, where the other of the plurality of surfaces is present, and the outer side is the other of the two sides excluding the inner side.
Optionally, the generating module is configured to, for each polyhedron of the plurality of polyhedrons, construct a spherical bounding box for the polyhedron; and reading the relative relation between each light source in the plurality of light sources and the spherical bounding box as the relative relation between each light source and the polyhedron according to the relative position between each light source in the plurality of light sources and the spherical bounding box.
Optionally, the generating module is configured to, in response to a merge generation request, obtain a merge number indicated by the merge generation request; combining the continuous polyhedrons with the number meeting the combined number in the plurality of polyhedrons according to the arrangement mode of the plurality of polyhedrons to obtain a plurality of polyhedron sets; for each polyhedron set in the plurality of polyhedron sets, reading the relative relation between each light source in the plurality of light sources and the polyhedron set, judging whether each light source in the plurality of light sources influences the polyhedron set under the relative relation, and outputting a judgment result corresponding to each light source; determining at least one first light source in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the first light source influences the polyhedron set; counting the number of the light sources of the at least one first light source, acquiring a light source index of the at least one first light source, and generating a light source list comprising the number of the light sources and the light source index; repeatedly executing the above process, and respectively generating a light source list including light source indexes and light source numbers affecting light sources of the polyhedron set for each polyhedron set to obtain a plurality of light source lists; and performing association storage on the plurality of polyhedron sets and the plurality of light source lists, wherein the association storage can be realized based on a two-layer list structure or a three-layer list structure.
Optionally, the generating module is configured to, for each polyhedron set in the plurality of polyhedron sets, construct a spherical bounding box for the polyhedron set; and reading the relative relation between each light source in the plurality of light sources and the spherical bounding box as the relative relation between each light source and the polyhedron set according to the relative position between each light source in the plurality of light sources and the spherical bounding box.
Optionally, the calculation module is configured to query a light source list bound to the target polyhedron; responding to a query to determine that the target polyhedron has a bound light source list, taking the target polyhedron bound light source list as the target light source list, and performing illumination calculation on the target fragment by adopting the number of light sources and light source indexes included in the target light source list; and responding to the query to determine that the target polyhedron does not have a bound light source list, determining a target polyhedron set where the target polyhedron is located, taking the light source list bound by the target polyhedron set as the target light source list, and performing illumination calculation on the target fragment by adopting the number of light sources and the light source index included in the target light source list.
According to a third aspect of the present application, there is provided a computer device comprising a memory storing a computer program and a processor implementing the steps of any of the methods of the first aspect when the computer program is executed.
According to a fourth aspect of the present application, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of any of the first aspects described above.
By means of the technical scheme, the illumination calculation method, the illumination calculation device, the illumination calculation computer equipment and the computer readable storage medium are provided, the method divides a view frustum of a target scene in a preset dimension to obtain a plurality of polyhedrons, judges the relative relation between the polyhedrons and a light source in the scene, generates a light source list comprising light source indexes and light source numbers influencing the light source of a single polyhedron or a plurality of polyhedrons according to the judgment result, further performs illumination calculation on a fragment of an entity model by using the light source list corresponding to the polyhedron where the fragment is located, groups screen spaces of the scene in a mode of grouping adjacent pixels, cuts the light source in the scene according to the groups, performs illumination calculation on the fragment by using the cut light source, and avoids the light source which does not influence the fragment in the illumination calculation of the fragment, the calculation amount is reduced, the possibility of generating serious performance problems in a complex scene is greatly reduced, and the bandwidth pressure is relieved.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flowchart illustrating an illumination calculation method provided in an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating an illumination calculation method provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram illustrating an illumination computing apparatus provided in an embodiment of the present application;
fig. 4 shows a schematic device structure diagram of a computer apparatus according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The embodiment of the application provides an illumination calculation method, as shown in fig. 1, the method includes:
101. and dividing the view cones of the target scene in a preset dimension to obtain a plurality of polyhedrons.
102. And judging the relative relation between the plurality of polyhedrons and the plurality of light sources in the target scene, and generating a plurality of light source lists according to the judgment result, wherein each light source list in the plurality of light source lists comprises the light source indexes and the light source quantity of the light sources influencing a single polyhedron or a polyhedron set.
103. And determining a target fragment, and inquiring a target polyhedron to which the target fragment belongs from a plurality of polyhedrons, wherein the target fragment is any fragment to be rendered of any entity model in a target scene.
104. And performing illumination calculation on the target fragment based on a target light source list corresponding to the target polyhedron.
The method provided by the embodiment of the application comprises the steps of dividing a view cone of a target scene in a preset dimension to obtain a plurality of polyhedrons, judging the relative relation between the polyhedrons and a light source in the scene, generating a light source list comprising light source indexes and the number of the light sources influencing the light source of a single polyhedron or a plurality of polyhedrons according to a judgment result, further using the light source list corresponding to the polyhedron where the fragment is located to calculate when performing illumination calculation on the fragment of the entity model, grouping screen space of the scene by using a mode of adjacent pixel grouping, cutting the light source in the scene according to the grouping, performing illumination calculation on the fragment by using the cut light source, avoiding the light source which does not influence the fragment from being involved in the illumination calculation of the fragment, reducing the calculation amount, and greatly reducing the possibility of generating serious performance problems in a complex scene, and relieving bandwidth pressure.
An embodiment of the present application provides an illumination calculation method, as shown in fig. 2, the method includes:
201. and dividing the view cones of the target scene in a preset dimension to obtain a plurality of polyhedrons.
In the technical field of current image processing, forward rendering is a common illumination rendering mode, and is also called forward rendering, and each entity model to be drawn in a scene is intersected with a light source in the scene to determine the light source to be calculated when each entity model is rendered, so that each entity model is rendered respectively. However, the applicant recognizes that there are two disadvantages in the conventional forward rendering, one is that a larger entity model in a scene is affected by many small light sources, for example, the entity model a is affected by N (N is a positive integer) small light sources, and all fragments of the entity model a need to calculate the N small light sources during calculation, even if the fragment is not actually affected by one of the small light sources, which results in redundant calculation. The other is that the smaller entity models in the scene may be affected by only one large light source, but the small entity models need to be subjected to multiple intersection operations, and the complexity of the calculation is closely related to the complexity of the scene. These disadvantages are not obvious when the number of scene light sources is small, but can cause serious performance problems if the number of light sources is large.
At present, a delay rendering method can also be used for illumination calculation of the solid model, each light source needs to be rasterized in the delay rendering process to obtain fragments influenced by the light source in the solid model, and then illumination calculation is carried out on the fragments. The rendering mode has the advantages of being independent of the complexity of the scene and free of redundant calculation. However, the applicant recognizes that each illumination calculation in the delayed rendering requires reading and writing of a G-Buffer (geometric Buffer), which causes a large bandwidth pressure when the number of light sources is large, and the pressure is reflected in the performance of the terminal device.
Therefore, in order to decouple the complexity of illumination calculation from the complexity of a scene, solve the problem of redundant calculation, and alleviate bandwidth pressure, the present application provides an illumination calculation method, in which a view frustum indicating a screen space of a target scene is divided in a preset dimension to obtain a plurality of polyhedrons, a light source list including light source indexes and light source numbers affecting light sources of a single polyhedron or a set of polyhedrons is generated according to interaction conditions of the plurality of polyhedrons and the light sources in the scene, and further, when performing illumination calculation on a fragment of an entity model, a light source list corresponding to the polyhedron where the fragment is located is used for calculation, the screen spaces of the scene are grouped in a manner of adjacent pixel grouping, then the light sources in the scene are cut according to the grouping, the fragment is subjected to illumination calculation by using the cut light sources, and the light sources which do not affect the fragment are prevented from being involved in the illumination calculation of the fragment, the calculation amount is reduced, the possibility of generating serious performance problems in a complex scene is greatly reduced, and the bandwidth pressure is relieved.
In order to implement the method, firstly, the view frustum of the target scene needs to be divided in a preset dimension to obtain a plurality of polyhedrons. Because the view frustum indicates the screen space of the scene and can show the cone range visible in the scene, the division of the view frustum is actually to group the screen space of the scene by using a mode of adjacent pixel grouping, and a plurality of polyhedrons, namely three-dimensional space between two section planes of the view frustum, are obtained. Polyhedrons can be represented by Cluster, and are generally hexahedrons. The following describes a process of dividing the cone of view into polyhedrons:
firstly, acquiring a preset dimension and a preset division parameter, and determining at least one coordinate direction indicated by the preset dimension and a corresponding sub-parameter of the at least one coordinate direction in the preset division parameter. Wherein the predetermined dimension may be an X, Y, Z direction of the three-dimensional space, such that the indicated at least one coordinate direction is a X, Y, Z direction of the three-dimensional space. The preset division parameter comprises at least one sub-parameter corresponding to the coordinate direction, and the sub-parameter indicates the division number of the view frustum in the corresponding coordinate direction. For example, the preset partition parameter may be 32 × 16 × 32, and the sub-parameters included in the preset partition parameters 32, 16, and 32, where 32, 16, and 32 respectively indicate the number of copies cut into the view frustum in the direction X, Y, Z in the three-dimensional space. It should be noted that the preset partition parameter may actually be set according to the complexity of the scene, the calculation speed, or the granularity requirement, and the current preset partition parameter is assumed to be 32 × 16 × 32, and in order to improve the performance, the clipping accuracy may be properly sacrificed to reduce the preset partition parameter to 16 × 8 × 32.
And then, for each coordinate direction in at least one coordinate direction, dividing the view frustum into the number of copies indicated by the sub-parameters corresponding to the coordinate direction in the coordinate direction, repeatedly executing the dividing process, and dividing the view frustum according to the corresponding sub-parameters in at least one coordinate direction to obtain a plurality of polyhedrons. It should be noted that sometimes the preset dividing parameter may be only a specific value, for example, 32, so that the viewing cones are divided into 32 parts in the X, Y, Z direction. Sometimes, the preset partition parameter may be in the form of 32 × 16 × 32, and includes multiple sub-parameters, so that the partition is performed in the corresponding coordinate direction according to the sub-parameters. The numerical content indicated by the preset dividing parameter is not specifically limited.
202. And judging the relative relation between the plurality of polyhedrons and the plurality of light sources in the target scene, and generating a plurality of light source lists according to the judgment result.
In the embodiment of the application, since the adjacent pixels in the screen space are likely to be affected by the same light source, after a plurality of polyhedrons are obtained, the light source can be cut according to each polyhedron to obtain the light source list affecting the polyhedron, so that when illumination calculation is performed on a fragment of a certain solid model in the following process, the illumination calculation can be performed by directly using the light source list of the polyhedron where the fragment is located. It should be noted that, at present, there are some tools that can be used for animation authoring and operation, such as Unity (a real-time 3D interactive content authoring and operation platform), and therefore, in practice, a corresponding processing thread may be set for each polyhedron in a plurality of polyhedrons based on the tools, the processing threads corresponding to the polyhedrons may be operated, and further, based on the plurality of processing threads, the relative relationships between the plurality of polyhedrons and the plurality of light sources may be determined in parallel, and a light source list including light source indexes and the number of light sources that affect the light sources of the polyhedron may be generated for each polyhedron according to the determination result, so as to obtain a plurality of light source lists, and the following describes a specific logic process for generating the light source lists:
for each polyhedron in a plurality of polyhedrons, firstly, reading the relative relationship between each light source in a plurality of light sources and the polyhedron, judging whether the light beam of each light source in the plurality of light sources influences the polyhedron under the relative relationship, and outputting a judgment result corresponding to each light source. The polyhedron corresponds to the processing thread, so that the relative relation between each light source in the plurality of light sources and the polyhedron can be read based on the processing thread, the relative relation actually indicates whether the light source can intersect with the polyhedron, subsequently, the relative relation is judged, a judgment result is output, and whether the light beam generated by the light source can influence the polyhedron can be determined based on the judgment result. Specifically, for each of the plurality of light sources, reading a relative relationship between the light source and the polyhedron, determining the relative relationship, if the relative relationship indicates that the light beam of the light source is located inside any one of a plurality of faces of the polyhedron, and the inside is one of two sides of the plane where the any face is located in the vertical direction, where other faces of the plurality of faces exist, that is, other faces of the polyhedron exist inside the any face, determining that the light source affects the polyhedron, outputting a determination result indicating that the light source affects the polyhedron, and continuing to determine whether other light sources of the plurality of light sources affect the polyhedron in the corresponding relative relationship. On the contrary, if the relative relationship indicates that the light beam of the light source is located on the outer side of any one of the plurality of faces, and the outer side is the other side of the two sides except the inner side, the judgment determines that the light source does not affect the polyhedron, the light source can be filtered, the judgment result for indicating that the light source does not affect the polyhedron is output, and whether other light sources in the plurality of light sources affect the polyhedron under the corresponding relative relationship is continuously judged. That is, it is actually determined whether the light source affects the polyhedron by judging whether the light beam of the light source passes through the polyhedron or whether the light beam interacts with any one face of the polyhedron using the relative relationship.
It should be noted that, in order to simplify the interactive calculation between the polyhedron and the light source, the polyhedron may be replaced by the spherical bounding box in the process of reading the relative relationship between the light source and the polyhedron, that is, the spherical bounding box is constructed for the polyhedron, the relative relationship between each light source and the spherical bounding box in the plurality of light sources is read as the relative relationship between each light source and the polyhedron according to the relative position between each light source and the spherical bounding box in the plurality of light sources, and the determined relative relationship is subsequently determined to output a determination result. The process of reading the relative relation by using the spherical bounding box can also be realized based on the processing thread corresponding to the polyhedron, the generation of the light source list is directly realized based on one spherical surface, and the performance is improved.
After the judgment result is output through the judgment of the relative relationship, at least one first light source is determined in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the light beam of the first light source influences the polyhedron. Then, the number of the light sources of the at least one first light source is counted, the light source index of the at least one first light source is obtained, and a light source list including the number of the light sources and the light source index is generated.
The above-described process is a process of generating a light source list corresponding to a certain polyhedron, and by repeatedly performing the above-described process, a corresponding light source list can be generated for each polyhedron. In the practical application process, in order to reduce the number of light source traversal times, several polyhedrons can be merged, the calculation efficiency is improved by adopting a coarse-grained elimination method, and the process of merging the polyhedrons is specifically as follows:
in response to the merge generation request, first, a merge number indicated by the merge generation request is obtained, where the merge number indicates how many polyhedrons are to be subjected to merge calculation. And then, combining the continuous polyhedrons with the number meeting the combination number in the plurality of polyhedrons according to the arrangement mode of the plurality of polyhedrons to obtain a plurality of polyhedron sets. And for each polyhedron set in the plurality of polyhedron sets, reading the relative relation between each light source in the plurality of light sources and the polyhedron set, judging whether each light source in the plurality of light sources influences the polyhedron set under the relative relation, and outputting a judgment result corresponding to each light source. Determining at least one first light source in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the first light source influences the polyhedron set, counting the number of the light sources of the at least one first light source, acquiring the light source index of the at least one first light source, and generating a light source list comprising the number of the light sources and the light source index. By repeatedly executing the above process, a light source list including the light source index and the number of light sources that affect the light sources of the polyhedron set can be generated for each polyhedron set, respectively, so as to obtain a plurality of light source lists. The process of generating the light source list is consistent with the process of generating the light source list for one polyhedron, whether the light source interacts with the polyhedron set or not can be determined by judging the relative relationship between the outer surface of the polyhedron set and the light source, or a spherical bounding box can be constructed for the polyhedron set, the relative relationship between each light source in the light sources and the spherical bounding box is read as the relative relationship between each light source and the polyhedron set according to the relative position between each light source in the light sources and the spherical bounding box, and then the relative relationship between the light sources and the polyhedron set is read by using the spherical bounding box so as to determine which light sources interact with the polyhedron set, which is not repeated here. By repeatedly performing the above-described process, a light source list can be generated for each set of polyhedrons.
In addition, in practical application, a corresponding processing thread may be set for each polyhedron set in the plurality of polyhedron sets, the processing threads corresponding to the plurality of polyhedron sets may be run, the relative relationship between the plurality of polyhedron sets and the plurality of light sources may be judged in parallel based on the processing threads corresponding to the plurality of polyhedron sets, and a light source list including the light source index and the number of light sources affecting the light sources of the polyhedron set may be generated for each polyhedron set according to the judgment result, so as to obtain a plurality of light source lists.
In practice, the process of merging the polyhedrons is a process of combining a plurality of adjacent polyhedrons into a large polyhedron for unified calculation, for example, assuming that all the polyhedrons obtained by current division are small hexahedrons, and the number of merged polyhedrons is 5, the adjacent 5 small hexahedrons are combined into a large hexahedron, and which light sources affect the large hexahedron are determined based on the large hexahedron, so as to generate a light source list for the large hexahedron.
In summary, in the embodiment of the present application, the light source list may be generated in two ways, one is to generate the light source list for a single polyhedron, and the other is to generate the light source list for a polyhedron set composed of a plurality of polyhedrons, so the light source list in the present application actually includes the light source index and the number of light sources that affect the light source of the single polyhedron or the polyhedron set.
In the embodiment of the present application, the single polyhedron or the polyhedron set and the corresponding light source list are stored in association, and the specific association storage may be implemented based on a two-layer list structure or a three-layer list structure. If a two-layer List structure is adopted for storage, one layer of the List structure may be a Light List (illuminant List) for storing all the content included in the existing multiple illuminant lists, and the other layer may be a Light Grid (raster) for storing each single polyhedron or each polyhedron set and its corresponding illuminant index and illuminant number. If the three-layer List structure is adopted for storage, one layer of the List structure may be a Light List for storing all the contents of the existing multiple Light source lists, another layer may be a Light Grid for storing the start position and the end position of each single polyhedron or each polyhedron set in the Light List, and another layer may be a Light Index List (Light Index List) for storing the Light Index corresponding to each single polyhedron or each polyhedron set. The present application does not specifically limit which way to store the plurality of light source lists. In addition, since the lists are all required to be applied in the terminal, when the terminal stores a plurality of light source lists according to the list structure, two modes of Struct Buffer and Textrue (continuous storage) may be adopted, which may be specifically selected according to the condition of the terminal operating system, and the application is not limited specifically.
Further, it is mentioned above that the generation process of the entire Light source list can be implemented using tools such as Unity, but some tools may not have this function, and LWRP (Light Weight Render Pipeline) such as Unity has strong customizability, and therefore, the function of generating the Light source list can be added in forward rendering of LWRP by modifying the LWRP. It should be noted that when generating the light source list based on the tool, the default clipping mode in the forward rendering is turned off, and the default light source setting is cancelled, and then the generation of the light source list is started. In particular, parallel generation of the light source list may be achieved by assigning a processing thread to each polygon based on the Compute Shader of the tool. Specifically, num _ threads in computer Shader can be increased appropriately, thereby increasing the processing speed. Alternatively, based on a Job system (Job system) in which a tool is packaged with multi-thread operations, tasks for generating the light source list are added to an execution queue, and an engine is responsible for scheduling, resource contention processing, multi-thread allocation and other tasks.
203. And determining a target fragment, and inquiring a target polyhedron to which the target fragment belongs from a plurality of polyhedrons.
In the embodiment of the present application, after a plurality of light source lists are generated, illumination calculation on a solid model in a target scene based on the light source lists may be started. Specifically, a target fragment may be determined, a target polyhedron to which the target fragment belongs is queried in a plurality of polyhedrons, the target fragment is any fragment to be rendered of any solid model in a target scene, and each polyhedron actually indicates a partial screen space, so that which partial screen space the target fragment is located in can be directly determined through viewing the target scene, and the target polyhedron can be further determined.
204. And performing illumination calculation on the target fragment based on a target light source list corresponding to the target polyhedron.
In the embodiment of the application, after the target polyhedron is determined, illumination calculation is performed on the target fragment based on a target light source list corresponding to the target polyhedron. In the above process, it is described that the light source list may actually be generated according to a single polyhedron or a set of polyhedrons, and therefore, it is necessary to query the light source list bound to the target polyhedron first and determine whether the target polyhedron has a light source list generated for the target polyhedron alone. Further, in response to the query, determining that the target polyhedron has a bound light source list, taking the bound light source list of the target polyhedron as a target light source list, and performing illumination calculation on the target fragment by using the number of light sources and the light source index included in the target light source list, that is, performing illumination calculation on the target fragment by using the light source list generated for the target polyhedron alone. And responding to the query to determine that the target polyhedron does not have a bound light source list, determining a target polyhedron set where the target polyhedron is located, taking the light source list bound by the target polyhedron set as a target light source list, performing illumination calculation on the target fragment by adopting the number of light sources and light source indexes included in the target light source list, namely determining which polyhedron set the target polyhedron belongs to, and performing illumination calculation on the target fragment by using the light source list of the polyhedron set.
It should be noted that, if the light source in the target scene is not changed, the light source list generated as described above may be continuously used to perform illumination calculation on the fragment of the solid model in the target scene. If the entity model is added in the target scene, but the light source is not changed, the generated light source list can be continuously adopted to perform illumination calculation on the fragments of the entity model in the target scene, and the light source list does not need to be updated. If the light source is increased or decreased in the target scene, the processes in the above steps 201 to 202 need to be executed again to generate a new light source list, and the illumination calculation is performed on the fragment of the solid model in the target scene based on the new light source list.
The method provided by the embodiment of the application comprises the steps of dividing a view cone of a target scene in a preset dimension to obtain a plurality of polyhedrons, judging the relative relation between the polyhedrons and a light source in the scene, generating a light source list comprising light source indexes and the number of the light sources influencing the light source of a single polyhedron or a plurality of polyhedrons according to a judgment result, further using the light source list corresponding to the polyhedron where the fragment is located to calculate when performing illumination calculation on the fragment of the entity model, grouping screen space of the scene by using a mode of adjacent pixel grouping, cutting the light source in the scene according to the grouping, performing illumination calculation on the fragment by using the cut light source, avoiding the light source which does not influence the fragment from being involved in the illumination calculation of the fragment, reducing the calculation amount, and greatly reducing the possibility of generating serious performance problems in a complex scene, and relieving bandwidth pressure.
Further, as a specific implementation of the method in fig. 1, an embodiment of the present application provides an illumination computing apparatus, as shown in fig. 3, the apparatus includes: a partitioning module 301, a generating module 302, a querying module 303 and a calculating module 304.
The dividing module 301 is configured to divide a viewing frustum of a target scene in a preset dimension to obtain a plurality of polyhedrons;
the generating module 302 is configured to determine relative relationships between the plurality of polyhedrons and a plurality of light sources in the target scene, and generate a plurality of light source lists according to a determination result, where each light source list in the plurality of light source lists includes a light source index and a light source number of a light source that affects a single polyhedron or a set of polyhedrons;
the query module 303 is configured to determine a target fragment, and query a target polyhedron to which the target fragment belongs from the multiple polyhedrons, where the target fragment is any fragment to be rendered of any entity model in the target scene;
the calculating module 304 is configured to perform illumination calculation on the target fragment based on a target light source list corresponding to the target polyhedron.
In a specific application scenario, the dividing module 301 is configured to obtain the preset dimension and a preset dividing parameter, and determine at least one coordinate direction indicated by the preset dimension and a sub-parameter corresponding to the at least one coordinate direction in the preset dividing parameter; for each coordinate direction in the at least one coordinate direction, dividing the view frustum into the number of parts indicated by the sub-parameters corresponding to the coordinate direction in the coordinate direction; and dividing the view frustum in the at least one coordinate direction according to the corresponding sub-parameters to obtain the plurality of polyhedrons.
In a specific application scenario, the generating module 302 is configured to, for each polyhedron of the plurality of polyhedrons, read a relative relationship between each light source of the plurality of light sources and the polyhedron, determine whether a light beam of each light source of the plurality of light sources affects the polyhedron under the relative relationship, and output a determination result corresponding to each light source; determining at least one first light source in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the light beam of the first light source influences the polyhedron; counting the number of the light sources of the at least one first light source, acquiring a light source index of the at least one first light source, and generating a light source list comprising the number of the light sources and the light source index; repeatedly executing the above process, and respectively generating a light source list including light source indexes and light source numbers affecting light sources of the polyhedrons for each polyhedron to obtain a plurality of light source lists; and performing association storage on the plurality of polyhedrons and the plurality of light source lists, wherein the association storage can be realized based on a two-layer list structure or a three-layer list structure.
In a specific application scenario, the generating module 302 is configured to, for each light source in the plurality of light sources, read a relative relationship between the light source and the polyhedron, and determine the relative relationship; if the relative relationship indicates that the light beam of the light source is positioned on the inner side of any face of the plurality of faces of the polyhedron, judging and determining that the light source influences the polyhedron, outputting a judgment result for indicating that the light source influences the polyhedron, and continuously judging whether other light sources in the plurality of light sources influence the polyhedron under the corresponding relative relationship; if the relative relationship indicates that the light beam of the light source is positioned on the outer side of any one of the plurality of faces, judging and determining that the light source does not influence the polyhedron, outputting a judgment result for indicating that the light source does not influence the polyhedron, and continuously judging whether other light sources in the plurality of light sources influence the polyhedron under the corresponding relative relationship; wherein the inner side is one of two sides of the plane where the arbitrary surface is located in a vertical direction, where the other of the plurality of surfaces is present, and the outer side is the other of the two sides excluding the inner side.
In a specific application scenario, the generating module 302 is configured to, for each polyhedron of the plurality of polyhedrons, construct a spherical bounding box for the polyhedron; and reading the relative relation between each light source in the plurality of light sources and the spherical bounding box as the relative relation between each light source and the polyhedron according to the relative position between each light source in the plurality of light sources and the spherical bounding box.
In a specific application scenario, the generating module 302 is configured to respond to a merge generation request, and obtain a merge number indicated by the merge generation request; combining the continuous polyhedrons with the number meeting the combined number in the plurality of polyhedrons according to the arrangement mode of the plurality of polyhedrons to obtain a plurality of polyhedron sets; for each polyhedron set in the plurality of polyhedron sets, reading the relative relation between each light source in the plurality of light sources and the polyhedron set, judging whether each light source in the plurality of light sources influences the polyhedron set under the relative relation, and outputting a judgment result corresponding to each light source; determining at least one first light source in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the first light source influences the polyhedron set; counting the number of the light sources of the at least one first light source, acquiring a light source index of the at least one first light source, and generating a light source list comprising the number of the light sources and the light source index; repeatedly executing the above process, and respectively generating a light source list including light source indexes and light source numbers affecting light sources of the polyhedron set for each polyhedron set to obtain a plurality of light source lists; and performing association storage on the plurality of polyhedron sets and the plurality of light source lists, wherein the association storage can be realized based on a two-layer list structure or a three-layer list structure.
In a specific application scenario, the generating module 302 is configured to, for each polyhedron set in the plurality of polyhedron sets, construct a spherical bounding box for the polyhedron set; and reading the relative relation between each light source in the plurality of light sources and the spherical bounding box as the relative relation between each light source and the polyhedron set according to the relative position between each light source in the plurality of light sources and the spherical bounding box.
In a specific application scenario, the calculation module 304 is configured to query a light source list bound to the target polyhedron; responding to a query to determine that the target polyhedron has a bound light source list, taking the target polyhedron bound light source list as the target light source list, and performing illumination calculation on the target fragment by adopting the number of light sources and light source indexes included in the target light source list; and responding to the query to determine that the target polyhedron does not have a bound light source list, determining a target polyhedron set where the target polyhedron is located, taking the light source list bound by the target polyhedron set as the target light source list, and performing illumination calculation on the target fragment by adopting the number of light sources and the light source index included in the target light source list.
The device provided by the embodiment of the application divides the view cone of the target scene in a preset dimension to obtain a plurality of polyhedrons, judges the relative relationship between the plurality of polyhedrons and the light source in the scene, generates the light source list comprising the light source index influencing the light source of a single polyhedron or a plurality of polyhedrons and the number of the light sources according to the judgment result, further calculates by using the light source list corresponding to the polyhedron where the fragment is located when performing illumination calculation on the fragment of the entity model, groups the screen space of the scene by using a mode of adjacent pixel grouping, cuts the light source in the scene according to the grouping, performs illumination calculation on the fragment by using the cut light source, avoids the light source which does not influence the fragment in the illumination calculation of the fragment, reduces the calculation amount, and greatly reduces the possibility of generating serious performance problems in a complex scene, and relieving bandwidth pressure.
It should be noted that, for other corresponding descriptions of the functional units related to the illumination computing device provided in the embodiment of the present application, reference may be made to the corresponding descriptions in fig. 1 and fig. 2, which are not described herein again.
In an exemplary embodiment, referring to fig. 4, there is further provided a device including a communication bus, a processor, a memory, and a communication interface, and further including an input/output interface and a display device, wherein the functional units may communicate with each other through the bus. The memory stores a computer program, and the processor is used for executing the program stored in the memory and executing the illumination calculation method in the embodiment.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the illumination calculation method.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present application can be implemented by hardware, and also by software plus a necessary general hardware platform. Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the implementation scenarios of the present application.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present application.
Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above application serial numbers are for description purposes only and do not represent the superiority or inferiority of the implementation scenarios.
The above disclosure is only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.

Claims (11)

1. An illumination calculation method, comprising:
dividing a viewing cone of a target scene in a preset dimension to obtain a plurality of polyhedrons;
judging the relative relation between the polyhedrons and the light sources in the target scene, and generating a plurality of light source lists according to the judgment result, wherein each light source list in the plurality of light source lists comprises the light source indexes and the light source quantity of the light sources influencing a single polyhedron or a polyhedron set;
determining a target fragment, and inquiring a target polyhedron to which the target fragment belongs in the plurality of polyhedrons, wherein the target fragment is any fragment to be rendered of any entity model in the target scene;
and performing illumination calculation on the target fragment based on a target light source list corresponding to the target polyhedron.
2. The method according to claim 1, wherein the dividing the view frustum of the target scene in the preset dimension to obtain a plurality of polyhedrons comprises:
acquiring the preset dimension and preset division parameters, and determining at least one coordinate direction indicated by the preset dimension and a corresponding sub-parameter of the at least one coordinate direction in the preset division parameters;
for each coordinate direction in the at least one coordinate direction, dividing the view frustum into the number of parts indicated by the sub-parameters corresponding to the coordinate direction in the coordinate direction;
and dividing the view frustum in the at least one coordinate direction according to the corresponding sub-parameters to obtain the plurality of polyhedrons.
3. The method according to claim 1, wherein the determining the relative relationship between the plurality of polyhedrons and the plurality of light sources in the target scene, and generating a plurality of light source lists according to the determination result comprises:
for each polyhedron in the plurality of polyhedrons, reading the relative relationship between each light source in the plurality of light sources and the polyhedron, judging whether the light beam of each light source in the plurality of light sources influences the polyhedron under the relative relationship, and outputting a judgment result corresponding to each light source;
determining at least one first light source in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the light beam of the first light source influences the polyhedron;
counting the number of the light sources of the at least one first light source, acquiring a light source index of the at least one first light source, and generating a light source list comprising the number of the light sources and the light source index;
repeatedly executing the above process, and respectively generating a light source list including light source indexes and light source numbers affecting light sources of the polyhedrons for each polyhedron to obtain a plurality of light source lists;
and performing association storage on the plurality of polyhedrons and the plurality of light source lists, wherein the association storage can be realized based on a two-layer list structure or a three-layer list structure.
4. The method according to claim 3, wherein the reading a relative relationship between each of the plurality of light sources and the polyhedron, determining whether the light beam of each of the plurality of light sources affects the polyhedron in the relative relationship, and outputting a determination result corresponding to each of the plurality of light sources comprises:
for each light source in the plurality of light sources, reading the relative relationship between the light source and the polyhedron, and judging the relative relationship;
if the relative relationship indicates that the light beam of the light source is positioned on the inner side of any face of the plurality of faces of the polyhedron, judging and determining that the light source influences the polyhedron, outputting a judgment result for indicating that the light source influences the polyhedron, and continuously judging whether other light sources in the plurality of light sources influence the polyhedron under the corresponding relative relationship;
if the relative relationship indicates that the light beam of the light source is positioned on the outer side of any one of the plurality of faces, judging and determining that the light source does not influence the polyhedron, outputting a judgment result for indicating that the light source does not influence the polyhedron, and continuously judging whether other light sources in the plurality of light sources influence the polyhedron under the corresponding relative relationship;
wherein the inner side is one of two sides of the plane where the arbitrary surface is located in a vertical direction, where the other of the plurality of surfaces is present, and the outer side is the other of the two sides excluding the inner side.
5. The method of claim 3, wherein reading the relative relationship of each of the plurality of light sources to the polyhedron comprises:
for each polyhedron of the plurality of polyhedrons, constructing a spherical bounding box for the polyhedron;
and reading the relative relation between each light source in the plurality of light sources and the spherical bounding box as the relative relation between each light source and the polyhedron according to the relative position between each light source in the plurality of light sources and the spherical bounding box.
6. The method according to claim 1, wherein the determining the relative relationship between the plurality of polyhedrons and the plurality of light sources in the target scene, and generating a plurality of light source lists according to the determination result comprises:
responding to a merging generation request, and acquiring the merging number indicated by the merging generation request;
combining the continuous polyhedrons with the number meeting the combined number in the plurality of polyhedrons according to the arrangement mode of the plurality of polyhedrons to obtain a plurality of polyhedron sets;
for each polyhedron set in the plurality of polyhedron sets, reading the relative relation between each light source in the plurality of light sources and the polyhedron set, judging whether each light source in the plurality of light sources influences the polyhedron set under the relative relation, and outputting a judgment result corresponding to each light source;
determining at least one first light source in the plurality of light sources according to the judgment result corresponding to each light source, wherein the judgment result corresponding to the at least one first light source indicates that the first light source influences the polyhedron set;
counting the number of the light sources of the at least one first light source, acquiring a light source index of the at least one first light source, and generating a light source list comprising the number of the light sources and the light source index;
repeatedly executing the above process, and respectively generating a light source list including light source indexes and light source numbers affecting light sources of the polyhedron set for each polyhedron set to obtain a plurality of light source lists;
and performing association storage on the plurality of polyhedron sets and the plurality of light source lists, wherein the association storage can be realized based on a two-layer list structure or a three-layer list structure.
7. The method of claim 6, wherein reading the relative relationship of each of the plurality of light sources to the collection of polyhedrons comprises:
for each polyhedron set in the plurality of polyhedron sets, constructing a spherical bounding box for the polyhedron set;
and reading the relative relation between each light source in the plurality of light sources and the spherical bounding box as the relative relation between each light source and the polyhedron set according to the relative position between each light source in the plurality of light sources and the spherical bounding box.
8. The method according to claim 1, wherein the performing the illumination calculation on the target fragment based on the target light source list corresponding to the target polyhedron comprises:
inquiring a light source list bound by the target polyhedron;
responding to a query to determine that the target polyhedron has a bound light source list, taking the target polyhedron bound light source list as the target light source list, and performing illumination calculation on the target fragment by adopting the number of light sources and light source indexes included in the target light source list;
and responding to the query to determine that the target polyhedron does not have a bound light source list, determining a target polyhedron set where the target polyhedron is located, taking the light source list bound by the target polyhedron set as the target light source list, and performing illumination calculation on the target fragment by adopting the number of light sources and the light source index included in the target light source list.
9. An illumination computing apparatus, comprising:
the device comprises a dividing module, a judging module and a judging module, wherein the dividing module is used for dividing a cone of view of a target scene in a preset dimension to obtain a plurality of polyhedrons;
a generating module, configured to determine a relative relationship between the plurality of polyhedrons and a plurality of light sources in the target scene, and generate a plurality of light source lists according to a determination result, where each light source list in the plurality of light source lists includes a light source index and a light source number that affect a light source of a single polyhedron or a set of polyhedrons;
a query module, configured to determine a target fragment, and query a target polyhedron to which the target fragment belongs from the multiple polyhedrons, where the target fragment is any fragment to be rendered of any entity model in the target scene;
and the calculation module is used for carrying out illumination calculation on the target fragment based on the target light source list corresponding to the target polyhedron.
10. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 8 when executing the computer program.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 8.
CN202110348460.3A 2021-03-31 2021-03-31 Illumination calculation method and device, computer equipment and computer readable storage medium Active CN113052950B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110348460.3A CN113052950B (en) 2021-03-31 2021-03-31 Illumination calculation method and device, computer equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110348460.3A CN113052950B (en) 2021-03-31 2021-03-31 Illumination calculation method and device, computer equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113052950A CN113052950A (en) 2021-06-29
CN113052950B true CN113052950B (en) 2021-12-17

Family

ID=76516771

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110348460.3A Active CN113052950B (en) 2021-03-31 2021-03-31 Illumination calculation method and device, computer equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113052950B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116416364B (en) * 2022-10-25 2023-11-03 北京大学 Data acquisition and estimation method and device for urban scene space variable environment illumination

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101568943A (en) * 2006-12-28 2009-10-28 英特尔公司 Real-time collision detection using clipping
CN107274476A (en) * 2017-08-16 2017-10-20 城市生活(北京)资讯有限公司 The generation method and device of a kind of echo
CN107481314A (en) * 2017-06-30 2017-12-15 浙江科澜信息技术有限公司 A kind of umbra volume optimization method based on KD trees
CN110211218A (en) * 2019-05-17 2019-09-06 腾讯科技(深圳)有限公司 Picture rendering method and device, storage medium and electronic device
CN111105491A (en) * 2019-11-25 2020-05-05 腾讯科技(深圳)有限公司 Scene rendering method and device, computer readable storage medium and computer equipment
CN111260766A (en) * 2020-01-17 2020-06-09 网易(杭州)网络有限公司 Virtual light source processing method, device, medium and electronic equipment
CN111968216A (en) * 2020-07-29 2020-11-20 完美世界(北京)软件科技发展有限公司 Volume cloud shadow rendering method and device, electronic equipment and storage medium
CN112348955A (en) * 2020-11-30 2021-02-09 久瓴(江苏)数字智能科技有限公司 Object rendering method
CN112381918A (en) * 2020-12-03 2021-02-19 腾讯科技(深圳)有限公司 Image rendering method and device, computer equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8325186B2 (en) * 2009-05-21 2012-12-04 Sony Computer Entertainment America Llc Method and apparatus for rendering shadows
US9508191B2 (en) * 2010-07-23 2016-11-29 Pacific Data Images Llc Optimal point density using camera proximity for point-based global illumination
US20140327673A1 (en) * 2013-05-03 2014-11-06 Crytek Gmbh Real-time global illumination using pre-computed photon paths
JP6392370B2 (en) * 2014-04-05 2018-09-19 ソニー インタラクティブ エンタテインメント アメリカ リミテッド ライアビリテイ カンパニー An efficient re-rendering method for objects to change the viewport under various rendering and rasterization parameters
GB2551388B (en) * 2016-06-17 2021-01-27 Geomerics Ltd Graphics processing systems

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101568943A (en) * 2006-12-28 2009-10-28 英特尔公司 Real-time collision detection using clipping
CN107481314A (en) * 2017-06-30 2017-12-15 浙江科澜信息技术有限公司 A kind of umbra volume optimization method based on KD trees
CN107274476A (en) * 2017-08-16 2017-10-20 城市生活(北京)资讯有限公司 The generation method and device of a kind of echo
CN110211218A (en) * 2019-05-17 2019-09-06 腾讯科技(深圳)有限公司 Picture rendering method and device, storage medium and electronic device
CN111105491A (en) * 2019-11-25 2020-05-05 腾讯科技(深圳)有限公司 Scene rendering method and device, computer readable storage medium and computer equipment
CN111260766A (en) * 2020-01-17 2020-06-09 网易(杭州)网络有限公司 Virtual light source processing method, device, medium and electronic equipment
CN111968216A (en) * 2020-07-29 2020-11-20 完美世界(北京)软件科技发展有限公司 Volume cloud shadow rendering method and device, electronic equipment and storage medium
CN112348955A (en) * 2020-11-30 2021-02-09 久瓴(江苏)数字智能科技有限公司 Object rendering method
CN112381918A (en) * 2020-12-03 2021-02-19 腾讯科技(深圳)有限公司 Image rendering method and device, computer equipment and storage medium

Non-Patent Citations (6)

* Cited by examiner, † Cited by third party
Title
"Parallel-Split Shadow Maps for Large-scale Virtual Environments";Fan Zhang et al.;《VRCIA 2006》;20060617;311-318页 *
"Tiled Frustum Culling for Differential Rendering on Mobile Devices";Kai Rohmer et al.;《2015 IEEE International Symposium on Mixed and Augmented Reality》;20151231;37-42页 *
"三维复杂场景实时绘制技术";陈雷霆;《中国优秀博硕士学位论文全文数据库(博士) 信息科技辑》;20070915(第03期);论文第二章 *
"三维模拟演练系统中光照模型的研究与实现";唐宇;《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》;20161115(第11期);论文第二章-第五章 *
"基于GPU的三维建筑模型日照阴影分析展示系统的设计与实现";焦晴阳;《中国优秀博硕士学位论文全文数据库(硕士) 工程科技II辑》;20180615(第06期);论文第四章、第五章 *
"基于随机光源裁剪实现实时全局光照";邱玉凯;《现代计算机》;20200331;85-90页 *

Also Published As

Publication number Publication date
CN113052950A (en) 2021-06-29

Similar Documents

Publication Publication Date Title
KR101004110B1 (en) Ray tracing core and ray tracing chip having the same
US20100073400A1 (en) Parallel grid population
JP5436526B2 (en) Graphics command generation device, graphics command generation method, server device, and client device
US10217291B2 (en) Designing a modeled volume represented by dexels
US9922442B2 (en) Graphics processing unit and method for performing tessellation operations
CN113052950B (en) Illumination calculation method and device, computer equipment and computer readable storage medium
JP2023516934A (en) Graphics processing unit rendering mode selection system
US10580106B2 (en) Graphics processing method utilizing predefined render chunks
US11908064B2 (en) Accelerated processing via a physically based rendering engine
CN114596195A (en) Topographic data processing method, system, device and computer storage medium
KR102269648B1 (en) Ray tracing device and method with improved performance
US11893677B1 (en) Bounding volume hierarchy (BVH) widening based on node compressibility
US20230410407A1 (en) Accelerated bounding volume hierarchy (bvh) traversal for shadow rays
US11704860B2 (en) Accelerated processing via a physically based rendering engine
CN115100364B (en) Visualization method, device, equipment and medium for laser point cloud data of power transmission line
US11853764B2 (en) Accelerated processing via a physically based rendering engine
US11875444B2 (en) Accelerated processing via a physically based rendering engine
US11861785B2 (en) Generation of tight world space bounding regions
US20230118972A1 (en) Scalable parallel construction of bounding volume hierarchies
US20220366628A1 (en) Accelerated processing via a physically based rendering engine
US20220374496A1 (en) Techniques for accelerating matrix multiplication computations using hierarchical representations of sparse matrices
US20220374961A1 (en) Techniques for performing matrix computations using hierarchical representations of sparse matrices
US20220374403A1 (en) Techniques for generating and processing hierarchical representations of sparse matrices
CN114359455A (en) Tree rendering processing method, device, medium and program product
CN117667405A (en) Three-dimensional application running method and device, electronic 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
GR01 Patent grant
GR01 Patent grant