Illumination baking method, device and equipment for virtual scene, medium and program product

By considering the light shielding factor and indirect light of the virtual light point in the virtual scene lighting baking, combined with the direct irradiance, the problem of low lighting realism in the virtual scene lighting baking is solved, and higher lighting detail performance is achieved.

CN118557964APending Publication Date: 2024-08-30TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202310231878.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-28
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In the prior art, the virtual scene lighting baking process directly combines the direct light emitted by the virtual light source, resulting in low lighting realism.

Method used

By obtaining the virtual light corresponding to each virtual light point in the virtual scene, including direct light with one reflection number and indirect light with multiple reflection times, the indirect radiance of each virtual light point is determined based on the light shielding factor and indirect irradiance. Illumination, combined with direct irradiance, is used to bake the virtual scene to generate a light map.

Benefits of technology

It improves the lighting realism of lighting baking, accurately records the baking results of direct light and indirect light, and enhances the lighting details of virtual scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118557964A
    Figure CN118557964A
Patent Text Reader

Abstract

The invention provides an illumination baking method and device for a virtual scene, equipment, a medium and a program product. The method comprises the following steps: acquiring virtual light corresponding to each virtual illumination point in a virtual scene, wherein the virtual light comprises direct light reflected once and indirect light reflected multiple times; determining the indirect irradiance of each virtual illumination point based on the indirect light corresponding to the virtual illumination point and the light shielding factor of the virtual illumination point; the light shielding factor is used for indicating the irradiation influence of a virtual shielding object of the virtual illumination point on the virtual illumination point, and the indirect irradiance is used for indicating the irradiation influence of indirect light on the virtual illumination point; the direct irradiance of each virtual illumination point is obtained, and the direct irradiance is used for indicating the irradiation influence of direct light rays on the virtual illumination points; and in combination with the indirect irradiance and the direct irradiance, performing illumination baking on the virtual scene to obtain an illumination image of the virtual scene. According to the invention, the illumination trueness of illumination baking can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a lighting baking method, device, equipment, medium and program product for a virtual scene. Background Art

[0002] With the development of multimedia technology, there are more and more types of games and more and more functions. In order to provide players with a more realistic gaming experience, technicians are committed to improving the fineness of the game screen. For example, technicians improve the fineness of the game screen as a whole by improving the realism of the lighting in the game screen.

[0003] In the related art, during the process of lighting baking for a virtual scene, the lighting baking for the virtual scene is usually performed directly in combination with the direct light emitted by the virtual light source, resulting in low lighting realism of the lighting baking. Summary of the invention

[0004] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for lighting baking of a virtual scene, which can effectively improve the lighting realism of lighting baking.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] The present application embodiment provides a lighting baking method for a virtual scene, including:

[0007] Acquire virtual light corresponding to each virtual illumination point in the virtual scene, wherein the virtual light includes direct light with one reflection and indirect light with multiple reflections;

[0008] Determining the indirect irradiance of each of the virtual illumination points based on the indirect light corresponding to the virtual illumination point and the light shielding factor of the virtual illumination point;

[0009] The light shielding factor is used to indicate the irradiation effect of the virtual occluder of the virtual illumination point on the virtual illumination point, and the indirect irradiance is used to indicate the irradiation effect of the indirect light on the virtual illumination point;

[0010] Acquire the direct irradiance of each of the virtual illumination points, wherein the direct irradiance is used to indicate the irradiance effect of the direct light on the virtual illumination point;

[0011] The indirect irradiance and the direct irradiance are combined to perform lighting baking on the virtual scene to obtain a lighting map of the virtual scene.

[0012] The embodiment of the present application provides a lighting baking device for a virtual scene, comprising:

[0013] An acquisition module, used to acquire virtual light corresponding to each virtual illumination point in the virtual scene, wherein the virtual light includes direct light with one reflection and indirect light with multiple reflections;

[0014] An indirect determination module, used to determine the indirect irradiance of each virtual illumination point based on the indirect light corresponding to the virtual illumination point and the light shielding factor of the virtual illumination point; wherein the light shielding factor is used to indicate the irradiance effect of the virtual occluder of the virtual illumination point on the virtual illumination point, and the indirect irradiance is used to indicate the irradiance effect of the indirect light on the virtual illumination point;

[0015] A direct determination module, used for obtaining the direct irradiance of each of the virtual illumination points, wherein the direct irradiance is used for indicating the irradiance effect of the direct light on the virtual illumination point;

[0016] The baking module is used to combine the indirect irradiance and the direct irradiance to perform lighting baking on the virtual scene to obtain a lighting map of the virtual scene.

[0017] In some embodiments, each of the virtual illumination points corresponds to at least one indirect light ray, and the above-mentioned indirect determination module is used to perform the following processing for each of the virtual illumination points: determine the initial irradiance of each of the indirect light rays corresponding to the virtual illumination point respectively; sum up the initial irradiances to obtain the first irradiance corresponding to the virtual illumination point; and adjust the first irradiance based on the light shielding factor of the virtual illumination point to obtain the indirect irradiance of the virtual illumination point.

[0018] In some embodiments, the indirect determination module is further used to perform the following processing for each of the indirect light rays corresponding to the virtual illumination point: obtaining the reflection path of the indirect light ray and the first light source radiation energy of the virtual light source corresponding to the indirect light ray; wherein the starting point of the reflection path is the position of the virtual light source in the virtual scene, the end point of the reflection path is the position of the virtual camera used to shoot the virtual scene in the virtual scene, and the virtual illumination point is located on the reflection path; based on the reflection path of the indirect light ray, determining the first irradiance loss value of the indirect light ray, the first irradiance loss value being used to indicate the loss of the light source radiation energy in the reflection path; and determining the difference between the first light source radiation energy and the first irradiance loss value as the initial irradiance of the indirect light ray.

[0019] In some embodiments, the reflection path of the indirect light includes at least two reflection midpoints and at least three reflection sub-paths, wherein the reflection midpoint is located on the reflection path and is used for the indirect light to form light reflection, and the at least two reflection midpoints include the virtual illumination point; the above-mentioned indirect determination module is also used to obtain a first radiation absorption value corresponding to each of the reflection midpoints in the reflection path, wherein the first radiation absorption value is used to indicate the degree of energy absorption of the light source radiation energy by the reflection midpoint, and the numerical value of the first radiation absorption value is associated with the virtual material corresponding to the reflection midpoint; based on the length of each of the reflection sub-paths in the reflection path, determine the second radiation absorption value corresponding to each of the reflection sub-paths, wherein the second radiation absorption value is used to indicate the degree of energy absorption of the light source radiation energy by the propagation medium on the reflection sub-path, and the numerical value of the second radiation absorption value is positively correlated with the length of the corresponding reflection sub-path; sum each of the first radiation absorption values ​​and each of the second radiation absorption values ​​to obtain the first irradiation loss value.

[0020] In some embodiments, the above-mentioned indirect determination module is also used to multiply the light shielding factor of the virtual illumination point and the first irradiance to obtain the blocked irradiance of the virtual illumination point, wherein the value range of the light shielding factor is between 0 and 1; and the difference between the first irradiance and the blocked irradiance is determined as the indirect irradiance of the virtual illumination point.

[0021] In some embodiments, the lighting baking device for the virtual scene further includes: a factor determination module, which is used to perform the following processing for each of the virtual lighting points: selecting multiple target virtual viewpoints associated with the virtual lighting point from each of the virtual viewpoints of the virtual scene; wherein the virtual viewpoint is a virtual scene point in the virtual scene that can be captured by a virtual camera, and there is no virtual blind spot on the line connecting the target virtual viewpoint and the virtual lighting point, and the virtual blind spot is a virtual scene point in the virtual scene that cannot be captured by the virtual camera; taking the virtual lighting point as the starting point and each of the target virtual viewpoints as the end point, generating detection rays corresponding to each of the target virtual viewpoints; when the detection ray intersects with the virtual occluder, determining the detection ray as an occluded detection ray; dividing the number of the occluded detection rays by the number of the multiple detection rays, and determining the division result as the light shielding factor of the virtual lighting point.

[0022] In some embodiments, the above-mentioned direct determination module is also used to perform the following processing for each of the virtual illumination points: when the virtual light to which the virtual illumination point belongs does not include the direct light, the value of the direct irradiance of the virtual illumination point is determined to be zero; when the virtual light to which the virtual illumination point belongs includes the direct light, the initial irradiance of each direct light is determined, wherein the direct light included in the virtual light is in a one-to-one correspondence with the virtual light source in the virtual scene; the initial irradiances corresponding to each of the direct lights are summed to obtain a second irradiance corresponding to the virtual illumination point; based on the light shielding factor of the virtual illumination point, the second irradiance is adjusted to obtain the direct irradiance of the virtual illumination point.

[0023] In some embodiments, the direct determination module is further used to perform the following processing for each direct light included in the virtual light: obtaining the reflection path of the direct light and the second light source radiation energy of the virtual light source corresponding to the direct light; wherein the starting point of the reflection path is the position of the virtual light source in the virtual scene, the end point of the reflection path is the position of the virtual camera used to shoot the virtual scene in the virtual scene, and the virtual illumination point is located on the reflection path; based on the reflection path of the direct light, determining the second irradiance loss value of the direct light, the second irradiance loss value being used to indicate the loss of the light source radiation energy in the reflection path; determining the difference between the second light source radiation energy and the second irradiance loss value as the initial irradiance of the direct light.

[0024] In some embodiments, the reflection path of the direct light includes two reflection sub-paths, and the above-mentioned direct determination module is also used to obtain a third radiation absorption value corresponding to the virtual illumination point in the reflection path, and the third radiation absorption value is used to indicate the degree of energy absorption of the virtual illumination point to the radiation energy of the light source; based on the length of each of the reflection sub-paths in the reflection path, the fourth radiation absorption value corresponding to each of the reflection sub-paths is determined, wherein the fourth radiation absorption value is used to indicate the degree of energy absorption of the radiation energy of the light source by the propagation medium on the reflection sub-path, and the numerical value of the fourth radiation absorption value is positively correlated with the length of the corresponding reflection sub-path; the third radiation absorption value and each of the fourth radiation absorption values ​​are summed to obtain the second radiation loss value.

[0025] In some embodiments, the above-mentioned baking module is also used to add the direct irradiance and the indirect irradiance of each virtual lighting point to obtain the overall irradiance of the virtual lighting point, and determine the ratio of the indirect irradiance to the overall irradiance as the indirect light ratio of the virtual lighting point; based on the indirect light ratio of each virtual lighting point, the virtual scene is illuminated and baked to obtain a lighting map of the virtual scene.

[0026] In some embodiments, the lighting baking device for the virtual scene further includes: a rendering module, which is used to sample information from each channel of the lighting map of the virtual scene to obtain channel information of each channel of the lighting map, wherein the channel information records the indirect light ratio of each virtual lighting point; based on the indirect light ratio, determining the brightness of each virtual lighting point in the virtual scene; based on the brightness of each virtual lighting point, rendering the virtual scene to obtain a rendering map of the virtual scene, and the rendering map is used for a display device to display the image of the virtual scene.

[0027] An embodiment of the present application provides an electronic device, including:

[0028] A memory for storing computer executable instructions or computer programs;

[0029] The processor is used to implement the lighting baking method for the virtual scene provided in the embodiment of the present application when executing the computer executable instructions or computer program stored in the memory.

[0030] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for causing a processor to execute instructions to implement a lighting baking method for a virtual scene provided by an embodiment of the present application.

[0031] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the lighting baking method of the virtual scene described in the embodiment of the present application.

[0032] The embodiments of the present application have the following beneficial effects:

[0033] Through the light shielding factor and indirect light of the virtual light point, the indirect irradiance of the virtual light point is determined, and the direct irradiance is obtained. Through the direct irradiance and the indirect irradiance, the virtual scene is light-baked to obtain the lighting map of the virtual scene. In this way, since the light shielding factor can accurately reflect the irradiation effect of the virtual occluder of the virtual light point on the virtual light point, the realism of the determined indirect irradiance is higher. Through the determined high-realism direct irradiance and indirect irradiance, the virtual scene is light-baked, so that the direct irradiance and the indirect irradiance can be accurately light-baked respectively during the light-baking process, so that the obtained light map can accurately record the baking results of the direct light and the indirect light, thereby effectively improving the lighting realism of the light baking. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 is a schematic diagram of the architecture of a lighting baking system for a virtual scene provided in an embodiment of the present application;

[0035] Figure 2 is a schematic diagram of the structure of an electronic device for lighting baking of a virtual scene provided in an embodiment of the present application;

[0036] Figure 3 It is a flowchart of a lighting baking method for a virtual scene provided in an embodiment of the present application;

[0037] Figures 4 to 6 It is a flowchart of a lighting baking method for a virtual scene provided in an embodiment of the present application;

[0038] Figures 7 and 8 It is a schematic diagram of the principle of the lighting baking method for a virtual scene provided in an embodiment of the present application;

[0039] Figures 9 and 10 It is a flowchart of a lighting baking method for a virtual scene provided in an embodiment of the present application;

[0040] Fig.11 It is a schematic diagram of the principle of the lighting baking method for a virtual scene provided in an embodiment of the present application;

[0041] Fig.12 It is a schematic diagram of the principle of the lighting baking method for the virtual scene provided in the embodiment of the present application. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0043] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0044] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0046] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0047] 1) Virtual scene: It is a virtual scene displayed or provided when the application is running on the terminal. The virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiment of the present application does not limit the dimension of the virtual scene. For example, the virtual scene may include the sky, land, ocean, etc. The land may include environmental elements such as deserts and cities, and the user can control the virtual object to move in the virtual scene.

[0048] 2) Virtual objects: images of various people and objects that can interact in a virtual scene, or movable objects in a virtual scene. The movable objects can be virtual characters, virtual animals, cartoon characters, etc., such as characters, animals, plants, oil drums, walls, stones, etc. displayed in a virtual scene. The virtual object can be a virtual image in the virtual scene that is used to represent the user. The virtual scene can include multiple virtual objects, each of which has its own shape and volume in the virtual scene and occupies a part of the space in the virtual scene. Optionally, the virtual object can be a user character controlled by operations on the client, or an artificial intelligence (AI) set in a virtual scene battle through training, or a non-user character (NPC) set in a virtual scene interaction. Optionally, the virtual object can be a virtual character that performs confrontational interaction in a virtual scene. Optionally, the number of virtual objects participating in the interaction in the virtual scene can be pre-set or dynamically determined according to the number of clients joining the interaction.

[0049] 3) Virtual objects: refers to objects that are moving or stationary in a virtual scene. Moving virtual objects include animals, vehicles, and people in a virtual scene. Stationary virtual objects include walls, stones, and the ground in a virtual scene.

[0050] 4) Lightmap: It is used to add the fusion of lighting textures on the basis of the original texture rendering of the object model in the virtual scene, so that the object model can be rendered with lighting effects. Lightmap is a technology that can enhance the lighting effects of static scenes.

[0051] 5) Virtual illumination point: The virtual scene point captured by the virtual camera that can be used to shoot the virtual scene is called a virtual viewpoint, and the virtual viewpoint illuminated by the virtual light is called a virtual illumination point.

[0052] 6) Virtual light: refers to the light in the virtual scene emitted by the virtual light source used to illuminate the virtual scene. The virtual light includes direct light and indirect light. The direct light is emitted by the virtual light source and reflected from the virtual illumination point to the virtual camera. The indirect light is emitted by the virtual light source and, after at least one reflection, reaches the virtual illumination point and is finally reflected from the virtual illumination point to the virtual camera.

[0053] 7) Irradiance: Also known as radiation illumination, it is the radiation flux per unit area of ​​the irradiated surface. The unit is watt per square meter (W / ㎡). The radiation illumination characterizes the amount of radiation energy received per unit area per unit time on the surface illuminated by the radiation energy, that is, the radiation flux density on the irradiated surface.

[0054] 8) RGBA: It is a color space that represents Red, Green, Blue and Alpha. Although it is sometimes described as a color space, it is actually just an RGB model with additional information. The colors used are RGB and can belong to any RGB color space.

[0055] During the implementation of the embodiments of the present application, the applicant discovered that the related technology has the following problems:

[0056] In the related art, during the process of lighting baking for a virtual scene, the lighting baking for the virtual scene is usually performed directly in combination with the direct light emitted by the virtual light source, resulting in low lighting realism of the lighting baking.

[0057] Embodiments of the present application provide a method, device, electronic device, computer-readable storage medium, and computer program product for lighting baking of a virtual scene, which can effectively improve the lighting realism of lighting baking. The following describes an exemplary application of a lighting baking system for a virtual scene provided by an embodiment of the present application.

[0058] See also Figure 1 , Figure 1 It is a schematic diagram of the architecture of the lighting baking system 100 for a virtual scene provided in an embodiment of the present application. The terminal (terminal 400 is shown as an example) is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.

[0059] The terminal 400 is used for the user to use the client 410 to display the lighting map of the virtual scene on the graphical interface 410-1 (the graphical interface 410-1 is shown as an example). The terminal 400 and the server 200 are connected to each other via a wired or wireless network.

[0060] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart TV, a smart watch, a car terminal, etc., but is not limited thereto. The electronic device provided in the embodiment of the present application may be implemented as a terminal or as a server. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present application.

[0061] In some embodiments, the server 200 obtains the virtual light corresponding to each virtual lighting point in the virtual scene, and determines the direct irradiance and indirect irradiance of each virtual lighting point, combines the direct irradiance and the indirect irradiance, performs lighting baking on the virtual scene, obtains a lighting map of the virtual scene, and sends the lighting map of the virtual scene to the terminal 400 for display.

[0062] In other embodiments, the server 200 obtains the virtual light corresponding to each virtual lighting point in the virtual scene, and determines the direct irradiance and indirect irradiance of each virtual lighting point, and sends the direct irradiance and the indirect irradiance to the terminal 400. The terminal 400 combines the direct irradiance and the indirect irradiance to perform lighting baking on the virtual scene, obtains the lighting map of the virtual scene, and displays the lighting map of the virtual scene.

[0063] In other embodiments, the embodiments of the present application can be implemented with the aid of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.

[0064] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources.

[0065] See also Figure 2 , Figure 2 is a structural diagram of an electronic device 500 for lighting baking of a virtual scene provided in an embodiment of the present application, wherein: Figure 2 The electronic device 500 shown may be Figure 1 The server 200 or the terminal 400 in Figure 2 The electronic device 500 shown includes: at least one processor 410, a memory 450, and at least one network interface 420. The various components in the electronic device 500 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 2 Various buses are labeled as bus system 440 .

[0066] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0067] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0068] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0069] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0070] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0071] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).

[0072] In some embodiments, the lighting baking device for the virtual scene provided in the embodiments of the present application can be implemented in a software manner. Figure 2 A lighting baking device 455 of a virtual scene stored in a memory 450 is shown, which may be software in the form of a program or a plug-in, and includes the following software modules: an acquisition module 4551, an indirect determination module 4552, a direct determination module 4553, and a baking module 4554. These modules are logical, and thus may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.

[0073] In other embodiments, the lighting baking device for the virtual scene provided in the embodiments of the present application can be implemented in hardware. As an example, the lighting baking device for the virtual scene provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the lighting baking method for the virtual scene provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.

[0074] In some embodiments, the terminal or server can implement the lighting baking method of the virtual scene provided in the embodiment of the present application by running a computer program or computer executable instructions. For example, the computer program can be a native program (for example, a dedicated lighting baking program) or a software module in the operating system, for example, a lighting baking module that can be embedded in any program (such as an instant messaging client, an album program, an electronic map client, a navigation client); for example, it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run. In short, the above-mentioned computer program can be an application, module or plug-in in any form.

[0075] The lighting baking method for the virtual scene provided by the embodiment of the present application will be described in combination with the exemplary application and implementation of the server or terminal provided by the embodiment of the present application.

[0076] See also Figure 3 , Figure 3 is a flow chart of a lighting baking method for a virtual scene provided in an embodiment of the present application, which will be combined with Figure 3 Steps 101 to 104 are shown for illustration. The lighting baking method for a virtual scene provided in the embodiment of the present application can be implemented by a server or a terminal alone, or by a server and a terminal in collaboration. The following will be described using the server alone as an example.

[0077] In step 101, virtual light rays corresponding to each virtual illumination point in a virtual scene are obtained.

[0078] In some embodiments, the virtual light includes a direct light having one reflection number and an indirect light having multiple reflection numbers.

[0079] In some embodiments, a virtual scene is a virtual scene displayed or provided when an application is running on a terminal. The virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiment of the present application does not limit the dimension of the virtual scene. For example, a virtual scene may include the sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities, and users can control virtual objects to move in the virtual scene.

[0080] In some embodiments, the virtual scene points captured by the virtual camera that can be used to shoot the virtual scene are called virtual viewpoints, and the virtual viewpoints illuminated by virtual light are called virtual illumination points.

[0081] In some embodiments, virtual light refers to light in a virtual scene emitted by a virtual light source used to illuminate the virtual scene, and the virtual light includes direct light and indirect light, wherein the direct light is emitted by the virtual light source and is reflected from the virtual illumination point to the virtual camera, and the indirect light is emitted by the virtual light source and, after at least one reflection, reaches the virtual illumination point and is finally reflected from the virtual illumination point to the virtual camera.

[0082] As an example, see Figure 7 , Figure 7 is a schematic diagram of the principle of the lighting baking method for a virtual scene provided in an embodiment of the present application, Figure 7 In the virtual illumination point 15 in the virtual scene shown, the direct light 13 is emitted by the virtual light source 11, and is reflected from the virtual illumination point 15 to the virtual camera 12. The number of reflections of the direct light 13 is one; the indirect light 14 is emitted by the virtual light source 11, and after two reflections, reaches the virtual illumination point 15, and finally is reflected from the virtual illumination point 15 to the virtual camera 12. The number of reflections of the indirect light is multiple ( Figure 7 The number of reflections of the indirect light 14 shown is 3).

[0083] In step 102, the indirect irradiance of each virtual illumination point is determined based on the indirect light corresponding to the virtual illumination point and the light shielding factor of the virtual illumination point.

[0084] In some embodiments, irradiance, also known as radiation illumination, is the radiation flux per unit area of ​​the illuminated surface (for example, the illuminated area corresponding to the virtual illumination point), and the unit is watt per square meter (W / ㎡). The radiation illumination characterizes the amount of radiation energy received per unit area per unit time on the surface illuminated by the radiation energy, that is, the radiation flux density on the illuminated surface.

[0085] In some embodiments, the light shielding factor is used to indicate the irradiance effect of a virtual occluder of a virtual illumination point on the virtual illumination point, and the indirect irradiance is used to indicate the irradiance effect of indirect light on the virtual illumination point.

[0086] In some embodiments, the indirect irradiance is used to indicate the irradiance effect of the indirect light of the virtual illumination point and the virtual occluder corresponding to the virtual illumination point on the virtual illumination point.

[0087] In some embodiments, the light shielding factor is involved in the determination of indirect irradiance, so that the indirect irradiance of the determined virtual lighting point can fully consider the irradiance effect of the virtual occluders on the virtual lighting point. For example, a virtual lighting point surrounded by a large number of virtual occluders appears darker, while a virtual lighting point with only a small number of occluders around it appears brighter.

[0088] In some embodiments, each virtual illumination point corresponds to at least one indirect ray, see Figure 4 , Figure 4 is a flow chart of a lighting baking method for a virtual scene provided in an embodiment of the present application, Figure 3 The step 102 shown can be performed for each virtual illumination point separately. Figure 4 Steps 1021 to 1023 are implemented as shown.

[0089] In step 1021, the initial irradiance of each indirect light corresponding to the virtual illumination point is determined respectively.

[0090] In some embodiments, the initial irradiance of each indirect light corresponding to the virtual illumination point is used to indicate the irradiance effect of the corresponding indirect light on the virtual illumination point.

[0091] In some embodiments, the above step 1021 can be implemented as follows: the following processing is performed for each indirect light corresponding to the virtual illumination point: the reflection path of the indirect light and the first light source radiation energy of the virtual light source corresponding to the indirect light are obtained; wherein the starting point of the reflection path is the position of the virtual light source in the virtual scene, the end point of the reflection path is the position of the virtual camera used to shoot the virtual scene in the virtual scene, and the virtual illumination point is located on the reflection path; based on the reflection path of the indirect light, a first irradiance loss value of the indirect light is determined, and the first irradiance loss value is used to indicate the loss of the light source radiation energy in the reflection path; the difference between the first light source radiation energy and the first irradiance loss value is determined as the initial irradiance of the indirect light.

[0092] In some embodiments, radiation energy refers to the sum of electric field energy and magnetic field energy in electromagnetic waves, also known as electromagnetic wave energy. Solar radiation is emitted to the earth at the speed of light (c = 3 × 10^8 m / s), and it has both particle and wave characteristics. In the natural geographical system, the reception and storage of radiation energy are inseparable from these characteristics. For example, when green plants perform photosynthesis, the energy absorbed is in the form of light quanta. It is precisely because of this quantum characteristic of radiation energy that the size of quantum energy depends on the wavelength and frequency.

[0093] In some embodiments, the light source radiation energy refers to the radiation energy emitted by a virtual light source. The value of the light source radiation energy is proportional to the radiation power of the virtual light source. Different virtual light sources correspond to different light source radiation energies.

[0094] As an example, see Figure 7 For the reflection path of the indirect light 14, the starting point of the reflection path of the indirect light 14 is the position of the virtual light source 11 in the virtual scene, and the end point of the reflection path of the indirect light 14 is the position of the virtual camera 12 used to shoot the virtual scene in the virtual scene. The virtual illumination point 15 is located on the reflection path.

[0095] As an example, see Figure 7 The first irradiance loss value of the indirect light 14 is used to indicate the loss of the light source radiation energy of the virtual light source 11 in the reflection path of the indirect light 14. The difference between the first light source radiation energy of the virtual light source 11 and the first irradiance loss value of the indirect light 14 is determined as the initial irradiance of the indirect light 14.

[0096] In some embodiments, the first radiation loss value of the indirect light is positively correlated with the length of the indirect light. The longer the length of the indirect light, the more propagation media the light encounters on the reflection path of the indirect light, the more radiation energy the propagation medium absorbs, and the larger the radiation loss value; the shorter the length of the indirect light, the less propagation media the light encounters on the reflection path of the indirect light, the less radiation energy the propagation medium absorbs, and the smaller the radiation loss value.

[0097] In some embodiments, the reflection path of the indirect light includes at least two reflection midpoints and at least three reflection sub-paths, the reflection midpoints are on the reflection path, and are used for the indirect light to form light reflection, and at least two reflection midpoints include virtual illumination points.

[0098] As an example, see Figure 7 The reflection path of the indirect light 14 includes at least two reflection midpoints (reflection midpoint 141, reflection midpoint 142 and virtual illumination point 15) and at least three reflection sub-paths (reflection sub-path 143, reflection sub-path 144, reflection sub-path 145 and reflection sub-path 146). The reflection midpoint 141, the reflection midpoint 142 and the virtual illumination point 15 are on the reflection path, which is used for the indirect light 14 to form light reflection.

[0099] In some embodiments, the above-mentioned determination of the first radiation loss value of indirect light based on the reflection path of indirect light can be achieved in the following manner: obtaining a first radiation absorption value corresponding to each reflection midpoint in the reflection path, wherein the first radiation absorption value is used to indicate the degree of energy absorption of the radiation energy of the light source by the reflection midpoint, and the numerical value of the first radiation absorption value is associated with the virtual material corresponding to the reflection midpoint; determining a second radiation absorption value corresponding to each reflection subpath based on the length of each reflection subpath in the reflection path, wherein the second radiation absorption value is used to indicate the degree of energy absorption of the radiation energy of the light source by the propagation medium on the reflection subpath, and the numerical value of the second radiation absorption value is positively correlated with the length of the corresponding reflection subpath; and summing each first radiation absorption value and each second radiation absorption value to obtain a first radiation loss value.

[0100] In some embodiments, the virtual materials corresponding to the reflection midpoint are different, and the corresponding first radiation absorption values ​​are different. For example, when the virtual material is "metal", the corresponding first radiation absorption value is less than when the virtual material is "cloth material". This is because the radiation absorption rate corresponding to the "metal" material is lower, and the corresponding radiation reflectivity is higher. The radiation absorption rate corresponding to the "cloth material" is higher, but the corresponding radiation reflectivity is lower. The radiation absorption value is inversely proportional to the radiation reflectivity, and the radiation absorption value is inversely proportional to the radiation absorption rate.

[0101] In some embodiments, the second radiation absorption value is used to indicate the degree of absorption of the radiation energy of the light source by the propagation medium on the reflection sub-path. The longer the reflection sub-path, the more propagation media the light encounters during propagation, and the propagation medium absorbs the radiation energy of the light source. Therefore, the numerical value of the second radiation absorption value is positively correlated with the length of the corresponding reflection sub-path. The longer the length of the reflection sub-path, the larger the numerical value of the corresponding second radiation absorption value, and the shorter the length of the reflection sub-path, the smaller the numerical value of the corresponding second radiation absorption value.

[0102] In step 1022, each initial irradiance is summed to obtain a first irradiance corresponding to the virtual illumination point.

[0103] In some embodiments, the initial irradiance corresponds one-to-one to the indirect light of the virtual illumination point. Each indirect light of the virtual illumination point corresponds to an initial irradiance. The summed result obtained by summing the initial irradiances indicates the overall irradiance influence of the indirect light of the virtual light point on the virtual illumination point. Therefore, the summed result is the first irradiance corresponding to the virtual illumination point. The first irradiance indicates the overall irradiance influence of the indirect light of the virtual light point on the virtual illumination point.

[0104] In step 1023, the first irradiance is adjusted based on the light shielding factor of the virtual illumination point to obtain the indirect irradiance of the virtual illumination point.

[0105] In some embodiments, the first irradiance is adjusted by the light shielding factor of the virtual illumination point, and the obtained indirect irradiance of the virtual illumination point can fully reflect the irradiance effect of the virtual occluder of the virtual illumination point on the virtual illumination point, so that the determined indirect irradiance of the virtual illumination point can more realistically restore the lighting environment.

[0106] In some embodiments, the value range of the light shielding factor is between 0 and 1. When the light shielding factor is 1, there is no virtual occluder that has an irradiation effect on the virtual lighting point, the adjustment amplitude of the first irradiance is 0, and the numerical value of the indirect irradiance is equal to the numerical value of the first irradiance. When the light shielding factor is 0, there is a virtual occluder that has an irradiation effect on the virtual lighting point, and the degree of influence is the greatest, so that the numerical value of the adjusted indirect irradiance is equal to 0.

[0107] In some embodiments, the above step 1023 can be implemented as follows: multiply the light shielding factor of the virtual illumination point by the first irradiance to obtain the blocked irradiance of the virtual illumination point, where the value range of the light shielding factor is between 0 and 1; and determine the difference between the first irradiance and the blocked irradiance as the indirect irradiance of the virtual illumination point.

[0108] As an example, when the light shielding factor of the virtual illumination point is equal to 0.5 and the first irradiance is equal to 500, the occlusion irradiance of the virtual illumination point is equal to 250, and the difference of 250 between the first irradiance and the occlusion irradiance is determined as the indirect irradiance of the virtual illumination point.

[0109] As an example, when the light shielding factor of the virtual illumination point is equal to 1 and the first irradiance is equal to 500, the occluded irradiance of the virtual illumination point is equal to 500, and the difference between the first irradiance and the occluded irradiance is 0, which is determined as the indirect irradiance of the virtual illumination point. At this time, there is a virtual occluder that has an irradiance effect on the virtual illumination point, and the degree of influence is the greatest.

[0110] As an example, when the light shielding factor of the virtual illumination point is equal to 0 and the first irradiance is equal to 500, the occluded irradiance of the virtual illumination point is equal to 0, and the difference of 500 between the first irradiance and the occluded irradiance is determined as the indirect irradiance of the virtual illumination point. At this time, there is no virtual occluder that has an irradiance effect on the virtual illumination point.

[0111] In this way, by multiplying the light shielding factor of the virtual lighting point and the first irradiance, the occlusion irradiance of the virtual lighting point is obtained, and the difference between the first irradiance and the occlusion irradiance is determined as the indirect irradiance of the virtual lighting point. Therefore, the irradiance effect of the virtual occluder on the virtual lighting point can be accurately determined through the light shielding factor, and the irradiance effect of the virtual occluder on the virtual lighting point is superimposed on the irradiance effect of the indirect light on the virtual lighting point, so that the determined indirect irradiance of the virtual lighting point can more realistically restore the lighting environment.

[0112] In some embodiments, before the above-mentioned step 102, the light shielding factor can also be determined in the following manner: the following processing is performed for each virtual illumination point: from each virtual viewpoint of the virtual scene, multiple target virtual viewpoints associated with the virtual illumination point are selected; with the virtual illumination point as the starting point and each target virtual viewpoint as the end point, detection rays corresponding to each target virtual viewpoint are generated; when the detection ray intersects with the virtual occluder, the detection ray is determined as a blocked detection ray; the number of blocked detection rays is divided by the number of multiple detection rays, and the division result is determined as the light shielding factor of the virtual illumination point.

[0113] In some embodiments, the virtual viewpoint is a virtual scene point in the virtual scene that can be captured by a virtual camera. There is no virtual blind spot on the line connecting the target virtual viewpoint and the virtual illumination point. The virtual blind spot is a virtual scene point in the virtual scene that cannot be captured by a virtual camera.

[0114] As an example, see Figure 8 , Figure 8 is a schematic diagram of the principle of the lighting baking method for a virtual scene provided in an embodiment of the present application, Figure 8In the virtual object 23 in the virtual scene shown, the virtual scene point 21 is located on the surface of the virtual object 23 and can be captured by the virtual camera. Therefore, the virtual scene point 21 is the virtual viewpoint of the virtual scene. Figure 8 In the virtual object 23 in the virtual scene shown, the virtual scene point 22 is located inside the virtual object 23. When the virtual object 23 is non-transparent, the virtual scene point 22 cannot be captured by the virtual camera. Therefore, the virtual scene point 22 is a virtual blind spot of the virtual scene.

[0115] In this way, by determining the proportion of the number of blocked detection rays to the number of detection rays, the light shielding factor of the determined virtual lighting point can be made. Since the blocked detection rays can accurately indicate the radiation effect of the virtual occluder on the virtual lighting point, the determined light shielding factor can accurately reflect the degree of radiation effect of the virtual occluder on the virtual lighting point, so that the indirect irradiance of the determined virtual lighting point can more realistically restore the lighting environment.

[0116] In step 103, the direct irradiance of each virtual illumination point is obtained.

[0117] In some embodiments, direct irradiance is used to indicate the irradiance impact of direct light on the virtual illumination point.

[0118] In some embodiments, a virtual viewpoint illuminated by virtual light is called a virtual lighting point. The virtual light includes direct light and indirect light. In a real lighting environment (except for special lighting environments such as a vacuum lighting environment), there must be indirect light in the virtual light of the virtual lighting point. There may or may not be direct light, that is, each virtual lighting point corresponds to at least zero indirect light.

[0119] In some embodiments, see Figure 5 , Figure 5 is a flow chart of a lighting baking method for a virtual scene provided in an embodiment of the present application, Figure 3 The step 103 shown can be performed for each virtual illumination point separately. Figure 5 Steps 1031 to 1034 are implemented as shown.

[0120] In step 1031, when the virtual light rays to which the virtual light point belongs do not include direct light rays, the value of the direct irradiance of the virtual light point is determined to be zero.

[0121] In some embodiments, when the virtual light rays to which the virtual illumination point belongs do not include direct light rays, no direct light rays have an irradiance effect on the virtual illumination point, that is, the value of the direct irradiance of the virtual illumination point is zero.

[0122] In step 1032, when the virtual light rays to which the virtual illumination point belongs include direct light rays, the initial irradiance of each direct light ray is determined.

[0123] In some embodiments, the direct light included in the virtual light is in a one-to-one correspondence with the virtual light source in the virtual scene.

[0124] In some embodiments, the initial irradiance of each direct light ray corresponding to the virtual illumination point is used to indicate the irradiance effect of the corresponding direct light ray on the virtual illumination point.

[0125] In some embodiments, the above step 1032 can be implemented as follows: the following processing is performed for each direct light included in the virtual light: the reflection path of the direct light and the second light source radiation energy of the virtual light source corresponding to the direct light are obtained; wherein, the starting point of the reflection path is the position of the virtual light source in the virtual scene, the end point of the reflection path is the position of the virtual camera used to shoot the virtual scene in the virtual scene, and the virtual illumination point is located on the reflection path; based on the reflection path of the direct light, the second irradiance loss value of the direct light is determined, and the second irradiance loss value is used to indicate the loss of the light source radiation energy in the reflection path; the difference between the second light source radiation energy and the second irradiance loss value is determined as the initial irradiance of the direct light.

[0126] In some embodiments, the light source radiation energy refers to the radiation energy emitted by the virtual light source. The value of the light source radiation energy is proportional to the radiation power of the virtual light source. Different virtual light sources correspond to different light source radiation energies, and different direct light rays correspond to different virtual light sources.

[0127] As an example, see Figure 7 For the reflection path of the direct light 13, the starting point of the reflection path of the direct light 13 is the position of the virtual light source 11 in the virtual scene, and the end point of the reflection path of the direct light 13 is the position of the virtual camera 12 in the virtual scene for shooting the virtual scene. The virtual illumination point 15 is located on the reflection path.

[0128] As an example, see Figure 7 , for the first irradiance loss value of the direct light 13, it is used to indicate the loss of the light source radiation energy of the virtual light source 11 in the reflection path of the direct light 13, and the difference between the first light source radiation energy of the virtual light source 11 and the first irradiance loss value of the direct light 13 is determined as the initial irradiance of the direct light 13.

[0129] In some embodiments, the first radiation loss value of the direct light is positively correlated with the length of the direct light. The longer the length of the direct light, the more propagation media the light encounters on the reflection path of the direct light, the more the propagation medium absorbs the radiation energy, and the larger the radiation loss value; the shorter the length of the direct light, the less propagation media the light encounters on the reflection path of the direct light, the less the propagation medium absorbs the radiation energy, and the smaller the radiation loss value.

[0130] In some embodiments, the reflection path of the direct light includes two reflection sub-paths and a virtual illumination point.

[0131] As an example, see Figure 7 The reflection path of the direct light includes two reflection sub-paths (reflection sub-path 131 and reflection sub-path 132) and a virtual illumination point 15.

[0132] In some embodiments, the above-mentioned determination of the second radiation loss value of the direct light based on the reflection path of the direct light can be achieved in the following manner: obtaining a third radiation absorption value corresponding to a virtual illumination point in the reflection path, the third radiation absorption value being used to indicate the degree to which the virtual illumination point absorbs the energy of the radiation energy of the light source; determining a fourth radiation absorption value corresponding to each reflection sub-path based on the length of each reflection sub-path in the reflection path, wherein the fourth radiation absorption value is used to indicate the degree to which the propagation medium on the reflection sub-path absorbs the energy of the radiation energy of the light source, and the numerical value of the fourth radiation absorption value is positively correlated with the length of the corresponding reflection sub-path; and summing the third radiation absorption value and each fourth radiation absorption value to obtain a second radiation loss value.

[0133] In some embodiments, the value of the third radiation absorption value is associated with the virtual material corresponding to the virtual illumination point. Different virtual materials correspond to different third radiation absorption values. For example, when the virtual material is "metal", the corresponding third radiation absorption value is smaller than when the virtual material is "cloth material". This is because the radiation absorption rate corresponding to the "metal" material is lower, and the corresponding radiation reflectivity is higher. The radiation absorption rate corresponding to the "cloth material" is higher, but the corresponding radiation reflectivity is lower. The radiation absorption value is inversely proportional to the radiation reflectivity, and the radiation absorption value is inversely proportional to the radiation absorption rate.

[0134] In some embodiments, the fourth radiation absorption value is used to indicate the degree of absorption of the energy of the light source radiation energy by the propagation medium on the reflection sub-path. The longer the reflection sub-path, the more propagation media the light encounters during propagation, and the propagation medium absorbs the energy of the light source radiation energy. Therefore, the numerical value of the fourth radiation absorption value is positively correlated with the length of the corresponding reflection sub-path. The longer the length of the reflection sub-path, the larger the numerical value of the corresponding fourth radiation absorption value, and the shorter the length of the reflection sub-path, the smaller the numerical value of the corresponding fourth radiation absorption value.

[0135] In step 1033, the initial irradiances corresponding to the direct rays are summed to obtain a second irradiance corresponding to the virtual illumination point.

[0136] In some embodiments, the initial irradiance corresponds one-to-one to the direct light of the virtual illumination point, and each direct light of the virtual illumination point corresponds to an initial irradiance. The summed result obtained by summing the initial irradiances indicates the overall irradiance influence of the direct light rays of the virtual light point on the virtual illumination point. Therefore, the summed result is the second irradiance corresponding to the virtual illumination point, and the second irradiance indicates the overall irradiance influence of the direct light rays of the virtual light point on the virtual illumination point.

[0137] In step 1034, the second irradiance is adjusted based on the light shielding factor of the virtual illumination point to obtain the direct irradiance of the virtual illumination point.

[0138] In some embodiments, direct irradiance is used to indicate the irradiance effect of direct light of a virtual illumination point and a virtual occluder corresponding to the virtual illumination point on the virtual illumination point.

[0139] In some embodiments, the second irradiance is adjusted by the light shielding factor of the virtual illumination point, and the obtained direct irradiance of the virtual illumination point can fully reflect the irradiance effect of the virtual occluder of the virtual illumination point on the virtual illumination point, so that the determined direct irradiance of the virtual illumination point can more realistically restore the lighting environment.

[0140] In this way, since the light shielding factor of the virtual light point is directly involved in the calculation process of the irradiance, there is no need to save the light shielding factor separately, thus avoiding the occupation of memory space and making baking more efficient.

[0141] In some embodiments, the value range of the light shielding factor is between 0 and 1. When the light shielding factor is 1, there is no virtual occluder that has an irradiation effect on the virtual lighting point, the adjustment amplitude of the first irradiance is 0, and the numerical value of the indirect irradiance is equal to the numerical value of the first irradiance. When the light shielding factor is 0, there is a virtual occluder that has an irradiation effect on the virtual lighting point, and the degree of influence is the greatest, so that the numerical value of the adjusted indirect irradiance is equal to 0.

[0142] In some embodiments, the above step 1034 can be implemented as follows: multiply the light shielding factor of the virtual illumination point and the second irradiance to obtain the blocked irradiance of the virtual illumination point, where the value range of the light shielding factor is between 0 and 1, and determine the difference between the second irradiance and the blocked irradiance as the indirect irradiance of the virtual illumination point.

[0143] As an example, when the light shielding factor of the virtual illumination point is equal to 0.5 and the second irradiance is equal to 500, the occluded irradiance of the virtual illumination point is equal to 250, and the difference of 250 between the second irradiance and the occluded irradiance is determined as the direct irradiance of the virtual illumination point.

[0144] As an example, when the light shielding factor of the virtual illumination point is equal to 1 and the second irradiance is equal to 500, the occluded irradiance of the virtual illumination point is equal to 500, and the difference between the second irradiance and the occluded irradiance is 0, which is determined as the direct irradiance of the virtual illumination point. At this time, there is a virtual occluder that has an irradiance effect on the virtual illumination point, and the degree of influence is the greatest.

[0145] As an example, when the light shielding factor of the virtual illumination point is equal to 0 and the second irradiance is equal to 500, the occluded irradiance of the virtual illumination point is equal to 0, and the difference of 500 between the second irradiance and the occluded irradiance is determined as the direct irradiance of the virtual illumination point. At this time, there is no virtual occluder that has an irradiance effect on the virtual illumination point.

[0146] In this way, by multiplying the light shielding factor of the virtual light point and the second irradiance, the occluded irradiance of the virtual light point is obtained, and the difference between the second irradiance and the occluded irradiance is determined as the direct irradiance of the virtual light point. Therefore, the irradiance effect of the virtual occluder on the virtual light point can be accurately determined through the light shielding factor, and the irradiance effect of the virtual occluder on the virtual light point is superimposed on the irradiance effect of the direct light on the virtual light point, so that the determined direct irradiance of the virtual light point can more realistically restore the lighting environment.

[0147] In step 104, the virtual scene is illuminated by baking the indirect irradiance and the direct irradiance to obtain a lighting map of the virtual scene.

[0148] In some embodiments, the principle of light baking is to project the intensity, color and shading information of the light according to the UV (texture coordinate) arrangement of the model in the scene into the light map composed of the UV of the model for storage, and obtain the light map of the virtual scene. A light map represents an area used to map the UV of the model.

[0149] In some embodiments, see Figure 6 , Figure 6 is a flow chart of a lighting baking method for a virtual scene provided in an embodiment of the present application, Figure 3 Step 104 shown may be performed by executing Figure 6 Steps 1041 to 1043 are implemented as shown.

[0150] In step 1041, for each virtual illumination point, the direct irradiance and the indirect irradiance of the virtual illumination point are added together to obtain the overall irradiance of the virtual illumination point.

[0151] In some embodiments, the overall irradiance of the virtual illumination point is used to indicate the irradiance impact of the direct light of the virtual illumination point, the indirect light of the virtual illumination point, and the virtual occluder corresponding to the virtual illumination point on the virtual illumination point.

[0152] In step 1042, the ratio of the indirect irradiance to the overall irradiance is determined as the indirect light ratio of the virtual illumination point.

[0153] In some embodiments, the numerical value of the overall irradiance is greater than or equal to the numerical value of the indirect irradiance. When the direct irradiance of the virtual illumination point is equal to zero, the numerical value of the overall irradiance is equal to the numerical value of the indirect irradiance, and the indirect brightness ratio of the virtual illumination point is equal to 1; when the direct irradiance of the virtual illumination point is greater than zero, the numerical value of the overall irradiance is greater than the numerical value of the indirect irradiance, and the indirect brightness ratio of the virtual illumination point is less than 1.

[0154] In step 1043, based on the indirect light ratio of each virtual light point, lighting baking is performed on the virtual scene to obtain a lighting map of the virtual scene.

[0155] In some embodiments, the above step 1043 can be implemented as follows: perform lighting baking on the virtual scene to obtain an initial lighting map of the virtual scene, write the indirect lighting ratio of each virtual lighting point into the transparency channel of the initial lighting map, and obtain the lighting map of the virtual scene.

[0156] In some embodiments, a transparency channel, also known as an alpha channel (αChannel or Alpha Channel), refers to the transparency and translucency of an image. For example: a bitmap that uses 16 bits per pixel for storage, for each pixel in the graphic, may use 5 bits to represent red, 5 bits to represent green, 5 bits to represent blue, and the last bit is alpha. In this case, it either represents transparency or not, because the alpha bit has only two different possibilities of representation, 0 or 1. Another example is a bitmap that uses 32 bits for storage, with every 8 bits representing red, green, blue, and the alpha channel. In this case, not only can it represent transparency or opacity, but the alpha channel can also represent 256 levels of translucency, because the alpha channel has 8 bits and can have 256 different data representation possibilities.

[0157] In this way, by writing the indirect light ratio of each virtual light point into the transparency channel of the initial light map, the light map of the virtual scene is obtained. When rendering is subsequently performed based on the light map, the indirect light ratio of each virtual light point can be directly read from the transparency channel. A more accurate indirect light intensity can be inferred through the indirect light ratio, so that the rendered rendering map can more accurately reflect the lighting conditions of the virtual scene and can more realistically restore the lighting environment.

[0158] In some embodiments, after the above step 104, the virtual scene can also be rendered in the following manner: information sampling is performed on each channel of the illumination map of the virtual scene to obtain channel information of each channel of the illumination map, wherein the channel information records the indirect light ratio of each virtual illumination point; based on the indirect light ratio, the brightness of each virtual illumination point in the virtual scene is determined; based on the brightness of each virtual illumination point, the virtual scene is rendered to obtain a rendering map of the virtual scene, and the rendering map is used for a display device to display an image of the virtual scene.

[0159] In some embodiments, the channel information records the indirect light ratio of each virtual light point and the color information of the virtual light point. The brightness of each virtual light point in the virtual scene is determined based on the indirect light ratio. The following processing can be performed on each virtual light point: the indirect light ratio of the virtual light point and the color information of the virtual light point are multiplied, and the multiplication result is determined as the brightness of the virtual light point.

[0160] As an example, the brightness of the virtual illumination point can be expressed as:

[0161] Luminance = dot(LinearColor,float3(0.3,0.59,0.11)) (1)

[0162] Among them, Luminance is used to indicate the brightness of the virtual lighting point, dot is used to indicate the multiplication process, LinearColor is used to indicate the color information of the virtual lighting point, and float3(0.3, 0.59, 0.11) is used to indicate the brightness of the virtual lighting point.

[0163] In this way, the indirect irradiance of the virtual lighting point is determined through the light shielding factor and indirect light of the virtual lighting point, and the direct irradiance is obtained. The virtual scene is light-baked through the direct irradiance and the indirect irradiance to obtain the lighting map of the virtual scene. In this way, since the light shielding factor can accurately reflect the irradiation effect of the virtual occluder of the virtual lighting point on the virtual lighting point, the realism of the determined indirect irradiance is higher. The virtual scene is light-baked through the determined high-realism direct irradiance and indirect irradiance, so that the direct irradiance and the indirect irradiance can be accurately light-baked respectively during the lighting baking process, so that the obtained lighting map can accurately record the baking results of the direct light and the indirect light, thereby effectively improving the lighting realism of the lighting baking.

[0164] The following is an explanation of an exemplary application of the embodiments of the present application in an actual online game application scenario.

[0165] In the game scene, in order to avoid real-time lighting calculations when the game is running, lighting baking is an indispensable process. The principle of lighting baking is to arrange the intensity, color and occlusion information of the light according to the UV (texture coordinates) of the model in the scene, and project it into the lighting map composed of the UV of the model for storage to obtain the baking result. In the subsequent game running process, the baking result can be directly rendered to the model to improve the running efficiency of the game.

[0166] Through the lighting baking method for virtual scenes provided in the embodiments of the present application, lighting calculations are optimized without increasing the memory / package size of the Lightmap and almost without increasing the complexity of real-time rendering calculations, making the lighting effect more natural. During the baking calculation process, direct light and indirect light are distinguished, and the brightness ratio of the indirect light is written into the Alpha channel (transparency channel). During real-time rendering, a more accurate indirect light intensity can be inferred by directly reading the Alpha channel information. The calculation results of ambient highlights that have a large impact on the picture and are affected by the indirect light intensity will be more reasonable, and the scene lighting will look more natural. AO calculations are performed during the lighting baking process, and the AO results are applied to direct light and indirect light. That is, the AO results will be reflected in the color data of the Lightmap, but there is no need to save the AO map additionally. This can improve the three-dimensional sense of the picture without increasing the memory / package size.

[0167] In some embodiments, see Fig. 9 , Fig. 9 is a flow chart of a lighting baking method for a virtual scene provided in an embodiment of the present application, which can be performed by Fig. 9 Steps 201 to 204 shown implement lighting baking.

[0168] In step 201, the scene editor collects and exports scenes and materials.

[0169] In step 202, lighting is baked.

[0170] In some embodiments, the above step 202 can be implemented as follows: the scene editor sends the exported scene and material to the scene baker through the baking server, and the scene baker bakes the lighting of the virtual scene based on the scene and material to obtain baking data.

[0171] In step 203, the scene baker exports the baking data.

[0172] In step 204, the scene editor saves the baked data.

[0173] In some embodiments, the above step 204 can be implemented in the following manner: the scene baker sends the exported baking data to the scene editor via the baking server, and the scene editor receives and saves the baking data.

[0174] In some embodiments, lighting baking is implemented based on a scene baker. Lighting baking involves two processes, a scene editor and a scene baker. The scene data and related settings of the scene editor are exported to the scene baker. After the scene baker is completed, the baking results are exported to the scene editor. The scene editor organizes and saves the baking results by itself, thus completing a baking process.

[0175] In some embodiments, see Fig.10 , Fig.10 is a flow chart of a lighting baking method for a virtual scene provided in an embodiment of the present application. The lighting baking method for a virtual scene provided in an embodiment of the present application can be performed by Fig.10 Steps 301 to 303 are shown to be implemented.

[0176] In step 301 , AO calculation is turned on, but the option of saving the AO map is not enabled.

[0177] In some embodiments, AO is not baked by default in the scene settings. You need to enable AO calculation in the scene's WorldSettings, but do not enable the option to save the AO map. This allows the AO calculation to be directly superimposed on the Lightmap without saving the AO map to occupy additional memory.

[0178] As an example, see Fig.11 , Fig.11 It is a schematic diagram of the principle of the lighting baking method for a virtual scene provided by an embodiment of the present application. In response to the selection operation of the selection control 51 for turning on the AO calculation, the AO calculation is turned on. Check control 51, but do not check control 52. Checking control 51 will allow the scene baker to perform AO calculations during the lighting baking process and apply the AO results to direct light and indirect light, that is, the AO results will be reflected in the color data of the lighting map. Not checking control 52 means that the scene editor will not save the AO map during the process of importing and saving the baking results, so that AO will not occupy additional memory and package size.

[0179] In step 302, the indirect light ratio is recorded into the transparency channel during baking.

[0180] In some embodiments, direct light and indirect light are distinguished, and the proportion of indirect light brightness to overall brightness is recorded in the transparency channel of the final color. The lighting calculation of the lighting map in the scene baker can be implemented by the following function: FStaticLightingSystem::ProcessTextureMapping(FStaticLightingTextureMapping*TextureMapping), which presents the process of direct light and indirect light calculation. Direct light can be calculated by ray capture, and indirect light can be implemented by photon mapping algorithm.

[0181] In step 303, the baking results are saved to each sub-level.

[0182] In some embodiments, the Lightmap baking results are saved to each sub-level instead of all being saved to the main level of the scene. Saving to sub-levels is beneficial to LevelStreaming and reduces runtime memory.

[0183] In some embodiments, see Fig.12 , Fig.12 Schematic diagram of the principle of the lighting baking method for a virtual scene provided in an embodiment of the present application. Fig.12 Steps 401 to 403 shown implement picture rendering.

[0184] In step 401, a light map is sampled.

[0185] In step 402, the RGB information is decoded, the transparency channel information is read, and the brightness is calculated.

[0186] In step 403, subsequent illumination calculation is performed.

[0187] Real-time rendering samples the Lightmap and obtains RGBA information. The RGB color information of the Lightmap has a wide range of values, which requires additional encoding and decoding. However, the Alpha information records the proportion of indirect light brightness, with a range of [0,1.0f], which can be used directly without additional encoding and decoding.

[0188] The brightness of indirect light is the color brightness after Lightmap decoding multiplied by the indirect light brightness ratio, that is, the Alpha value.

[0189] The brightness calculation can be achieved by the following formula:

[0190] Luminance = dot(LinearColor, float3(0.3,0.59,0.11)) (2)

[0191] Among them, Luminance represents brightness, dot represents multiplication processing, LinearColor represents color brightness, and float3(0.3, 0.59, 0.11) represents brightness. After obtaining the corrected indirect light brightness, you can continue with the subsequent IBLSpecular and other lighting calculations.

[0192] In some embodiments, light baking is widely used in various game projects and is an important global illumination technology. The embodiment of the present application solves the problem of abnormal lighting caused by not distinguishing between direct light and indirect light during the light baking process, and provides practical skills for enhancing the AO effect without adding extra memory, so that the picture performance of the scene using Lightmap can be taken to a higher level. At present, Lightmap baking adopts the CPU baking method of UnrealLightmass, and the GPU baking method can be considered. If the project's customized lighting process requires the use of Lightmap's AO, both the AO information and the indirect light ratio information can be saved to the Alpha channel at the same time. AO takes the value of [0,1.0f], and the indirect light ratio takes the value of [0,1.0f]. These two values ​​can be linearly mapped and designed so that the former occupies [0,0.5f] and the latter occupies [0.5f,1.0f]. The absolute value is small, the floating point precision is high, and the numerical value has almost no deviation. Another common technology for improving the expressiveness of light maps is Directional Lightmap. When the static objects in the scene have a high-frequency normalmap, the expressiveness of concave and convex details can be improved. There are many ways to achieve this. UE4 has a ready-made method to improve the details of the bumps, which is to record the Directional SH information in the Lightmap, which is essentially the second-order SH coefficient. The signal frequency enhances the expressiveness of the details. However, when the Directional SH information does not significantly improve the picture, the Directional SH information can be removed from the Lightmap, which can save 50% of the Lightmap memory and reduce the package size.

[0193] Through the light shielding factor and indirect light of the virtual light point, the indirect irradiance of the virtual light point is determined, and the direct irradiance is obtained. Through the direct irradiance and the indirect irradiance, the virtual scene is light-baked to obtain the lighting map of the virtual scene. In this way, since the light shielding factor can accurately reflect the irradiation effect of the virtual occluder of the virtual light point on the virtual light point, the realism of the determined indirect irradiance is higher. Through the determined high-realism direct irradiance and indirect irradiance, the virtual scene is light-baked, so that the direct irradiance and the indirect irradiance can be accurately light-baked respectively during the light-baking process, so that the obtained light map can accurately record the baking results of the direct light and the indirect light, thereby effectively improving the lighting realism of the light baking.

[0194] It is understandable that in the embodiments of the present application, related data such as virtual scenes are involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0195] The following is a description of an exemplary structure of a virtual scene lighting baking device 455 provided in an embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules in the lighting baking device 455 of the virtual scene stored in the memory 450 may include: an acquisition module 4551, used to obtain virtual light corresponding to each virtual lighting point in the virtual scene, the virtual light including direct light with one reflection number and indirect light with multiple reflection numbers; an indirect determination module 4552, used to determine the indirect irradiance of each virtual lighting point based on the indirect light corresponding to the virtual lighting point and the light shielding factor of the virtual lighting point; wherein the light shielding factor is used to indicate the irradiance effect of the virtual occluder of the virtual lighting point on the virtual lighting point, and the indirect irradiance is used to indicate the irradiance effect of the indirect light on the virtual lighting point; a direct determination module 4553, used to obtain the direct irradiance of each virtual lighting point, wherein the direct irradiance is used to indicate the irradiance effect of the direct light on the virtual lighting point; a baking module 4554, used to combine the indirect irradiance and the direct irradiance to perform lighting baking on the virtual scene to obtain a lighting map of the virtual scene.

[0196] In some embodiments, each virtual illumination point corresponds to at least one indirect light ray, and the above-mentioned indirect determination module 4552 is used to perform the following processing for each virtual illumination point: determine the initial irradiance of each indirect light ray corresponding to the virtual illumination point; sum up the initial irradiances to obtain the first irradiance corresponding to the virtual illumination point; adjust the first irradiance based on the light shielding factor of the virtual illumination point to obtain the indirect irradiance of the virtual illumination point.

[0197] In some embodiments, the above-mentioned indirect determination module 4552 is also used to perform the following processing for each indirect light corresponding to the virtual illumination point: obtain the reflection path of the indirect light, and the first light source radiation energy of the virtual light source corresponding to the indirect light; wherein, the starting point of the reflection path is the position of the virtual light source in the virtual scene, and the end point of the reflection path is the position of the virtual camera used to shoot the virtual scene in the virtual scene, and the virtual illumination point is located on the reflection path; based on the reflection path of the indirect light, determine the first irradiance loss value of the indirect light, the first irradiance loss value is used to indicate the loss of the light source radiation energy in the reflection path; determine the difference between the first light source radiation energy and the first irradiance loss value as the initial irradiance of the indirect light.

[0198] In some embodiments, the reflection path of indirect light includes at least two reflection midpoints and at least three reflection sub-paths. The reflection midpoint is on the reflection path and is used for indirect light to form light reflection. At least two reflection midpoints include a virtual illumination point. The above-mentioned indirect determination module 4552 is also used to obtain a first radiation absorption value corresponding to each reflection midpoint in the reflection path, wherein the first radiation absorption value is used to indicate the degree of energy absorption of the light source radiation energy by the reflection midpoint, and the numerical value of the first radiation absorption value is associated with the virtual material corresponding to the reflection midpoint. Based on the length of each reflection sub-path in the reflection path, the second radiation absorption value corresponding to each reflection sub-path is determined, wherein the second radiation absorption value is used to indicate the degree of energy absorption of the light source radiation energy by the propagation medium on the reflection sub-path, and the numerical value of the second radiation absorption value is positively correlated with the length of the corresponding reflection sub-path. Each first radiation absorption value and each second radiation absorption value are summed to obtain a first irradiation loss value.

[0199] In some embodiments, the above-mentioned indirect determination module 4552 is also used to multiply the light shielding factor of the virtual illumination point and the first irradiance to obtain the blocked irradiance of the virtual illumination point, wherein the value range of the light shielding factor is between 0 and 1; and the difference between the first irradiance and the blocked irradiance is determined as the indirect irradiance of the virtual illumination point.

[0200] In some embodiments, the lighting baking device 455 of the virtual scene further includes: a factor determination module, which is used to perform the following processing for each virtual lighting point: selecting multiple target virtual viewpoints associated with the virtual lighting point from each virtual viewpoint of the virtual scene; wherein the virtual viewpoint is a virtual scene point in the virtual scene that can be captured by a virtual camera, and there is no virtual blind spot on the line connecting the target virtual viewpoint and the virtual lighting point, and the virtual blind spot is a virtual scene point in the virtual scene that cannot be captured by a virtual camera; taking the virtual lighting point as the starting point and each target virtual viewpoint as the end point, generating detection rays corresponding to each target virtual viewpoint; when the detection ray intersects with the virtual occluder, determining the detection ray as an occluded detection ray; dividing the number of occluded detection rays by the number of multiple detection rays, and determining the division result as the light shielding factor of the virtual lighting point.

[0201] In some embodiments, the direct determination module 4553 is also used to perform the following processing for each virtual illumination point: when the virtual light to which the virtual illumination point belongs does not include direct light, the value of the direct irradiance of the virtual illumination point is determined to be zero; when the virtual light to which the virtual illumination point belongs includes direct light, the initial irradiance of each direct light is determined, wherein the direct light included in the virtual light is in a one-to-one correspondence with the virtual light source in the virtual scene; the initial irradiances corresponding to each direct light are summed to obtain a second irradiance corresponding to the virtual illumination point; based on the light shielding factor of the virtual illumination point, the second irradiance is adjusted to obtain the direct irradiance of the virtual illumination point.

[0202] In some embodiments, the direct determination module 4553 is also used to perform the following processing for each direct light included in the virtual light: obtain the reflection path of the direct light, and the second light source radiation energy of the virtual light source corresponding to the direct light; wherein, the starting point of the reflection path is the position of the virtual light source in the virtual scene, and the end point of the reflection path is the position of the virtual camera used to shoot the virtual scene in the virtual scene, and the virtual illumination point is located on the reflection path; based on the reflection path of the direct light, determine the second irradiance loss value of the direct light, the second irradiance loss value is used to indicate the loss of the light source radiation energy in the reflection path; determine the difference between the second light source radiation energy and the second irradiance loss value as the initial irradiance of the direct light.

[0203] In some embodiments, the reflection path of the direct light includes two reflection sub-paths, and the above-mentioned direct determination module 4553 is also used to obtain a third radiation absorption value corresponding to a virtual illumination point in the reflection path, and the third radiation absorption value is used to indicate the degree of energy absorption of the virtual illumination point to the radiation energy of the light source; based on the length of each reflection sub-path in the reflection path, the fourth radiation absorption value corresponding to each reflection sub-path is determined, wherein the fourth radiation absorption value is used to indicate the degree of energy absorption of the propagation medium on the reflection sub-path to the radiation energy of the light source, and the numerical value of the fourth radiation absorption value is positively correlated with the length of the corresponding reflection sub-path; the third radiation absorption value and each fourth radiation absorption value are summed to obtain a second radiation loss value.

[0204] In some embodiments, the baking module 4554 is also used to add the direct irradiance and indirect irradiance of each virtual lighting point to obtain the overall irradiance of the virtual lighting point, and determine the ratio of the indirect irradiance to the overall irradiance as the indirect light ratio of the virtual lighting point; based on the indirect light ratio of each virtual lighting point, the virtual scene is illuminated and baked to obtain a lighting map of the virtual scene.

[0205] In some embodiments, the lighting baking device 455 for the virtual scene further includes: a rendering module, which is used to sample information from each channel of the lighting map of the virtual scene to obtain channel information of each channel of the lighting map, wherein the channel information records the indirect light ratio of each virtual lighting point; based on the indirect light ratio, the brightness of each virtual lighting point in the virtual scene is determined; based on the brightness of each virtual lighting point, the virtual scene is rendered to obtain a rendering map of the virtual scene, and the rendering map is used for the display device to display the image of the virtual scene.

[0206] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the lighting baking method of the virtual scene described in the embodiment of the present application.

[0207] The present application embodiment provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will be caused to execute the lighting baking method for a virtual scene provided by the present application embodiment, for example, Figure 3 The lighting baking method of the virtual scene is shown.

[0208] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEP ROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various electronic devices including one or any combination of the above memories.

[0209] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0210] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0211] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0212] In summary, the embodiments of the present application have the following beneficial effects:

[0213] (1) The indirect irradiance of the virtual lighting point is determined through the light shielding factor and indirect light of the virtual lighting point, and the direct irradiance is obtained. The virtual scene is then light-baked through the direct irradiance and the indirect irradiance to obtain a lighting map of the virtual scene. In this way, since the light shielding factor can accurately reflect the irradiation effect of the virtual occluder of the virtual lighting point on the virtual lighting point, the realism of the determined indirect irradiance is higher. The virtual scene is light-baked through the determined high-realism direct irradiance and indirect irradiance, so that the direct irradiance and the indirect irradiance can be accurately light-baked respectively during the light-baking process, so that the obtained light map can accurately record the baking results of the direct light and the indirect light, thereby effectively improving the lighting realism of the light baking.

[0214] (2) By determining the ratio of the number of blocked detection rays to the number of detection rays, the light shielding factor of the determined virtual illumination point can be determined. Since the blocked detection rays can accurately indicate the irradiation effect of the virtual occluder on the virtual illumination point, the determined light shielding factor can accurately reflect the degree of irradiation effect of the virtual occluder on the virtual illumination point, so that the indirect irradiance of the determined virtual illumination point can more realistically restore the lighting environment.

[0215] (3) The occluded irradiance of the virtual illumination point is obtained by multiplying the light shielding factor of the virtual illumination point by the first irradiance, and the difference between the first irradiance and the occluded irradiance is determined as the indirect irradiance of the virtual illumination point. Thus, the irradiance effect of the virtual occluder on the virtual illumination point is accurately determined through the light shielding factor, and the irradiance effect of the virtual occluder on the virtual illumination point is superimposed on the irradiance effect of the indirect light on the virtual illumination point, so that the determined indirect irradiance of the virtual illumination point can more realistically restore the lighting environment.

[0216] (4) The occluded irradiance of the virtual light point is obtained by multiplying the light shielding factor of the virtual light point by the second irradiance, and the difference between the second irradiance and the occluded irradiance is determined as the direct irradiance of the virtual light point. Thus, the irradiance effect of the virtual occluder on the virtual light point is accurately determined through the light shielding factor, and the irradiance effect of the virtual occluder on the virtual light point is superimposed on the irradiance effect of the direct light on the virtual light point, so that the determined direct irradiance of the virtual light point can more realistically restore the lighting environment.

[0217] (5) By writing the indirect light ratio of each virtual light point into the transparency channel of the initial light map, the light map of the virtual scene is obtained. When rendering is subsequently performed based on the light map, the indirect light ratio of each virtual light point can be directly read from the transparency channel. A more accurate indirect light intensity can be inferred through the indirect light ratio, so that the rendered rendering map can more accurately reflect the lighting conditions of the virtual scene and can more realistically restore the lighting environment.

[0218] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A lighting baking method for a virtual scene, characterized in that: The method comprises: Acquire virtual light corresponding to each virtual illumination point in the virtual scene, wherein the virtual light includes direct light with one reflection and indirect light with multiple reflections; Determining the indirect irradiance of each of the virtual illumination points based on the indirect light corresponding to the virtual illumination point and the light shielding factor of the virtual illumination point; The light shielding factor is used to indicate the irradiation effect of the virtual occluder of the virtual illumination point on the virtual illumination point, and the indirect irradiance is used to indicate the irradiation effect of the indirect light on the virtual illumination point; Acquire the direct irradiance of each of the virtual illumination points, wherein the direct irradiance is used to indicate the irradiance effect of the direct light on the virtual illumination point; The indirect irradiance and the direct irradiance are combined to perform lighting baking on the virtual scene to obtain a lighting map of the virtual scene.

2. The method according to claim 1, characterized in that Each of the virtual illumination points corresponds to at least one indirect light; and determining the indirect irradiance of each of the virtual illumination points based on the indirect light corresponding to the virtual illumination point and the light shielding factor of the virtual illumination point comprises: The following processing is performed for each virtual illumination point: respectively determining the initial irradiance of each of the indirect light rays corresponding to the virtual illumination point; Sum the initial irradiances to obtain a first irradiance corresponding to the virtual illumination point; Based on the light shielding factor of the virtual illumination point, the first irradiance is adjusted to obtain the indirect irradiance of the virtual illumination point.

3. The method according to claim 2, characterized in that The respectively determining the initial irradiance of each of the indirect light rays corresponding to the virtual illumination point comprises: The following processing is performed for each of the indirect rays corresponding to the virtual illumination point: Acquire a reflection path of the indirect light and a first light source radiation energy of a virtual light source corresponding to the indirect light; The starting point of the reflection path is the position of the virtual light source in the virtual scene, the end point of the reflection path is the position of the virtual camera used to shoot the virtual scene in the virtual scene, and the virtual illumination point is located on the reflection path; Determine a first irradiance loss value of the indirect light based on a reflection path of the indirect light, wherein the first irradiance loss value is used to indicate a loss of radiant energy of the light source in the reflection path; The difference between the radiation energy of the first light source and the first radiation loss value is determined as the initial irradiance of the indirect light.

4. The method according to claim 3, characterized in that The reflection path of the indirect light comprises at least two reflection midpoints and at least three reflection sub-paths, the reflection midpoint is located on the reflection path and is used for the indirect light to form light reflection, and the at least two reflection midpoints include the virtual illumination point; The determining a first irradiance loss value of the indirect light based on the reflection path of the indirect light comprises: Obtaining a first radiation absorption value corresponding to each of the reflection midpoints in the reflection path, wherein the first radiation absorption value is used to indicate the degree of energy absorption of the light source radiation energy by the reflection midpoint, and the numerical value of the first radiation absorption value is associated with the virtual material corresponding to the reflection midpoint; Determine, based on the length of each of the reflection sub-paths in the reflection path, a second radiation absorption value corresponding to each of the reflection sub-paths, wherein the second radiation absorption value is used to indicate the degree of energy absorption of the radiation energy of the light source by the propagation medium on the reflection sub-path, and the numerical value of the second radiation absorption value is positively correlated with the length of the corresponding reflection sub-path; The first radiation absorption values ​​and the second radiation absorption values ​​are summed to obtain the first radiation loss value.

5. The method according to claim 2, characterized in that: The adjusting the first irradiance based on the light shielding factor of the virtual illumination point to obtain the indirect irradiance of the virtual illumination point includes: Multiplying the light shielding factor of the virtual illumination point by the first irradiance to obtain the shielding irradiance of the virtual illumination point, wherein the value range of the light shielding factor is between 0 and 1; The difference between the first irradiance and the shielding irradiance is determined as the indirect irradiance of the virtual illumination point.

6. The method according to claim 1, characterized in that Before determining the indirect irradiance of each virtual illumination point based on the indirect light corresponding to the virtual illumination point and the light shielding factor of the virtual illumination point, the method further includes: The following processing is performed for each virtual illumination point: Selecting a plurality of target virtual viewpoints associated with the virtual illumination point from the virtual viewpoints of the virtual scene; The virtual viewpoint is a virtual scene point in the virtual scene that can be captured by the virtual camera, there is no virtual blind spot on the line connecting the target virtual viewpoint and the virtual illumination point, and the virtual blind spot is a virtual scene point in the virtual scene that cannot be captured by the virtual camera; Taking the virtual illumination point as a starting point and each of the target virtual viewpoints as an end point, generating detection rays corresponding to each of the target virtual viewpoints; When the detection ray intersects with the virtual occluder, determining the detection ray as an occluding detection ray; The number of the blocked detection rays is divided by the number of the plurality of detection rays, and the division result is determined as the light shielding factor of the virtual illumination point.

7. The method according to claim 1, characterized in that The obtaining of the direct irradiance of each virtual illumination point comprises: The following processing is performed for each virtual illumination point: When the virtual light to which the virtual light point belongs does not include the direct light, determining the value of the direct irradiance of the virtual light point to be zero; When the virtual light rays to which the virtual illumination point belongs include the direct light rays, determining the initial irradiance of each of the direct light rays, wherein the direct light rays included in the virtual light rays are in a one-to-one correspondence with the virtual light sources in the virtual scene; Sum the initial irradiances corresponding to the direct rays to obtain a second irradiance corresponding to the virtual illumination point; Based on the light shielding factor of the virtual illumination point, the second irradiance is adjusted to obtain the direct irradiance of the virtual illumination point.

8. The method according to claim 7, characterized in that Determining the initial irradiance of each direct light comprises: The following processing is performed for each direct light ray included in the virtual light ray: Acquire a reflection path of the direct light and a second light source radiation energy of a virtual light source corresponding to the direct light; The starting point of the reflection path is the position of the virtual light source in the virtual scene, the end point of the reflection path is the position of the virtual camera used to shoot the virtual scene in the virtual scene, and the virtual illumination point is located on the reflection path; Determine a second irradiance loss value of the direct light based on the reflection path of the direct light, wherein the second irradiance loss value is used to indicate the loss of the radiant energy of the light source in the reflection path; The difference between the second light source radiation energy and the second irradiance loss value is determined as the initial irradiance of the direct light.

9. The method according to claim 8, characterized in that The reflection path of the direct light includes two reflection sub-paths; and determining the second irradiance loss value of the direct light based on the reflection path of the direct light includes: Acquire a third radiation absorption value corresponding to the virtual illumination point in the reflection path, wherein the third radiation absorption value is used to indicate the degree of energy absorption of the virtual illumination point to the radiation energy of the light source; Based on the length of each of the reflection sub-paths in the reflection path, determining a fourth radiation absorption value corresponding to each of the reflection sub-paths, wherein the fourth radiation absorption value is used to indicate the degree of energy absorption of the radiation energy of the light source by the propagation medium on the reflection sub-path, and the numerical value of the fourth radiation absorption value is positively correlated with the length of the corresponding reflection sub-path; The third radiation absorption value and each of the fourth radiation absorption values ​​are summed to obtain the second radiation loss value.

10. The method according to claim 1, characterized in that The combining the indirect irradiance and the direct irradiance to perform lighting baking on the virtual scene to obtain a lighting map of the virtual scene includes: For each virtual illumination point, the direct irradiance and the indirect irradiance of the virtual illumination point are added to obtain the overall irradiance of the virtual illumination point, and Determine the ratio of the indirect irradiance to the overall irradiance as the indirect light ratio of the virtual illumination point; Based on the indirect light ratio of each virtual light point, the virtual scene is light-baked to obtain a light map of the virtual scene.

11. The method according to claim 1, characterized in that: After combining the indirect irradiance and the direct irradiance to perform lighting baking on the virtual scene to obtain a lighting map of the virtual scene, the method further includes: Sampling information of each channel of the illumination map of the virtual scene to obtain channel information of each channel of the illumination map, wherein the channel information records the indirect light ratio of each virtual illumination point; Based on the indirect light ratio, determining the brightness of each virtual lighting point in the virtual scene; Based on the brightness of each of the virtual lighting points, the virtual scene is rendered to obtain a rendering map of the virtual scene, and the rendering map is used for a display device to display a picture of the virtual scene.

12. A lighting baking device for a virtual scene, characterized in that: The device comprises: An acquisition module, used to acquire virtual light corresponding to each virtual illumination point in the virtual scene, wherein the virtual light includes direct light with one reflection and indirect light with multiple reflections; An indirect determination module, used to determine the indirect irradiance of each virtual illumination point based on the indirect light corresponding to the virtual illumination point and the light shielding factor of the virtual illumination point; wherein the light shielding factor is used to indicate the irradiance effect of the virtual occluder of the virtual illumination point on the virtual illumination point, and the indirect irradiance is used to indicate the irradiance effect of the indirect light on the virtual illumination point; A direct determination module, used for acquiring the direct irradiance of each of the virtual illumination points, wherein the direct irradiance is used for indicating the irradiance effect of the direct light on the virtual illumination point; The baking module is used to combine the indirect irradiance and the direct irradiance to perform lighting baking on the virtual scene to obtain a lighting map of the virtual scene.

13. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions or computer programs; A processor, configured to implement the lighting baking method for a virtual scene according to any one of claims 1 to 11 when executing the computer executable instructions or computer program stored in the memory.

14. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the lighting baking method for a virtual scene according to any one of claims 1 to 11 is implemented.

15. A computer program product comprising a computer program or computer executable instructions, characterized in that: When the computer program or computer executable instructions are executed by a processor, the lighting baking method for a virtual scene according to any one of claims 1 to 11 is implemented.

Citation Information

Cited By

  • Real-time global illumination processing method and system

    CN120876706A

  • Illumination mapping data processing method and related equipment

    CN121600149A

  • Data processing method of light map and related equipment

    CN121600149B