Virtual scene data processing method and device, electronic equipment and storage medium
By presetting scene lighting data in a virtual scene and calculating the lighting effects of active objects, the memory consumption problem caused by real-time lighting calculation in the prior art is solved, and efficient lighting effects display is achieved.
Patent Information
- Application Number
- CN202411738147.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-28
AI Technical Summary
When pursuing realistic lighting effects, existing games need to obtain real-time lighting data of virtual scenes in real time, resulting in high memory consumption during the game running.
By presetting scene lighting data in the virtual scene, the tetrahedron and its lighting data matching the displayed scene area are extracted, and the lighting effect is calculated based on the positional relationship and lighting data of the active object, thereby displaying the lighting effect.
In terms of ensuring the realistic lighting effect, the memory consumption during game operation is reduced and the game performance is improved.
Smart Images

Figure CN119701338A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data processing, and more specifically, to a data processing method, device, electronic device and storage medium for a virtual scene. Background Art
[0002] As games are gaining more and more attention from users, users are gradually increasing their requirements for the visual effects of games. At present, in order to pursue more realistic lighting effects, existing games usually need to obtain the real-time lighting of the virtual scene where the user is located, and calculate the lighting effects of the virtual scene in real time based on the real-time lighting, which results in high memory consumption during the game operation. Summary of the invention
[0003] One purpose of the embodiments of the present disclosure is to provide a new technical solution for data processing of a virtual scene.
[0004] According to a first aspect of the present disclosure, a method for processing data of a virtual scene is provided, the method comprising:
[0005] In response to a display instruction of the virtual scene, determining a first scene area to be displayed in the virtual scene and a first active object in the first scene area;
[0006] Extracting a first tetrahedron matching the first scene area and first illumination data corresponding to the first tetrahedron from the preset scene illumination data; wherein the scene illumination data is used to characterize the illumination of the scene skylight and point light source preset in the virtual scene acting on the tetrahedron set in the virtual scene;
[0007] In the first tetrahedron, determining a second tetrahedron where the first active object is located;
[0008] determining second illumination data of the first active object according to a positional relationship between the first active object and the second tetrahedron and the first illumination data;
[0009] Based on the first lighting data and the second lighting data, the lighting effect of the first scene area is displayed.
[0010] In a possible implementation manner, determining a first time node corresponding to the first scene area;
[0011] The step of extracting a first tetrahedron matching the first scene area and first illumination data corresponding to the first tetrahedron from the preset scene illumination data includes:
[0012] From the preset scene illumination data, a first tetrahedron matching the first scene area and first illumination data corresponding to the first tetrahedron at the first time node are extracted.
[0013] In a possible implementation, the first tetrahedron is obtained by tetrahedralizing a probe group surrounding a prefab in the first scene area after global illumination baking and point light source baking.
[0014] In a possible implementation, the method further includes:
[0015] Acquire that the first active object is located in a first bounding box of a second active object disposed behind in the first scene area, and acquire third illumination data of the first bounding box;
[0016] The determining, according to the positional relationship between the first active object and the second tetrahedron and the first illumination data, second illumination data of the first active object comprises:
[0017] When the irradiance reflected by the third illumination data is greater than the irradiance reflected by the first illumination data, determining second illumination data of the first active object according to the positional relationship between the first active object and the first bounding box and the third illumination data;
[0018] When the irradiance reflected by the third illumination data is less than or equal to the irradiance reflected by the first illumination data, second illumination data of the first active object is determined according to the positional relationship between the first active object and the second tetrahedron and the first illumination data.
[0019] In a possible implementation, determining the second illumination data of the first active object according to the positional relationship between the first active object and the second tetrahedron and the first illumination data includes:
[0020] Determining, according to the positional relationship between the first active object and the second tetrahedron, a first probe in the second tetrahedron surrounding the first active object and a relative distance between the first probe and the first active object;
[0021] According to the relative distance, the fourth illumination data of the first probe is interpolated to obtain the second illumination data of the first active object; wherein the fourth illumination data is the illumination data corresponding to the first probe in the first illumination data.
[0022] In a possible implementation, the virtual scene is composed of a plurality of scene modules; and determining a first scene area to be displayed in the virtual scene includes:
[0023] Among the multiple scene modules, a first scene module associated with the display instruction is determined and used as a first scene area to be displayed in the virtual scene.
[0024] In a possible implementation, the method further includes:
[0025] Determine the second scene module adjacent to the first scene module among the plurality of scene modules;
[0026] Extracting, from the scene illumination data, a third tetrahedron matching the second scene area and fifth illumination data corresponding to the third tetrahedron;
[0027] In response to the first scene area moving to the second scene area, determining a third scene module in the second scene module that is associated with the second scene area;
[0028] Based on the first lighting data, the second lighting data and the fifth lighting data of the third scene module, the lighting effect of the second scene area is displayed.
[0029] In a possible implementation, the method further includes:
[0030] In response to the virtual scene expanding from displaying the first scene area to displaying the third scene area, based on the skylight data in the scene lighting data, the lighting effect of the third scene area is displayed; wherein a portion of the third scene area is the first scene area.
[0031] According to a second aspect of the present disclosure, there is also provided a data processing device for a virtual scene, comprising:
[0032] A response module, configured to determine a first scene area to be displayed in the virtual scene and a first active object in the first scene area in response to a display instruction of the virtual scene;
[0033] An extraction module, configured to extract, from preset scene illumination data, a first tetrahedron matching the first scene area and first illumination data corresponding to the first tetrahedron; wherein the scene illumination data is used to characterize illumination of the scene skylight and point light source preset in the virtual scene acting on the tetrahedron set in the virtual scene;
[0034] A first determining module, configured to determine, in the first tetrahedron, a second tetrahedron where the first active object is located;
[0035] a second determining module, configured to determine second illumination data of the first active object according to a positional relationship between the first active object and the second tetrahedron and the first illumination data;
[0036] A display module is used to display the lighting effect of the first scene area based on the first lighting data and the second lighting data.
[0037] According to a third aspect of the present disclosure, a computer system is also provided, the computer system includes a processor, when the processor executes a program instruction or code, the computer system implements the data processing method of the virtual scene in the first aspect. Exemplarily, the computer system also includes a memory, the memory is used to store the program instruction or code.
[0038] According to a fourth aspect of the present disclosure, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned virtual scene data processing method when running.
[0039] According to a fifth aspect of the present disclosure, there is also provided a computer program product, comprising a game program, wherein when the game program is executed, the computer executes the steps of the above-mentioned virtual scene data processing method.
[0040] According to a sixth aspect of the present disclosure, there is also provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the data processing method of the virtual scene through the computer program.
[0041] One beneficial effect of the embodiments of the present disclosure is that the data processing method for the virtual scene provided by the embodiments of the present disclosure can extract the first tetrahedron matching the first scene area and the first illumination data corresponding to the first tetrahedron from the preset scene illumination data when the first scene area of the virtual scene needs to be displayed, determine the second tetrahedron where the first active object is located from the first tetrahedron, determine the second illumination data of the first active object according to the positional relationship between the second tetrahedron and the first active object and the first illumination data, and display the illumination effect of the first scene area based on the first illumination data and the second illumination data. In other words, the illumination effect of the prefabricated body in the virtual scene is preloaded before the game is run, and the illumination of the first active object in the virtual scene can be obtained through the illumination data of the prefabricated body, so as to effectively reduce the memory consumption during the game operation process while ensuring that the first scene area has a better illumination effect.
[0042] Features and advantages of the embodiments of the present specification will become apparent from the following detailed description of exemplary embodiments of the present specification with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the specification and, together with the description, serve to explain the principles of the embodiments of the specification.
[0044] Figure 1 A schematic diagram showing the hardware structure of an electronic device that can be used to implement the data processing method for a virtual scene according to an embodiment of the present disclosure;
[0045] Figure 2 A schematic flow chart of a method for processing data of a virtual scene according to some embodiments is shown;
[0046] Figure 3 A schematic diagram showing the structure of a data processing device for a virtual scene according to some embodiments;
[0047] Figure 4 A schematic diagram of the hardware structure of an electronic device according to some embodiments is shown. DETAILED DESCRIPTION
[0048] Various exemplary embodiments of the present specification will now be described in detail with reference to the accompanying drawings.
[0049] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the embodiments of the present specification and its application or uses.
[0050] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0051] It should be noted that all actions of acquiring signals, information or data in the embodiments of the present disclosure are performed in compliance with the corresponding data protection laws and policies of the country where the device is located, and with the authorization given by the owner of the corresponding device.
[0052] The disclosed embodiment provides a new data processing solution for virtual scenes, which pre-bakes the skylight and point light sources in the virtual scene separately to obtain the lighting effect of the overall initial environment of the virtual scene. When a virtual object controlled by a user enters a scene area of the virtual scene, the lighting data of the virtual object can be determined based on the scene lighting data of the scene area, and then the lighting effect of the virtual object is rendered in the virtual scene, so that a more realistic lighting effect of the virtual character can be obtained while saving costs.
[0053] Figure 1 A schematic diagram of the hardware structure of an electronic device that can be used to implement the data processing method for a virtual scene according to an embodiment of the present disclosure is shown.
[0054] The electronic device 1000 is a device capable of running a game, and the game may be a local application installed on the electronic device, or a web game, a light application, or a small program, etc., which is not limited here. The electronic device 1000 may be a mobile phone, a tablet computer, a PC, etc., which is not limited here.
[0055] like Figure 1 As shown, the electronic device 1000 may include a processor 1101, a memory 1102, an interface device 1103, a communication device 1104, an output device 1105, an input device 1106, and the like. Figure 1 The hardware configuration shown is merely illustrative and is in no way intended to limit the present disclosure, its application, or uses.
[0056] The processor 1101 is used to execute a computer program, which can be written in an instruction set of an architecture such as x86, Arm, RISC, MIPS, SSE, etc. The memory 1102 includes, for example, ROM (read-only memory), RAM (random access memory), a non-volatile memory such as a hard disk, etc. The interface device 1103 includes, for example, a USB interface, a network cable interface, a headphone interface, etc. The communication device 1104 is capable of wired or wireless communication, for example, and the communication device 1104 may include at least one short-range communication module, for example, any module for short-range wireless communication based on short-range wireless communication protocols such as Hilink protocol, WiFi (IEEE 802.11 protocol), Mesh, Bluetooth, ZigBee, Thread, Z-Wave, NFC, UWB, LiFi, etc. The communication device 1104 may also include a remote communication module, for example, any module for WLAN, GPRS, 2G / 3G / 4G / 5G remote communication. The output device 1105 may include, for example, a liquid crystal display or a touch display, a speaker, etc. The input device 1106 may include, for example, a touch screen, a keyboard, a microphone, various sensors, etc.
[0057] In this embodiment, the memory 1102 of the electronic device 1000 is used to store a computer program, and the computer program is used to control the processor 1101 to operate so as to execute the data processing method of the virtual scene according to any embodiment of the present disclosure.
[0058] Next, Figure 1 Taking the electronic device 1000 as an example of an implementation subject, various embodiments of the data processing method of the virtual scene are explained.
[0059] <First Embodiment>
[0060] Figure 2A data processing method for a virtual scene according to some embodiments is shown, and the data processing method for a virtual scene may include the following steps S210 to S250:
[0061] Step S210 , in response to a display instruction of a virtual scene, determining a first scene area to be displayed in the virtual scene and a first active object in the first scene area.
[0062] In this embodiment, the display instruction may be triggered after the user starts the game or when the user switches to a virtual scene in the game.
[0063] In this embodiment, the virtual scene is composed of multiple scene modules, for example, the virtual scene is composed of 3×3 scene modules A, wherein the size of each scene module A is 1×1. The display instruction may indicate any one or more of the multiple scene modules, for example, the virtual scene is composed of 3×3 scene modules A, and the user's game interface may display three scene modules A located in the first row of the 3×3 scene modules A.
[0064] In this embodiment, the first scene area may be a scene area displayed to the user, and the first active object in the first scene area may be an object moved or newly created in the first scene area during the running of the game. The first active object may be, for example, a virtual character controlled by a user or computer AI, or a virtual building created.
[0065] Step S220, extracting a first tetrahedron matching the first scene area and first lighting data corresponding to the first tetrahedron from the preset scene lighting data; wherein the scene lighting data is used to characterize the lighting of the preset scene skylight and point light source in the virtual scene acting on the tetrahedron set in the virtual scene.
[0066] In this embodiment, when the scene area to be displayed in the virtual scene is the first scene area, the time node and the corresponding scene module currently corresponding to the first scene area are determined, and then the first tetrahedron set in the scene module corresponding to the first scene area is extracted from the tetrahedron in the virtual scene. The first tetrahedron is also composed of multiple probes, and the illumination data of each probe on the first tetrahedron is the first illumination data corresponding to the first tetrahedron.
[0067] In some embodiments, in order to improve the quality of lighting effects of prefabs in the virtual scene, the first tetrahedron is obtained by tetrahedralizing the probe group surrounding the prefabs in the first scene area after global illumination baking and point light baking.
[0068] In this embodiment, a tetrahedron is provided in the virtual scene, and the tetrahedron is composed of a plurality of probes that bake the scene skylight and point light sources. Among them, for the setting of scene illumination data, first, the probe (Probe) surrounds the prefab (Prefab) in the virtual scene and forms a probe group (Probe Group), and the scene skylight preset in the virtual scene is baked onto the probe group, and then the probe group baked with global illumination is obtained through the GPU Baker technology, and then the point light source is baked onto the probe group, and the probe group baked with the point light source is tetrahedralized to obtain the tetrahedron in the virtual scene, and the illumination data of each probe on the tetrahedron in the virtual scene is the scene illumination data. Among them, the prefab can be a virtual character, building or decoration set in the virtual scene during the construction of the virtual scene.
[0069] Step S230: determining, in the first tetrahedron, a second tetrahedron where the first active object is located.
[0070] In this embodiment, according to the position of the first active object in the first scene module, one or more second tetrahedrons where the first active object is located can be determined in the first tetrahedron.
[0071] Step S240: determining second illumination data of the first active object according to the positional relationship between the first active object and the second tetrahedron and the first illumination data.
[0072] In this embodiment, the positional relationship between the first active object and the second tetrahedron may be the distance deviation and direction deviation between the position of the first active object and the position of the first probe in the second tetrahedron in the virtual scene, or the distance deviation and direction deviation between the position of the first active object and the position where the center of gravity of the second tetrahedron is located. Furthermore, the first illumination data may be interpolated according to the distance deviation and the direction deviation to obtain the second illumination data of the first active object.
[0073] Step S250: displaying the lighting effect of the first scene area based on the first lighting data and the second lighting data.
[0074] In this embodiment, for the prefabricated body in the first scene area, the lighting effect can be performed using the first lighting data of the first tetrahedron, and for the first active object in the first scene area, the lighting effect can be performed using the second lighting data.
[0075] The data processing method for the virtual scene according to the first embodiment of the present invention solves the problem in the prior art that the lighting effects of the prefabricated body and the skylight need to be calculated in real time, which results in high memory consumption during the game operation. Based on this method, when the first scene area of the virtual scene needs to be displayed, the lighting effects of the prefabricated body in the virtual scene are preloaded before the game is run, and the lighting of the first active object in the virtual scene can be obtained through the lighting data of the prefabricated body, so as to effectively reduce the memory consumption during the game operation while ensuring that the first scene area has a better lighting effect.
[0076] <Second Embodiment>
[0077] In this embodiment, in order to achieve different lighting effects when the virtual scene changes from day to night, one or more point light sources can be set in the first scene area located at the first time node, and the point light sources can act on the prefabricated body and the first active object to enhance the visual effect of the first scene area.
[0078] In these embodiments, relative to the first embodiment, before step S220, the method further includes the following step S310:
[0079] Step S310, determining a first time node corresponding to a first scene area.
[0080] In this embodiment, when the display instruction of the virtual scene is triggered, the first time node corresponding to the first scene area is determined according to the game process. The game process here is, for example, the time recorded by the user's most recent archive in a single-player game or the current time set in the game in a multiplayer game. For example, taking a multiplayer game as an example, the time nodes are divided into "early" and "late", where "early" corresponds to 0 o'clock-12 o'clock and "late" corresponds to 12 o'clock-24 o'clock. Then, when the current time is 18 o'clock, the first time node corresponding to the first scene area is "late".
[0081] Based on this, step S220 may include the following step S2201:
[0082] Step S2201: extracting a first tetrahedron matching a first scene area and first illumination data corresponding to the first tetrahedron at a first time node from preset scene illumination data.
[0083] In this embodiment, when the scene area to be displayed in the virtual scene is the first scene area, the time node and the corresponding scene module currently corresponding to the first scene area are determined, and then the first tetrahedron set in the scene module corresponding to the first scene area is extracted from the tetrahedron in the virtual scene. The first tetrahedron is also composed of multiple probes, and the illumination data corresponding to each probe on the first tetrahedron at the first time node is the first illumination data corresponding to the first tetrahedron at the first time node.
[0084] <Third Embodiment>
[0085] In this embodiment, in order to further reduce memory consumption during game operation, the virtual scene may be composed of multiple scene modules, and the displayed first scene area may be at least a part of the multiple scene modules.
[0086] In these embodiments, relative to the first embodiment, step S210 may include the following step S410:
[0087] Step S410: Determine a first scene module associated with the display instruction from among multiple scene modules, and use it as a first scene area to be displayed in the virtual scene.
[0088] In this embodiment, the multiple scene modules are scene module C1-scene module C9, and the first scene module associated with the display instruction is scene module C1-scene module C2. Then, the first scene area to be displayed is scene module C1-scene module C2.
[0089] <Fourth Embodiment>
[0090] In this embodiment, in order to determine the second illumination data of the active object, the second illumination data of the first active object may be interpolated and calculated using the positional relationship between the first probe of the second tetrahedron and the first active object and the fourth illumination data of the first probe.
[0091] In these embodiments, relative to the first embodiment, step S240 may include the following steps S510 and S520:
[0092] Step S510 : determining a first probe surrounding the first moving object in the second tetrahedron and a relative distance between the first probe and the first moving object according to the positional relationship between the first moving object and the second tetrahedron.
[0093] Step S520: interpolate the fourth illumination data of the first probe according to the relative distance to obtain second illumination data of the first active object; wherein the fourth illumination data is illumination data corresponding to the first probe in the first illumination data.
[0094] In some examples, a point P1 of the first active object has coordinates (2, 0), a first probe L1 in the second tetrahedron has coordinates (1, 0) and the corresponding first illumination data value is 10, a first probe L2 in the second tetrahedron has coordinates (3, 0) and the corresponding first illumination data value is 20, then the value of the second illumination data of a point P1 of the first active object is 15. The value here only indicates that the second illumination data is obtained by interpolation of the first illumination data, and does not represent actual illumination data, such as irradiance.
[0095] <Fifth Embodiment>
[0096] In this embodiment, in order to save overhead during the running of the game, when the user switches from the first scene area to the second scene area of the virtual scene, the second scene area has a lighting effect, the second scene module adjacent to the first scene module and the fifth lighting data corresponding to the third tetrahedron where the second scene module is located are determined, and the third lighting information is used to render the lighting effect of the second scene area.
[0097] In these embodiments, relative to the third embodiment, after step S250, the method further includes the following steps S610 to S640:
[0098] Step S610: determining a second scene module adjacent to the first scene module among the multiple scene modules.
[0099] In this embodiment, the adjacency between scene modules can be an adjacency relationship determined according to the position distribution of each scene module in the virtual scene. For example, the virtual scene includes scene module F1-scene module F9, and scene module F1-scene module F9 are arranged in sequence in a "nine-square grid". The scene modules adjacent to scene module F1 are scene module F2 and scene module F4, and the scene modules adjacent to scene module F5 are scene module F1-scene module F4 and scene module F6-scene module F9.
[0100] Step S620, extracting a third tetrahedron matching the second scene area and fifth illumination data corresponding to the third tetrahedron from the scene illumination data;
[0101] In this embodiment, the scene lighting data is lighting data of tetrahedrons in all scene modules of the virtual scene, that is, the scene lighting data also includes the third tetrahedron matched by the second scene area and the fifth lighting data corresponding to the third tetrahedron.
[0102] Step S630: in response to the first scene area moving to the second scene area, determining a third scene module in the second scene module that is associated with the second scene area.
[0103] In some examples, the virtual scene corresponds to scene module H1-scene module H3, the first scene area corresponds to scene module H2, the second scene area corresponds to scene module H3, and the fifth illumination data of the third tetrahedron in scene module H3 is selected from the scene illumination data.
[0104] Step S640: display the lighting effect of the second scene area based on the first lighting data, the second lighting data and the fifth lighting data of the third scene module.
[0105] In some examples, the second scene area may include part of the first scene area, the virtual scene corresponds to scene module H1-scene module H3, the first scene area corresponds to scene module H1 and scene module H2, and the second scene area corresponds to scene module H2 and scene module H3. Through the scene lighting data, the lighting effect of the skylight in the second scene area, the lighting effect of the prefabricated object in the scene module H2, the lighting effect of the first active object in the scene module H2, and the lighting effect of the prefabricated object in the scene module H3 can be rendered. When the first active object moves from the first scene area to the second scene area, the lighting effect of the first active object is re-rendered through the fifth lighting data of the third scene module.
[0106] <Sixth Embodiment>
[0107] In this embodiment, in order to facilitate users to view the entire virtual scene or view more scene areas at the same time, when the user views the third scene area in the virtual scene, the third scene area only displays the lighting effect of the skylight, and the lighting details of the first active object and prefabricated body in the third scene area can be omitted, effectively saving the cost of running the game.
[0108] In these embodiments, relative to the first embodiment, after step S250, the method further includes the following step S710:
[0109] Step S710, in response to the virtual scene expanding from displaying the first scene area to displaying the third scene area, based on the skylight data in the scene lighting data, display the lighting effect of the third scene area; wherein a portion of the third scene area is the first scene area.
[0110] In some examples, the virtual scene includes scene module F1-scene module F9, and scene module F1-scene module F9 are arranged in sequence in a "nine-square grid". The first scene area is scene area F1. When the user triggers the first scene area to expand to display the third scene area, the user's game interface switches from displaying scene area F1 to displaying scene area F1, scene area F2, scene area F4 and scene area F5. At this time, the skylight data about scene area F1, scene area F2, scene area F4 and scene area F5 in the scene lighting data can be extracted, and based on the skylight data, the lighting effects of scene area F1, scene area F2, scene area F4 and scene area F5 are displayed.
[0111] <Seventh Embodiment>
[0112] In this embodiment, in order to further improve the realism of the lighting effect of the first active object in the virtual scene, the lighting data of the second active object placed later in the first scene area is compared with the lighting data of the first tetrahedron where the prefabricated body is located, and the first active object is rendered by lighting data with stronger irradiance, thereby effectively improving the realism of the lighting effect of the virtual scene.
[0113] In these embodiments, relative to the first embodiment, before step S240, the method further includes the following step S810:
[0114] Step S810, obtaining a first bounding box of a second active object located behind the first scene area in which the first active object is located, and obtaining third illumination data of the first bounding box.
[0115] In this embodiment, the post-placed second active object may be a virtual character, virtual building, or virtual decoration, etc., that has been set in the first scene area by the user or computer AI before the display instruction of the virtual scene is triggered. After the second active object is set in the first scene area, a first bounding box surrounding the second active object may be set around the second active object, the first bounding box is composed of a plurality of probes, and when the positions of the plurality of probes of the first bounding box in the virtual scene are determined, the illumination data on the plurality of probes of the first bounding box may be determined based on the scene illumination data, i.e., the third illumination data of the first bounding box.
[0116] Based on this, step S240 may include the following steps S2401 and S2402:
[0117] Step S2401 : when the irradiance reflected by the third illumination data is greater than the irradiance reflected by the first illumination data, second illumination data of the first active object is determined according to the positional relationship between the first active object and the first bounding box and the third illumination data.
[0118] In this embodiment, the positional relationship between the first active object and the first bounding box may be the distance deviation and direction deviation between the first active object and each probe in the first bounding box, or the distance deviation and direction deviation between the first active object and the center of gravity of the first bounding box.
[0119] Step S2402: when the irradiance reflected by the third illumination data is less than or equal to the irradiance reflected by the first illumination data, second illumination data of the first active object is determined according to the positional relationship between the first active object and the second tetrahedron and the first illumination data.
[0120] In this embodiment, the irradiance reflected by the first illumination data may be the irradiance of the scene skylight and the point light source acting on the prefabricated body in the first scene area. The irradiance reflected by the third illumination data may be the irradiance of the scene skylight and the point light source acting on the second active object. Moreover, by using illumination data with a stronger irradiance, the authenticity of the illumination effect of the first active object can be effectively improved.
[0121] <Device Example>
[0122] Figure 3 FIG. 2 shows a schematic diagram of the structure of a data processing device for a virtual scene according to an embodiment of the present disclosure. Figure 3 As shown, the data processing device 300 of the virtual scene includes a response module 310 , an extraction module 320 , a first determination module 330 , a second determination module 340 and a display module 350 .
[0123] The response module 310 is used to respond to the display instruction of the virtual scene and determine the first scene area to be displayed in the virtual scene and the first active object in the first scene area;
[0124] The extraction module 320 is used to extract the first tetrahedron matching the first scene area and the first illumination data corresponding to the first tetrahedron from the preset scene illumination data; wherein the scene illumination data is used to characterize the illumination of the scene skylight and point light source preset in the virtual scene acting on the tetrahedron set in the virtual scene;
[0125] The first determination module 330 is used to determine the second tetrahedron where the first active object is located in the first tetrahedron;
[0126] The second determination module 340 is used to determine the second illumination data of the first active object according to the positional relationship between the first active object and the second tetrahedron and the first illumination data;
[0127] The display module 350 is used to display the lighting effect of the first scene area based on the first lighting data and the second lighting data.
[0128] In some embodiments, the data processing device 300 of the virtual scene further includes a third determination module, and the third determination module is used to determine a first time node corresponding to the first scene area.
[0129] The extraction module 320 is used to extract a first tetrahedron matching a first scene area and first illumination data corresponding to the first tetrahedron at a first time node from preset scene illumination data.
[0130] In some embodiments, the data processing device 300 of the virtual scene further includes an acquisition module, which is used to acquire the first bounding box of the first active object in the first scene area and the second active object behind it, and to acquire third illumination data of the first bounding box.
[0131] The second determination module 330 is also used to determine the second illumination data of the first active object based on the positional relationship between the first active object and the first bounding box and the third illumination data when the irradiance reflected by the third illumination data is greater than the irradiance reflected by the first illumination data; and to determine the second illumination data of the first active object based on the positional relationship between the first active object and the second tetrahedron and the first illumination data when the irradiance reflected by the third illumination data is less than or equal to the irradiance reflected by the first illumination data.
[0132] In some embodiments, the second determination module 330 is also used to determine the first probe surrounding the first active object in the second tetrahedron and the relative distance between the first probe and the first active object based on the positional relationship between the first active object and the second tetrahedron; based on the relative distance, interpolate the fourth illumination data of the first probe to obtain the second illumination data of the first active object; wherein the fourth illumination data is the illumination data corresponding to the first probe in the first illumination data.
[0133] In some embodiments, among multiple scene modules, a first scene module associated with the presentation instruction is determined and used as the first scene area to be presented in the virtual scene.
[0134] In some embodiments, the response module 310 is further used to determine a first scene module associated with the display instruction among multiple scene modules, and use it as the first scene area to be displayed in the virtual scene.
[0135] In some embodiments, the data processing device 300 of the virtual scene also includes a mobile display module, which is used to determine a second scene module adjacent to the first scene module among multiple scene modules; extract a third tetrahedron matching the second scene area and fifth lighting data corresponding to the third tetrahedron in the scene lighting data; determine a third scene module associated with the second scene area in the second scene module in response to the first scene area moving to the second scene area; and display the lighting effect of the second scene area based on the first lighting data, the second lighting data and the fifth lighting data of the third scene module.
[0136] In some embodiments, the data processing device 300 of the virtual scene also includes an extended display module, which is used to display the lighting effect of the third scene area in response to the virtual scene expanding from displaying the first scene area to displaying the third scene area based on the skylight data in the scene lighting data; wherein, part of the third scene area is the first scene area.
[0137] <Equipment Embodiment>
[0138] Figure 4 FIG. 1 shows a schematic diagram of the hardware structure of an electronic device according to some other embodiments. Figure 4 As shown, the electronic device 400 includes a processor 410 and a memory 420, wherein the memory 420 is used to store a computer program, and the computer program is used to control the processor 410 to operate so as to control the electronic device 400 to execute the data processing method of the virtual scene according to any embodiment of the present disclosure.
[0139] An embodiment of the present disclosure further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the computer program implements the data processing method of the virtual scene according to any embodiment of the present disclosure.
[0140] The disclosed embodiment also provides a computer program product, which includes a computer program or an instruction, and when the computer program or the instruction is executed by a processor, the data processing method of the virtual scene according to any disclosed embodiment is implemented. The computer program product is, for example, a game client.
[0141] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and equipment embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0142] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0143] The embodiments of the present specification may be devices, methods and / or computer program products. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the embodiments of the present specification.
[0144] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0145] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0146] The computer program instructions for executing the operation of the embodiments of this specification may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, by utilizing the state data of a computer-readable program instruction to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit may execute a computer-readable program instruction, thereby realizing various aspects of the embodiments of this specification.
[0147] Various aspects of the embodiments of the present specification are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (equipment) and computer program products according to the embodiments of the present specification. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0148] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0149] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0150] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of this specification. In this regard, each box in the flowchart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.
[0151] The embodiments of the present specification have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations are obvious to those of ordinary skill in the art without departing from the scope of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for processing data of a virtual scene, the method comprising: In response to a display instruction of the virtual scene, determining a first scene area to be displayed in the virtual scene and a first active object in the first scene area; Extracting a first tetrahedron matching the first scene area and first illumination data corresponding to the first tetrahedron from the preset scene illumination data; wherein the scene illumination data is used to characterize the illumination of the scene skylight and point light source preset in the virtual scene acting on the tetrahedron set in the virtual scene; In the first tetrahedron, determining a second tetrahedron where the first active object is located; determining second illumination data of the first active object according to a positional relationship between the first active object and the second tetrahedron and the first illumination data; Based on the first lighting data and the second lighting data, the lighting effect of the first scene area is displayed.
2. The method according to claim 1, wherein: The method further comprises: Determining a first time node corresponding to the first scene area; The step of extracting a first tetrahedron matching the first scene area and first illumination data corresponding to the first tetrahedron from the preset scene illumination data includes: From the preset scene illumination data, a first tetrahedron matching the first scene area and first illumination data corresponding to the first tetrahedron at the first time node are extracted.
3. The method according to claim 1, wherein: The first tetrahedron is obtained by tetrahedralizing a probe group surrounding a prefab in the first scene area after global illumination baking and point light source baking.
4. The method according to claim 1, wherein: The method further comprises: Acquire that the first active object is located in a first bounding box of a second active object disposed behind in the first scene area, and acquire third illumination data of the first bounding box; The determining, according to the positional relationship between the first active object and the second tetrahedron and the first illumination data, second illumination data of the first active object comprises: When the irradiance reflected by the third illumination data is greater than the irradiance reflected by the first illumination data, determining second illumination data of the first active object according to the positional relationship between the first active object and the first bounding box and the third illumination data; When the irradiance reflected by the third illumination data is less than or equal to the irradiance reflected by the first illumination data, second illumination data of the first active object is determined according to the positional relationship between the first active object and the second tetrahedron and the first illumination data.
5. The method according to claim 1, wherein: The determining, according to the positional relationship between the first active object and the second tetrahedron and the first illumination data, second illumination data of the first active object comprises: Determining, according to the positional relationship between the first active object and the second tetrahedron, a first probe in the second tetrahedron surrounding the first active object and a relative distance between the first probe and the first active object; According to the relative distance, the fourth illumination data of the first probe is interpolated to obtain the second illumination data of the first active object; wherein the fourth illumination data is the illumination data corresponding to the first probe in the first illumination data.
6. The method according to claim 1, wherein: The virtual scene is composed of a plurality of scene modules; the step of determining a first scene area to be displayed in the virtual scene comprises: Among the multiple scene modules, a first scene module associated with the display instruction is determined and used as a first scene area to be displayed in the virtual scene.
7. The method according to claim 6, wherein: The method further comprises: Determine the second scene module adjacent to the first scene module among the plurality of scene modules; Extracting, from the scene illumination data, a third tetrahedron matching the second scene area and fifth illumination data corresponding to the third tetrahedron; In response to the first scene area moving to the second scene area, determining a third scene module in the second scene module that is associated with the second scene area; Based on the first lighting data, the second lighting data and the fifth lighting data of the third scene module, the lighting effect of the second scene area is displayed.
8. The method according to claim 1, wherein: The method further comprises: In response to the virtual scene expanding from displaying the first scene area to displaying the third scene area, based on the skylight data in the scene lighting data, the lighting effect of the third scene area is displayed; wherein a portion of the third scene area is the first scene area.
9. A data processing device for a virtual scene, wherein: include: A response module, configured to determine a first scene area to be displayed in the virtual scene and a first active object in the first scene area in response to a display instruction of the virtual scene; An extraction module, configured to extract, from preset scene illumination data, a first tetrahedron matching the first scene area and first illumination data corresponding to the first tetrahedron; wherein the scene illumination data is used to characterize illumination of the scene skylight and point light source preset in the virtual scene acting on the tetrahedron set in the virtual scene; A first determining module, configured to determine, in the first tetrahedron, a second tetrahedron where the first active object is located; a second determining module, configured to determine second illumination data of the first active object according to a positional relationship between the first active object and the second tetrahedron and the first illumination data; A display module is used to display the lighting effect of the first scene area based on the first lighting data and the second lighting data.
10. An electronic device, wherein: The method comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the method steps according to any one of claims 1 to 8 under the control of the computer program.
11. A computer-readable storage medium, the computer-readable storage medium comprising a stored computer program, wherein: When the computer program is executed, the method steps of any one of claims 1 to 8 are performed.