Virtual scene mapping processing method and device, electronic equipment, computer readable storage medium and computer program product

By configuring the color shader in the configuration interface to determine the visible area of ​​the virtual object, and only calculating and storing lighting information for the visible area, the problems of resource waste and limited rendering quality in the existing technology are solved, achieving more efficient resource utilization and quality improvement.

CN121366239APending Publication Date: 2026-01-20SHENZHEN TENCENT NETWORK INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410965392.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2026-01-20

AI Technical Summary

Technical Problem

Existing technologies fail to distinguish between visible and invisible areas of objects in global illumination rendering, resulting in wasted computational complexity and storage space. Furthermore, the limited resolution of lightmaps affects rendering quality.

Method used

By configuring the color shader in the configuration interface, the visible area of ​​the virtual object in the virtual scene is determined, and only the lighting information of the visible area is calculated and stored to generate a lightmap.

Benefits of technology

It improves the resource utilization of lightmaps, reduces the waste of computing and storage resources, and improves rendering quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121366239A_ABST
    Figure CN121366239A_ABST
Patent Text Reader

Abstract

The invention provides a mapping processing method and device for a virtual scene, electronic equipment, a computer readable storage medium and a computer program product. The method comprises the steps that a selected virtual scene is displayed in a development tool, the development tool comprises an illumination map generation entrance, and the virtual scene comprises a virtual object; in response to a trigger operation for a configuration control included in the illumination map generation entrance, displaying a configuration interface in the development tool; in response to the first configuration operation, a color shader configured for the virtual object is displayed in the configuration interface, and the color shader is included in the development tool and used for determining a visible area of the virtual object in the virtual scene; and in response to a trigger operation for a baking starting control included in the illumination map generation entrance, displaying an illumination map of the virtual scene obtained by baking, the illumination map storing illumination information of the visible area. Through the method and the device, the resource utilization rate of the illumination mapping can be improved, and resource waste is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of Internet, and particularly relates to a virtual scene map processing method and device, electronic equipment, computer readable storage medium and computer program product. BACKGROUND

[0002] In global illumination rendering, the scheme provided by the related art is usually to perform light map baking on the entire virtual scene (for example, a game scene, referred to as a scene), that is, to calculate the lighting information of each pixel in the scene, and then store the information in a light map. In the real-time rendering process, the lighting information of the pixel is obtained by querying the light map, so as to realize the effect of global illumination.

[0003] That is, the scheme provided by the related art is to perform light map calculation and storage on all regions in the scene, which means that even the regions that the user cannot see in the actual game also need to perform light map calculation and storage, which not only increases the calculation complexity, but also wastes a large amount of storage space. SUMMARY

[0004] The virtual scene map processing method and device, electronic equipment, computer readable storage medium and computer program product provided by the embodiments of the present application can improve the resource utilization rate of the light map and reduce resource waste.

[0005] The technical scheme of the embodiments of the present application is as follows:

[0006] The embodiments of the present application provide a virtual scene map processing method, comprising:

[0007] Display the selected virtual scene in the development tool, wherein the development tool comprises a light map generation entry, and the virtual scene comprises a virtual object;

[0008] In response to a triggering operation on a configuration control included in the light map generation entry, display a configuration interface in the development tool;

[0009] In response to a first configuration operation, display a color shader configured for the virtual object in the configuration interface, wherein the color shader is included in the development tool and is used to determine a visible region of the virtual object in the virtual scene;

[0010] In response to a triggering operation on a start baking control included in the light map generation entry, display a light map of the virtual scene obtained by baking, wherein the light map stores lighting information of the visible region.

[0011] The embodiments of the present application provide a virtual scene map processing device, comprising:

[0012] displaying a selected virtual scene in a development tool, wherein the development tool comprises a light map generation entry, and the virtual scene comprises a virtual object;

[0013] The display module is further configured to display a configuration interface in the development tool in response to a triggering operation on a configuration control included in the light map generation entry.

[0014] The display module is further configured to display a color shader configured for the virtual object in the configuration interface in response to a first configuration operation, wherein the color shader is included in the development tool and is used to determine a visible region of the virtual object in the virtual scene.

[0015] The display module is further configured to display a baked light map of the virtual scene in response to a triggering operation on a start baking control included in the light map generation entry, wherein the light map stores light information of the visible region.

[0016] An electronic device is provided in an embodiment of the present application, and the electronic device comprises:

[0017] a memory configured to store executable instructions;

[0018] a processor configured to execute the executable instructions stored in the memory to implement a light map processing method for a virtual scene provided in an embodiment of the present application.

[0019] A computer readable storage medium is provided in an embodiment of the present application, and the computer readable storage medium stores computer executable instructions, and is configured to be executed by a processor to implement a light map processing method for a virtual scene provided in an embodiment of the present application.

[0020] A computer program product is provided in an embodiment of the present application, and the computer program product comprises a computer program or computer executable instructions, and is configured to be executed by a processor to implement a light map processing method for a virtual scene provided in an embodiment of the present application.

[0021] The embodiment of the present application has the following beneficial effects:

[0022] By configuring a color shader in the configuration interface and determining a visible region of the virtual object in the virtual scene through the color shader, subsequent calculation of light information of the visible region of the virtual object can be performed, and the calculated light information of the visible region can be stored in a light map, thereby improving resource utilization of the light map and reducing resource waste. BRIEF DESCRIPTION OF DRAWINGS

[0023] Figure 1FIG. 1 is a schematic diagram of an architecture of a map processing system 100 of a virtual scene according to an embodiment of the present application;

[0024] Figure 2 FIG. 5 is a schematic diagram of a structure of an electronic device 500 according to an embodiment of the present application;

[0025] Figure 3 FIG. 6 is a schematic diagram of a flow of a map processing method of a virtual scene according to an embodiment of the present application;

[0026] Figure 4 FIG. 7 is a schematic diagram of a flow of a map processing method of a virtual scene according to an embodiment of the present application;

[0027] Figure 5 FIG. 8 is a schematic diagram of a flow of a map processing method of a virtual scene according to an embodiment of the present application;

[0028] Figure 6 FIG. 9 is a schematic diagram of a flow of a map processing method of a virtual scene according to an embodiment of the present application;

[0029] Figure 7 FIG. 10 is a schematic diagram of an application scenario of a map processing method of a virtual scene according to an embodiment of the present application;

[0030] Figure 8 FIG. 11 is a comparison diagram of UV2 corresponding to a visible region of an object and UV2 corresponding to all regions according to an embodiment of the present application;

[0031] Figure 9 FIG. 12 is a schematic diagram of a flow of a map processing method of a virtual scene according to an embodiment of the present application;

[0032] Figure 10 FIG. 13 is a schematic diagram of a flow of a map processing method of a virtual scene according to an embodiment of the present application;

[0033] Figure 11 FIG. 14 is a schematic diagram of all vertices according to an embodiment of the present application;

[0034] Figure 12 FIG. 15 is a schematic diagram of a virtual scene under a fixed view angle according to an embodiment of the present application;

[0035] Figure 13 FIG. 16 is a schematic diagram of an entire virtual scene according to an embodiment of the present application;

[0036] Figure 14 FIG. 17 is a light map of an entire virtual scene according to an embodiment of the present application. DETAILED DESCRIPTION

[0037] In order to make the purposes, technical solutions and advantages of the present application clearer, the following further describes the present application with reference to the accompanying drawings, the described embodiments should not be regarded as limitations to the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0038] In the following description, "some embodiments" are referred to, which describe a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0039] It can be understood that, in the embodiments of the present application, data related to user information and the like are involved, and when the embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards.

[0040] In the following description, the terms "first, second,... " are only to distinguish similar objects, and do not represent a specific order of the objects. It can be understood that "first, second,... " can be interchanged in a specific order or sequence as allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

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

[0042] Before the embodiments of the present application are further described in detail, the terms and phrases involved in the embodiments of the present application are explained, which are applicable to the following explanations.

[0043] 1) In response to: used to represent the conditions or states on which the operations performed depend, when the dependent conditions or states are met, one or more operations performed can be real-time or have a set delay; in the absence of special instructions, there is no restriction on the execution order of multiple operations performed.

[0044] 2) Global Illumination (GI): a technique in computer graphics that simulates the interaction of direct and indirect light sources in a virtual scene to produce more realistic and natural lighting effects.

[0045] 3) Baking: In computer graphics, baking is a pre-computation technique that involves calculating complex lighting, textures, and other information in advance and storing it in a map for direct use during real-time rendering, improving rendering efficiency.

[0046] 4) Lightmap: A map used to store lighting information, typically for baking global lighting. Each pixel in a lightmap corresponds to a surface location in a virtual scene, recording the lighting information at that location. During real-time rendering, the lighting information of an object's surface in a virtual scene is obtained by querying the lightmap.

[0047] 5) UV2: Refers to the second set of UV coordinates of an object's surface, used to store coordinate information of a lightmap, where U represents the horizontal position and V represents the vertical position. Compared to the first set of UV coordinates (i.e., UV1) mainly used to store texture maps, UV2 is usually used for global lighting rendering and other special effect calculations.

[0048] 6) Texel: Refers to a pixel in a texture map, which is the basic unit of a texture map. During the process of mapping a texture map to a three-dimensional model, a texel is mapped to one or more pixels on the model's surface, allowing the texture's details to be displayed.

[0049] 7) Shader: A program running on a graphics processing unit (GPU), which determines the appearance, color, lighting effects, and other rendering effects of an object. Shaders are a core component of the graphics rendering pipeline, responsible for processing and calculating the final output of pixels and vertices.

[0050] In global lighting rendering, the related art provides a solution that typically involves baking a lightmap for the entire scene, i.e., first calculating the lighting information for each pixel in the scene, then storing this information in a lightmap. During real-time rendering, the lighting information of a pixel is obtained by querying the lightmap, achieving the effect of global lighting.

[0051] However, the applicant has found in the implementation of the embodiments of the present application that the solution provided by the related art does not distinguish between visible and invisible regions of an object, and the UV2 used by the lightmap is mainly generated by an artist in digital content creation (DCC) software, which unfolds all triangles included in the object's mesh, and all regions are calculated and stored for lightmapping. This means that even regions that the user cannot see in the actual game also need to be calculated and stored for lightmapping. This not only increases the complexity of the calculation, but also wastes a large amount of storage space.

[0052] In addition, the applicant also finds that, since all regions need to be calculated for light mapping, the resolution of the light mapping cannot be too high, otherwise the calculation amount will be too large. The resolution of the light mapping directly affects the rendering quality, and therefore the solution provided by the related art also has limitations in rendering quality. That is, the solution provided by the related art causes a large amount of waste of calculation and storage resources in a static scene and a fixed view angle game scene, and also limits the rendering quality.

[0053] In view of this, the embodiment of the present application provides a virtual scene mapping processing method and device, an electronic device, a computer readable storage medium and a computer program product, which can effectively improve the resource utilization rate of light mapping, thereby reducing resource waste. The electronic device provided by the embodiment of the present application is described below. The electronic device provided by the embodiment of the present application can be implemented as a terminal device, or implemented by a terminal device and a server in cooperation. The virtual scene mapping processing method provided by the embodiment of the present application is described below.

[0054] For example, referring to Figure 1 , Figure 1 is an architecture schematic diagram of a virtual scene mapping processing system 100 provided by the embodiment of the present application, in order to realize the application of supporting improving the resource utilization rate of light mapping and reducing resource waste, as shown in Figure 1 The virtual scene mapping processing system 100 includes a server 200, a network 300 and a terminal device 400, wherein the network 300 can be a local area network or a wide area network, or a combination of the two, and the terminal device 400 is a terminal device associated with a user (such as a game developer or a planner, etc.). The development tool 410, such as a game development engine, game development software, etc., is running on the terminal device 400.

[0055] In some embodiments, when the server 200 receives the virtual scene acquisition request sent by the development tool 410 through the network 300, the server 200 can send a plurality of candidate virtual scenes to the development tool 410 for the user to select. After the user makes a selection, the user-selected virtual scene can be displayed in the development tool 410, and then the user can further perform scene information setting, for example, including the placement of objects in the scene, the setting of light source parameters, and the setting of camera parameters, etc. Subsequently, when receiving a click operation of the user on the configuration control included in the light map generation entry displayed in the development tool 410, a configuration interface can be displayed in the development tool 410, for example, the configuration interface can be displayed in the user-selected virtual scene. The user can configure a color shader for the virtual object in the configuration interface to determine the visible region of the virtual object in the virtual scene through the color shader. Finally, when receiving a click operation of the user on the start baking control included in the light map generation entry, the light information of the visible region of the virtual object can be calculated, and the calculated light information is stored in the light map, and the baked light map is displayed in the development tool 410, for example, the virtual scene displayed in the development tool 410 can be replaced by the light map. In this way, since only the light information of the visible region is stored in the light map, the resource utilization rate of the light map is effectively improved, and resource waste is reduced.

[0056] In other embodiments, the embodiments of the present application can also be implemented by means of cloud technology. Cloud technology refers to a kind of hosting technology that unifies a series of resources such as hardware, software, network, etc. in a wide area network or local area network to realize data calculation, storage, processing and sharing.

[0057] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology applied on the basis of cloud computing business model, which can form a resource pool and be used on demand, flexibly and conveniently. Cloud computing technology will become an important support. The background service of the technical network system needs a large amount of computing and storage resources.

[0058] Examples, Figure 1The server 200 in the figure can be a stand-alone physical server, a server cluster composed of multiple physical servers, or a distributed system, and can also be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal device 400 can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, and the like, but is not limited thereto. The terminal device 400 and the server 200 can be connected directly or indirectly through wired or wireless communication, and the present application is not limited in this embodiment.

[0059] The structure of the electronic device provided in the embodiments of the present application will be described below. Taking the electronic device as a terminal device as an example, referring to Figure 2 , Figure 2 is a structural schematic diagram of an electronic device 500 provided in the embodiments of the present application, Figure 2 The electronic device 500 shown in the figure includes at least one processor 510, a memory 550, at least one network interface 520, and a user interface 530. The various components in the electronic device 500 are coupled together through a bus system 540. It can be understood that the bus system 540 is used to realize the connection and communication between the components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for the purpose of clear illustration, all kinds of buses are marked as the bus system 540 in the figure. Figure 2

[0060] The processor 510 can be an integrated circuit chip with signal processing capability, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc., wherein the general-purpose processor can be a microprocessor or any conventional processor.

[0061] The user interface 530 includes one or more output devices 531 that enable the presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, a mouse, a microphone, a touch screen display, a camera, other input buttons and controls.

[0062] ​The memory 550 can be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical disc drives, etc. The memory 550 optionally includes one or more storage devices remotely located from the processor(s) 510.

[0063] The memory 550 includes volatile memory or nonvolatile memory, and can also include both volatile and nonvolatile memory. Nonvolatile memory can be read only memory (ROM), volatile memory can be random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.

[0064] In some embodiments, the memory 550 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or a subset or superset thereof, which are exemplarily illustrated below.

[0065] The operating system 551 includes 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;

[0066] The network communication module 552 is used to communicate with other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include Bluetooth, wireless fidelity (WiFi), universal serial bus (USB), etc.

[0067] The presentation module 553 is used to enable the presentation of information via one or more output devices 531 associated with the user interface 530 (e.g., a display screen, a speaker, etc.), such as a user interface for operating peripheral devices and displaying content and information.

[0068] The input processing module 554 is used to detect and interpret one or more user inputs or interactions from one or more input devices 532.

[0069] In some embodiments, the apparatus provided by the embodiments of the present application can be implemented in software, Figure 2A mapping processing apparatus 555 of the virtual scene stored in the memory 550 is shown, which can be software in the form of programs and plug-ins, etc., including the following software modules: a display module 5551, a setting module 5552, a moving module 5553, an obtaining module 5554, a storage module 5555, a generating module 5556, an updating module 5557, a determining module 5558, and a shading module 5559, which are logical, and thus can be combined or further split according to the implemented functions. It should be noted that all the above modules are shown at one time for the convenience of expression, but should not be regarded as excluding the implementation that the mapping processing apparatus 555 of the virtual scene can only include the display module 5551, and the functions of the modules will be described below. Figure 2

[0070] The mapping processing method of the virtual scene provided in the embodiments of the present application will be described in detail below in combination with the exemplary applications and implementations of the terminal device provided in the embodiments of the present application.

[0071] It should be noted that the development tool can be run on the terminal device, for example, a game development engine (such as Unity) or game development software, etc.

[0072] Referring to Figure 3 , Figure 3 is a flowchart of the mapping processing method of the virtual scene provided in the embodiments of the present application, which will be described in combination with the steps shown in Figure 3 .

[0073] In step 101, the selected virtual scene is displayed in the development tool.

[0074] Here, the development tool can include a light map generation entry, and the virtual scene can include a virtual object.

[0075] It should be noted that the light map generation entry can be a native entry of the development tool, that is, the technical solution provided in the embodiments of the present application can be integrated into the development tool; of course, the light map generation entry can also be an entry of a plug-in installed in the development tool, that is, the technical solution provided in the embodiments of the present application can also be implemented in the form of a plug-in, which is not limited in the embodiments of the present application.

[0076] In some embodiments, step 101 can be implemented in the following manner: a virtual scene import control is displayed in the development tool; in response to a triggering operation (such as a click operation) on the virtual scene import control, a plurality of candidate virtual scenes are displayed (for example, the names or thumbnails of the plurality of candidate virtual scenes can be displayed in the form of a pop-up window); and in response to a selection operation on the plurality of candidate virtual scenes, the selected virtual scene is displayed in the development tool.

[0077] ​It should be noted that the plurality of candidate virtual scenes can be virtual scenes stored locally by the terminal device, or can be acquired from a server in real time, and the embodiments of the present application do not make specific limitation thereto.

[0078] In some embodiments, the virtual scene can further include a virtual light source and a virtual camera, wherein the visible region of the virtual object in the virtual scene can be related to camera parameters of the virtual camera (for example, including a position of the camera in the scene and an orientation, etc.); the lighting information of the visible region can be related to light source parameters of the virtual light source, and after step 101 is performed, at least one of the following processes can be further performed: in response to a position setting operation for the virtual scene, moving the virtual object to a set position in the virtual scene; in response to a light source parameter setting operation for the virtual scene, adjusting the light source parameters of the virtual light source to set light source parameters, wherein the set light source parameters can be used to determine the lighting information of the visible region; in response to a camera parameter setting operation for the virtual scene, adjusting the camera parameters of the virtual camera to set camera parameters, wherein the set camera parameters can be used to determine the visible region of the virtual object, for example, a color shader can determine the visible region of the virtual object in the virtual scene based on the set camera parameters. That is, after the selected virtual scene is imported into the development tool, the developer can further set scene information, for example, including placement of virtual objects (referred to as objects) in the scene, setting of light source parameters, and setting of camera parameters, etc.

[0079] In step 102, in response to a triggering operation of a configuration control included in the light map generation entry, a configuration interface is displayed in the development tool.

[0080] In some embodiments, the light map generation entry can be displayed in a function bar (for example, which can be located at the top or left side of the development tool) of the development tool. When a click operation of the developer for the light map generation entry is received, the configuration control included in the light map generation entry can be displayed. When a click operation of the developer for the configuration control is received, the configuration interface can be displayed in the development tool, for example, the configuration interface can be displayed in the selected virtual scene, or the configuration interface can be displayed in a manner independent of the selected virtual scene, and the embodiments of the present application do not make specific limitation thereto.

[0081] In step 103, in response to a first configuration operation, a color shader configured for the virtual object is displayed in the configuration interface.

[0082] Here, the color shader can be included in the development tool, for example, the color shader can be built-in in the development tool and used to determine the visible region of the virtual object in the virtual scene.

[0083] In some embodiments, the development tool can further include a toolbar entry, the first configuration operation can include a first trigger operation and a first movement operation, and step 103 can be implemented by: in response to the first trigger operation on the toolbar entry, displaying a toolbar list, wherein the toolbar list includes a plurality of shaders in the development tool, and the plurality of shaders includes the color shader; and in response to the first movement operation on the color shader and a release point of the first movement operation being located in the first preset area of the configuration interface, moving the color shader from the toolbar list to the first preset area of the configuration interface. That is, after displaying the configuration interface, the developer can drag the color shader from the toolbar list to the configuration interface to complete the configuration of the color shader.

[0084] In some embodiments, the visible region of the virtual object in the virtual scene can be obtained by invoking the color shader to perform the following processing: splitting the mesh of the virtual object into a plurality of polygons (e.g., triangles), and performing the following processing for each polygon: mapping the polygon to a screen space, and converting the mapped polygon into a pixel in the screen space; in response to a depth value of the pixel being less than a depth threshold, determining the polygon as a visible polygon in the virtual scene; and determining a region composed of a plurality of visible polygons as the visible region of the virtual object in the virtual scene.

[0085] For example, in the case of triangles, the visibility of a triangle in a virtual scene can be determined by a triangle shading method, which is a raster-based visibility test method. In the geometry processing stage of a graphics rendering pipeline, a triangle can be mapped to a screen and converted into a pixel. A shader program runs on each pixel to determine which triangle is closer to an observer (e.g., a game character in the scene) by comparing the depth values (i.e., Z values) of different triangles at the pixel position, thereby determining the visibility of the triangle, i.e., whether it is visible under the current virtual camera. This method is simple and feasible, but it may require processing a large number of pixels and has high computational overhead.

[0086] In other embodiments, the visible region of the virtual object in the virtual scene can also be obtained by invoking the color shader to perform the following processing: splitting the mesh of the virtual object into a plurality of polygons, and performing the following processing for each polygon: sending a query request carrying an identifier of the polygon, wherein the query request is used to query whether the polygon is visible in the virtual scene; and determining a region composed of a plurality of polygons that are visible in the virtual scene as the visible region of the virtual object in the virtual scene.

[0087] For example, a triangle is taken as an example of a polygon. Whether the triangle is visible in the virtual scene can be determined by a hardware occlusion query. Specifically, modern graphics hardware usually provides an occlusion query function, which allows developers to inquire whether a triangle is visible in a scene. By using this query, whether the triangle is occluded by other triangles can be determined without actually rendering the triangle. This method can reduce unnecessary rendering work and save resources.

[0088] In some embodiments, the visible region of the virtual object in the virtual scene can also be obtained by invoking a color shader to perform the following processing: splitting a mesh of the virtual object into a plurality of polygons, and performing the following processing for each polygon: emitting a detection ray from a position of a virtual camera included in the virtual scene along a direction of the virtual camera; in response to the detection ray intersecting the polygon and the intersection point being inside the polygon, determining the polygon as a visible polygon in the virtual scene; and determining a region composed of the plurality of visible polygons as the visible region of the virtual object in the virtual scene.

[0089] For example, a triangle is taken as an example of a polygon. Whether the triangle is visible in the virtual scene can also be determined by ray casting. Ray casting is a light-based visibility determination method. Ray casting simulates a light ray from a virtual camera, detects whether the light ray intersects a triangle in the scene, and determines whether the intersection point is inside the triangle when the light ray intersects the triangle. This method can obtain very accurate visibility information, but the computational cost is relatively high.

[0090] It should be noted that in actual applications, developers can select any one of the three methods described above to determine the visible region of the virtual object according to actual conditions, and the embodiments of the present application do not make specific limitations thereto.

[0091] In some embodiments, in addition to configuring the color shader in the configuration interface, the developer can also configure a material shader in the configuration interface for the virtual object, that is, after step 102, the following process can also be performed: in response to a second configuration operation, displaying the material shader configured for the virtual object in the configuration interface, wherein the material shader includes a meta channel for determining the reflection effect of the visible region of the virtual object when the light of the virtual light source is incident on the visible region.

[0092] In some embodiments, the second configuration operation described above can include a second trigger operation and a second movement operation, and the above-mentioned displaying the material shader configured for the virtual object in the configuration interface in response to the second configuration operation can be implemented in the following manner: in response to the second trigger operation on the toolbar entry, displaying a toolbar list, wherein the toolbar list includes a plurality of shaders in the development tool, and the plurality of shaders includes the material shader; and in response to the second movement operation on the material shader, and the release point of the second movement operation being located in the second preset area of the configuration interface, moving the material shader from the toolbar list to the second preset area of the configuration interface.

[0093] It should be noted that the developer can configure the material shader after configuring the color shader, or can configure the material shader first and then configure the color shader, and the application does not specifically limit the configuration order of the two shaders.

[0094] In step 104, in response to the trigger operation on the start baking control included in the light map generation entry, the light map of the virtual scene obtained by baking is displayed.

[0095] Here, the light map can store the lighting information of the visible region. For example, each pixel in the light map can correspond to a position of the visible region, and record the lighting information of the position.

[0096] In some embodiments, referring to Figure 4 , Figure 4 is a flowchart of a map processing method of a virtual scene provided by an embodiment of the application, as shown in Figure 4 Figure 3 ​The illustrated step 104 can be implemented by Figure 4 The illustrated steps 1041 to 1043 are implemented to achieve Figure 4 The illustrated steps are described.

[0097] In step 1041, in response to a triggering operation of the start baking control included in the light map generation entry, the light information of the visible region is obtained.

[0098] In some embodiments, when receiving a click operation of the start baking control included in the light map generation entry by the developer, the light information of the visible region of the virtual object can be calculated, for example, an appropriate light model (including Lambert model or Blinn-Phong model) can be called to calculate the light information of the visible region of the virtual object according to the light source parameters (including light source type, distance between light source and object, etc.) and material properties of the object surface set by the developer. That is, after determining the visible region of the virtual object, the accurate baking of the light information of the visible region can be achieved.

[0099] In step 1042, the light information of the visible region is stored in the light map corresponding to the virtual scene.

[0100] In some embodiments, after calculating the light information of the visible region, the calculated light information of the visible region can be stored in the light map corresponding to the virtual scene, wherein each pixel of the light map can correspond to a position of the visible region, and the light information of the position is recorded. In this way, the resource utilization rate of the light map can be effectively improved, and resource waste is reduced.

[0101] In step 1043, the light map is displayed in the development tool.

[0102] In some embodiments, before displaying the light map in the development tool, the following processing can also be performed: in response to a viewing triggering operation, a second set of two-dimensional coordinates corresponding to the visible region (for example, UV2 regenerated for the visible region) is displayed in the development tool, wherein the second set of two-dimensional coordinates is used to store coordinate information of the light map.

[0103] It should be noted that since the UV2 corresponding to the visible region is only an intermediate result, it can not be displayed by default, and only when a viewing operation triggered by the developer is received, it is displayed in the development tool.

[0104] In some embodiments, the second set of two-dimensional coordinates corresponding to the visible region can be obtained by the following process: dividing the mesh of the virtual object into a plurality of polygons (e.g., triangles), and selecting visible polygons (i.e., polygons that are visible in the virtual scene) from the plurality of polygons; combining the visible polygons into a new mesh, and performing coordinate mapping on the new mesh to obtain the second set of two-dimensional coordinates (e.g., UV2) corresponding to the visible region.

[0105] For example, when the polygons are triangles, the second set of two-dimensional coordinates (UV2) corresponding to the visible region can be obtained by the following process: dividing the surface mesh of the virtual object into a plurality of triangles, and determining whether each triangle is visible under the current virtual camera included in the virtual scene. Since only the visible region needs to be generated with UV2 corresponding to the light map, the triangles that are not visible in the scene can be discarded, and the remaining visible triangles can be combined into a new mesh. Then, the new mesh can be passed into the Unwrapping.GeneratePerTriangleUV() method of Unity to obtain the UV2 corresponding to the visible region. The Unwrapping.GeneratePerTriangleUV() method is a method for UV unwrapping in Unity, and it belongs to the “Unwrapping” class. This method is used to generate the UV2 coordinates of each triangle, so that the visible region can be correctly colored based on the light map. UV unwrapping is a process of mapping vertices on a 3D model to a 2D plane, which is crucial for light mapping. Each vertex on the 3D model is assigned one or more UV2 coordinates, which determine the location of the lighting information on the model.

[0106] It should be noted that, in addition to the Unwrapping.GeneratePerTriangleUV() method of Unity, other algorithms or manual methods can also be used to unwrap the new mesh, and the embodiments of the present application do not make specific limitations in this regard.

[0107] In some embodiments, since there can be a small amount of field-of-view lens at the beginning of the game, the invisible region of the virtual object also needs to be reserved and simply colored (for example, by multiplying the reflectivity by a constant), while the invisible region also needs to generate global illumination for the visible region, in addition, when performing coordinate mapping on the new mesh, the same vertex can return multiple sets of UV2, so the original vertex needs to be added, in addition, considering the cache loss problem, the added vertex is preferably near the original vertex, then after screening the visible polygons in the virtual scene from the multiple polygons obtained by splitting the mesh of the virtual object, the following processing can be performed: based on the hash table, the second set of two-dimensional coordinates corresponding to the vertices of the visible polygons (for example, UV2, where the same vertex can have multiple sets of UV2), and the index corresponding to the vertices in the index cache are counted; new vertices are added at the position of each vertex according to the number of UV2 (for example, assuming that the current vertex has 2 UV2 coordinates, a new vertex can be added, and if there are 3 UV coordinates, 2 new vertices can be added), and the index is updated according to the addition result (for example, the newly added vertices can be added to the original index); the vertices of the invisible polygons in the virtual scene (i.e., the polygons that are invisible in the virtual scene) are added behind the vertices of the visible polygons, and the index is updated again (for example, the vertices of the invisible triangles can be added to the updated index), so that when global illumination rendering of the virtual scene is needed in the subsequent process, all the vertices of the triangles (including visible triangles and invisible triangles) can be quickly found based on the re-updated index.

[0108] For example, the vertices used by the visible triangles can be found first, then the array composed of the reused UV2 of each vertex is found, and new vertices (including normal and tangent, etc.) are added at the position of the original vertex according to the number of UV2 in the array, then the triangle index is updated according to the new vertex array, and the process of generating the visible mesh (GenerateVisibleMesh) ends; then the invisible mesh can be merged (MergeUnvisibleMesh), and the specific process is as follows: the vertex position, normal, tangent, etc. of the invisible triangle are added (for example, the vertices of the invisible triangle can be added behind the vertices of the visible triangle), and the invisible triangle index is updated according to the new vertex array (i.e., the vertices of the invisible triangle are also added to the index).

[0109] In some embodiments, after the plurality of visible polygons are combined into the new mesh, the following processing can also be performed: for an invisible region of the virtual object in the virtual scene, the mode of the mesh corresponding to the invisible region is modified from receiving global illumination to an illumination probe, so that the invisible region does not occupy the space of the light map but can still have the effect of global illumination on the visible region, and in addition, the mesh corresponding to the visible region can be replaced with the new mesh.

[0110] In some embodiments, referring to Figure 5 , Figure 5 is a flowchart of a map processing method of a virtual scene provided by an embodiment of the present application, as shown in Figure 5 after step 104 shown in Figure 3 , steps 105 and 106 shown in Figure 5 may also be performed, which will be described in combination with the steps shown in Figure 5 .

[0111] In step 105, when rendering global illumination for the virtual scene, the visible region is colored based on the light map.

[0112] In some embodiments, when subsequently rendering global illumination for the virtual scene, for the visible region of the virtual object in the virtual scene, the visible region can be colored by the light map, for example, the visible region can be colored by the lighting information stored in the light map. Since only the lighting information of the visible region is stored in the light map, the visible region occupies a larger area in the light map, thereby improving the quality of rendering.

[0113] In step 106, the invisible region of the virtual object in the virtual scene is colored based on the reflectivity multiplied by a constant.

[0114] In some embodiments, for the invisible region of the virtual object in the virtual scene, i.e., the region that the user cannot see in the game, the invisible region can be colored by a simple method of reflectivity multiplied by a constant, so that the waste of resources is effectively reduced while the user's viewing experience is not reduced.

[0115] The map processing method of the virtual scene provided by the embodiment of the present application can configure the color shader in the configuration interface, and determine the visible region of the virtual object in the virtual scene by the color shader, so that subsequent calculation of lighting information can be performed only for the visible region of the virtual object, and the calculated lighting information of the visible region can be stored in the light map, thereby improving the resource utilization rate of the light map and reducing resource waste.

[0116] In the following, taking a strategy tower defense game as an example, an exemplary application of an embodiment of the present application in an actual application scenario is described.

[0117] In a strategy tower defense game, the game scene has more static and fixed view angles. If the visible and invisible areas of objects in the scene are not distinguished, and the calculation and storage of light mapping of all areas of the objects are directly performed, a large amount of calculation and storage resources will be wasted. At the same time, since the calculation of light mapping of all areas is required, the resolution of light mapping is also limited, thereby affecting the rendering quality.

[0118] In view of this, the embodiment of the present application provides a light mapping optimization scheme based on triangle visibility. By regenerating the UV2 (i.e. the second set of UV coordinates) of the object, accurate baking of the light mapping of the visible triangle area is realized, thereby improving the resource utilization rate of the light mapping and reducing resource waste. At the same time, the technical scheme provided by the embodiment of the present application is particularly suitable for static and fixed view angle game scenes.

[0119] The technical scheme provided by the embodiment of the present application will be described in detail below.

[0120] In some embodiments, the technical scheme provided by the embodiment of the present application can provide support for the graphic rendering development process in the form of a Unity tool plug-in. The developer can operate according to the steps shown in the following figure: Figure 6

[0121] In step 201, a rendering environment is set.

[0122] In some embodiments, the developer first needs to set the scene information, for example, including the placement of objects in the scene, the setting of light source parameters, and the setting of camera parameters, etc. After the setting is completed, as shown in the following figure, the developer can click the Create Setting File button 701 (corresponding to the configuration control described above) in the plug-in. When the click operation of the developer on the Create Setting File button 701 is received, the configuration interface 702 can be displayed. The developer can configure the related information in the configuration interface 702, for example, including the camera mode, the color shader, and the screen size, etc. Figure 7

[0123] In step 202, a shader is configured.

[0124] ​​In some embodiments, there are two shaders that developers need to configure. One is a triangle color shader used for visibility detection (of course, other methods can also be used for visibility detection). For example, developers can drag this shader to the Color Shader in Settings. The other is a material shader for objects in the scene. For this shader, developers can customize it according to the material of the object. However, it should be noted that the shader of the material of the object that needs to generate GI must contain a meta pass. When sampling the lightmap, it is necessary to determine whether it is visible. This will be explained in detail below.

[0125] In step 203, the system is run.

[0126] In some embodiments, after configuring the shaders, developers can click Figure 7 The "RunBake" button 703 in the plugin shown (corresponding to the aforementioned "RunBake" control) starts the system when a developer clicks on the "RunBake" button 703. After the system finishes running, the object's UV2 can be regenerated for the object's visible area, for example, Figure 8 This demonstrates the difference between the regenerated UV2 (left, the UV2 corresponding to the visible area of ​​the object) for a specific object in the scene and the original UV2 (right, the UV2 corresponding to all areas of the object).

[0127] In step 204, the baking parameters are set and the lightmap is baked.

[0128] In some embodiments, after baking, the lightmap only saves the lighting information of the visible areas of objects in the scene.

[0129] The following will continue to combine Figure 9 The texture processing method for virtual scenes provided in the embodiments of this application will be described.

[0130] For example, see Figure 9 , Figure 9 This is a flowchart illustrating the texture processing method for a virtual scene provided in this application embodiment, which will be combined with... Figure 9 The steps shown are explained.

[0131] In step 301, the visibility of the triangle is obtained.

[0132] In some embodiments, methods such as triangle coloring, hardware occlusion query, and ray casting can be used to determine whether each triangle in the scene is visible under the current camera.

[0133] In step 302, clip the invisible triangles.

[0134] In step 303, generate UV2.

[0135] In some embodiments, since only the visible region needs to be generated with UV2 corresponding to the light map, the invisible triangles can be culled, and a new Mesh can be generated based on the visible triangles, and then the new Mesh can be passed into the Unwrapping.GeneratePerTriangleUV() method of Unity, so that the UV2 corresponding to the visible region can be obtained, and the corresponding code example is as follows:

[0136] var inputMesh = Object.Instantiate(originalMesh);

[0137] inputMesh.triangles = inputTriangles.ToArray(); / / inputTriangles is the visible triangle

[0138] var wholeUV2Gen = Unwrapping.GeneratePerTriangleUV(inputMesh).

[0139] In step 304, add invisible triangles and vertices.

[0140] In some embodiments, since there will be a small amount of field-of-view camera at the beginning of the game, the Mesh of the invisible region also needs to be retained and simply colored, and this part of the region also needs to produce global illumination (GI) on the visible region. In addition, since the Unwrapping.GeneratePerTriangleUV() method of Unity may return multiple sets of UV2 for the same vertex, the original Mesh needs to be added with vertices, and considering the cache miss problem, the added vertices are preferably near the original vertices, and the specific process of rearranging the vertices will be described in combination with the steps shown in Figure 10 and Figure 10 .

[0141] In step 401, get the vertices used by the visible triangles.

[0142] In step 402, get an array composed of the UV2 reused by each vertex.

[0143] In step 403, add the corresponding vertex positions, normals, tangents, UV, etc. according to the number of UV2 in the array.

[0144] In step 404, the triangle index is updated according to the new vertex array.

[0145] In some embodiments, after obtaining the vertex of the visible triangle (denoted as vInfo), the reused UV2 and the corresponding index of the vertex in the index buffer can be counted through a hash table first, and then the new vertex (e.g., including normal, UV, and tangent, etc.) can be added in the position of each original vertex according to the reused UV2 and the corresponding index is updated.

[0146] In step 405, the vertex position, normal, tangent, UV, etc. of the invisible triangle are added.

[0147] In step 406, the invisible triangle index is updated according to the new vertex array.

[0148] In some embodiments, as shown in the above example, after updating the triangle index according to the new vertex array, the vertex of the triangle in the invisible region can be added at the end and the index is updated. The code corresponding to the above process is as follows: Figure 11

[0149] / / Generate visible region vertex for each submesh of Mesh

[0150] var newSubmesh=GenerateVisibleMesh(submesh,smInputTriangles[smIndex].ToArray(),smUV2Gen[smIndex].ToArray());

[0151] / / Merge invisible region vertex

[0152] MergeUnvisibleMesh(submesh,newSubmesh,smUnvisibleTriangles[smIndex]);

[0153] In step 305, save the Mesh and replace it.

[0154] In some embodiments, for the Mesh completely in the invisible region, the mode of receiving global illumination (Receive GI) can be modified to Light Probes, so that it does not occupy the space of the light map but still can produce GI effect on the visible region; and for other Mesh, the generated new Mesh is saved and replaced.

[0155] The process of baking and rendering will be described below.​

[0156] In some embodiments, when the developer bakes GI for a scene that replaces a new mesh, the visible area can be shaded by lightmap, and the invisible area can be shaded by a simple Albedo constant (e.g. 0.8), and the corresponding code example is as follows:

[0157] / / Set uv2 of invisible area to (1, 1)

[0158] if(i.uv.z>0.9999&&i.uv.w>0.9999){

[0159] col.rgb=col.rgb*0.8;

[0160] }else{

[0161] half4 bakedColorTex=UNITY_SAMPLE_TEX2D(unity_Lightmap,i.uv.zw);

[0162] half3 bakedColor=DecodeLightmap(bakedColorTex);

[0163] col.rgb=col.rgb*bakedColor;

[0164] }

[0165] In summary, the technical scheme provided by the embodiments of the present application has the following beneficial effects:

[0166] 1) Resource optimization: through lightmap optimization based on triangle visibility, only the visible area is calculated and stored for lighting information, reducing the waste of computing and storage resources, which makes it possible to more effectively use limited resources and improve overall performance in static scenes and fixed-angle game scenes.

[0167] 2) Improved rendering quality: since only the visible area needs to be calculated for lightmap, the triangles of the visible area can occupy a larger lightmap area and texel, thereby improving the quality of rendering. This makes it possible for users to obtain more realistic and detailed lighting effects in practical applications, thereby improving user experience.

[0168] The beneficial effects of the technical scheme provided by the embodiments of the present application will be further described below in conjunction with experimental data.

[0169] For example, in a static scene, the lightmap area of a triangle is 1 texel, and the lightmap area of a triangle is 4 texels. Figure 12As shown in the scene, the area of the invisible region accounts for 92.36% of the total area, and after the invisible region is cropped, the size of the light map can be reduced from 9.3 megabytes (MB) to 4.3 MB, and the area of the triangle included in the visible region in the light map can be increased by 2.53 times.

[0170] It should be noted that, Figure 12 As shown in the scene, the picture is viewed from a fixed perspective (no difference before optimization), Figure 13 for the entire scene, Figure 14 for the light map of the scene, the dark region is not within the perspective range, and can be rendered by multiplying the reflectivity by a constant.

[0171] The following continues to illustrate an exemplary structure of the implementation of the virtual scene map processing apparatus 555 provided by the embodiments of the present application as a software module. In some embodiments, as shown in Figure 2 The software module stored in the virtual scene map processing apparatus 555 of the storage 550 can include a display module 5551.

[0172] The display module 5551 is configured to display the selected virtual scene in a development tool, wherein the development tool includes a light map generation entry, and the virtual scene includes a virtual object. The display module 5551 is further configured to display a configuration interface in the development tool in response to a triggering operation on a configuration control included in the light map generation entry. The display module 5551 is further configured to display a color shader configured for the virtual object in the configuration interface in response to a first configuration operation, wherein the color shader is included in the development tool and is used to determine a visible region of the virtual object in the virtual scene. The display module 5551 is further configured to display a baked light map of the virtual scene in response to a triggering operation on a start baking control included in the light map generation entry, wherein the light map stores light information of the visible region.

[0173] In some embodiments, the virtual scene further includes a virtual light source and a virtual camera. The virtual scene map processing apparatus 555 further includes a setting module 5552 configured to perform at least one of the following processes: moving the virtual object to a set position in the virtual scene in response to a position setting operation on the virtual scene; adjusting a light source parameter of the virtual light source to a set light source parameter in response to a light source parameter setting operation on the virtual scene, wherein the set light source parameter is used to determine the light information of the visible region; and adjusting a camera parameter of the virtual camera to a set camera parameter in response to a camera parameter setting operation on the virtual scene, wherein the set camera parameter is used to determine the visible region of the virtual object in the virtual scene.

[0174] In some embodiments, the development tool further includes a toolbar entry, the first configuration operation includes a first trigger operation and a first movement operation; the display module 5551 is further configured to display a toolbar list in response to the first trigger operation on the toolbar entry, wherein the toolbar list includes a plurality of shaders in the development tool, and the plurality of shaders includes the color shader; and the virtual scene mapping processing apparatus 555 further includes a movement module 5553 configured to move the color shader from the toolbar list to the first preset area of the configuration interface in response to the first movement operation on the color shader and a release point of the first movement operation being located in the first preset area of the configuration interface.

[0175] In some embodiments, the virtual scene further includes a virtual light source, and the display module 5551 is further configured to display a material shader for the virtual object configuration in the configuration interface in response to a second configuration operation, wherein the material shader includes a meta channel for determining a reflection effect of a visible region on a light ray when the light ray of the virtual light source is incident on the visible region.

[0176] In some embodiments, the development tool further includes a toolbar entry, the second configuration operation includes a second trigger operation and a second movement operation; the display module 5551 is further configured to display a toolbar list in response to the second trigger operation on the toolbar entry, wherein the toolbar list includes a plurality of shaders in the development tool, and the plurality of shaders includes the material shader; and the movement module 5553 is further configured to move the material shader from the toolbar list to the second preset area of the configuration interface in response to the second movement operation on the material shader and a release point of the second movement operation being located in the second preset area of the configuration interface.

[0177] In some embodiments, the virtual scene mapping processing apparatus 555 further includes an acquisition module 5554 and a storage module 5555, wherein the acquisition module 5554 is configured to acquire light information of the visible region in response to a trigger operation on a start baking control included in the light map generation entry; the storage module 5555 is configured to store the light information of the visible region into a light map corresponding to the virtual scene; and the display module 5551 is further configured to display the light map in the development tool.

[0178] In some embodiments, the display module 5551 is further configured to display a second set of two-dimensional coordinates corresponding to the visible region in the development tool in response to a viewing trigger operation, wherein the second set of two-dimensional coordinates is used to store coordinate information of the light map.

[0179] In some embodiments, the mapping processing apparatus 555 of the virtual scene further includes a generating module 5556 configured to split the mesh of the virtual object into a plurality of polygons, and screen out visible polygons in the virtual scene from the plurality of polygons; combine the plurality of visible polygons into a new mesh, and perform coordinate mapping on the new mesh to obtain a second set of two-dimensional coordinates corresponding to the visible region.

[0180] In some embodiments, the mapping processing apparatus 555 of the virtual scene further includes an updating module 5557 configured to count, based on the hash table, the second set of two-dimensional coordinates corresponding to the vertices of the visible polygons, and the indexes corresponding to the vertices in the index cache; add a new vertex at the position of each vertex according to the second set of two-dimensional coordinates, and update the indexes according to the addition result; add the vertices of the invisible polygons in the virtual scene to the back of the vertices of the visible polygons, and update the indexes again.

[0181] In some embodiments, the setting module 5552 is further configured to, for the invisible region of the virtual object in the virtual scene, modify the mode of the mesh corresponding to the invisible region from receiving global illumination to illumination probe, and replace the mesh corresponding to the visible region with the new mesh.

[0182] In some embodiments, the mapping processing apparatus 555 of the virtual scene further includes a determining module 5558 configured to invoke the color shader to perform the following processing: split the mesh of the virtual object into a plurality of polygons, and perform the following processing for each polygon: map the polygon to a screen space, and convert the mapped polygon into a pixel in the screen space; in response to a depth value of the pixel being less than a depth threshold, determine the polygon as a visible polygon in the virtual scene; and determine a region composed of the plurality of visible polygons as a visible region of the virtual object in the virtual scene.

[0183] In some embodiments, the determining module 5558 is further configured to invoke the color shader to perform the following processing: split the mesh of the virtual object into a plurality of polygons, and perform the following processing for each polygon: send a query request carrying an identifier of the polygon, where the query request is used to query whether the polygon is visible in the virtual scene; and determine a region composed of the plurality of polygons that are visible in the virtual scene as a visible region of the virtual object in the virtual scene.

[0184] In some embodiments, the determining module 5558 is further configured to invoke the color shader to perform the following processes: splitting the mesh of the virtual object into multiple polygons, and performing the following processes for each polygon: emitting a detection ray along the orientation of the virtual camera, starting from the location of the virtual camera included in the virtual scene; determining the polygon as a visible polygon in the virtual scene in response to the detection ray intersecting with the polygon and the intersection point being located inside the polygon; and determining the region composed of multiple visible polygons as the visible region of the virtual object in the virtual scene.

[0185] In some embodiments, the texture processing apparatus 555 for virtual scenes further includes a shading module 5559, which is used to shading the visible area based on the light map when performing global illumination rendering on the virtual scene, and to shading the invisible area of ​​the virtual object in the virtual scene based on the reflectivity multiplied by a constant.

[0186] It should be noted that the description of the apparatus in this application embodiment is similar to the description of the method embodiment above, and has similar beneficial effects as the method embodiment, therefore, it will not be repeated. For any technical details not covered in the virtual scene texture processing apparatus provided in this application embodiment, please refer to... Figure 3 , Figure 4 ,or Figure 5 The meaning is understood in accordance with the description of any of the accompanying drawings.

[0187] This application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the computer device to perform the virtual scene texture processing method described above in this application.

[0188] This application provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are executed by a processor, they cause the processor to execute the texture processing method for a virtual scene provided in this application. For example, ... Figure 3 , Figure 4 ,or Figure 5 The texturing method for the virtual scene is shown.

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

[0190] In some embodiments, executable instructions can be in the form of programs, software, software modules, scripts, or code that are written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages; and that are 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.

[0191] By way of example, the executable instructions can be deployed in instances in which the program is executed on a single electronic device, or on multiple electronic devices that are located at a single site, or on multiple electronic devices that are distributed across multiple sites and that are interconnected through a communication network.

[0192] The above description is only for the embodiments of the present application, and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement and improvement within the spirit and scope of the present application shall be included in the protection scope of the present application.

Claims

1. A method for processing textures in a virtual scene, characterized in that, The method includes: The selected virtual scene is displayed in the development tools, wherein the development tools include a lightmap generation entry point, and the virtual scene includes virtual objects; In response to a trigger operation on the configuration controls included in the lightmap generation entry, a configuration interface is displayed in the development tool; In response to the first configuration operation, a color shader configured for the virtual object is displayed in the configuration interface, wherein the color shader is included in the development tool and is used to determine the visible area of ​​the virtual object in the virtual scene; In response to a trigger operation of the start baking control included in the lightmap generation entry, the baked lightmap of the virtual scene is displayed, wherein the lightmap stores the lighting information of the visible area.

2. The method according to claim 1, characterized in that, The virtual scene also includes virtual light sources and virtual cameras; Prior to the triggering operation in response to the configuration control included in the lightmap generation entry, the method further includes: Perform at least one of the following processes: In response to a position setting operation for the virtual scene, the virtual object is moved to the set position in the virtual scene; In response to the light source parameter setting operation for the virtual scene, the light source parameters of the virtual light source are adjusted to the set light source parameters, wherein the set light source parameters are used to determine the illumination information of the visible area; In response to a camera parameter setting operation for the virtual scene, the camera parameters of the virtual camera are adjusted to the set camera parameters, wherein the set camera parameters are used to determine the visible area.

3. The method according to claim 1, characterized in that, The development tool also includes a toolbar entry, and the first configuration operation includes a first trigger operation and a first move operation; The step of displaying a color shader configured for the virtual object in the configuration interface in response to a first configuration operation includes: In response to the first trigger operation for the toolbar entry, a toolbar list is displayed, wherein the toolbar list includes various shaders in the development tool, including a color shader; In response to the first move operation on the color shader, and the release point of the first move operation is located in the first preset area of ​​the configuration interface, the color shader is moved from the toolbar list to the first preset area of ​​the configuration interface.

4. The method according to claim 1, characterized in that, The virtual scene also includes a virtual light source, and prior to the triggering operation of the start baking control included in the lightmap generation entry, the method further includes: In response to the second configuration operation, a material shader configured for the virtual object is displayed in the configuration interface, wherein the material shader includes a meta channel for determining the reflection effect of the visible area on the light when the light from the virtual light source shines on the visible area.

5. The method according to claim 4, characterized in that, The development tool also includes a toolbar entry, and the second configuration operation includes a second trigger operation and a second move operation; The step of displaying the material shader configured for the virtual object in the configuration interface in response to the second configuration operation includes: In response to the second trigger operation for the toolbar entry, a toolbar list is displayed, wherein the toolbar list includes various shaders in the development tool, including material shaders; In response to the second move operation on the material shader, and the release point of the second move operation is located in the second preset area of ​​the configuration interface, the material shader is moved from the toolbar list to the second preset area of ​​the configuration interface.

6. The method according to claim 1, characterized in that, The step of displaying the baked lightmap of the virtual scene in response to a trigger operation of the start baking control included in the lightmap generation entry includes: In response to a trigger operation of the start baking control included in the lightmap generation entry, the lighting information of the visible area is obtained; The lighting information of the visible area is stored in a light map corresponding to the virtual scene, and the light map is displayed in the development tool.

7. The method according to claim 6, characterized in that, Before displaying the lightmap in the development tool, the method further includes: In response to the viewing trigger operation, a second set of two-dimensional coordinates corresponding to the visible area is displayed in the development tool, wherein the second set of two-dimensional coordinates is used to store the coordinate information of the light map.

8. The method according to claim 7, characterized in that, Before displaying the second set of two-dimensional coordinates corresponding to the visible area in the development tool, the method further includes: The mesh of the virtual object is split into multiple polygons, and the visible polygons in the virtual scene are selected from the multiple polygons. Multiple visible polygons are combined into a new grid, and the new grid is mapped to obtain a second set of two-dimensional coordinates corresponding to the visible area.

9. The method according to claim 8, characterized in that, The method further includes: The second set of two-dimensional coordinates corresponding to the vertices of the visible polygon and the index of the vertex in the index cache are statistically analyzed based on the hash table. Add a new vertex at the position of each vertex according to the second set of two-dimensional coordinates, and update the index according to the addition result; The vertices of the invisible polygons in the virtual scene are added after the vertices of the visible polygons, and the index is updated again.

10. The method according to claim 8, characterized in that, The method further includes: For the invisible areas of the virtual object in the virtual scene, the mode of the mesh corresponding to the invisible area is changed from receiving global illumination to a light probe, and... Replace the grid corresponding to the visible area with the new grid.

11. The method according to any one of claims 1 to 10, characterized in that, Prior to the triggering operation of the start baking control included in the lightmap generation entry, the method further includes: The color shader is invoked to perform the following processing: The mesh of the virtual object is split into multiple polygons, and the following processing is performed on each polygon: The polygon is mapped to screen space, and the mapped polygon is converted into pixels in the screen space; In response to the pixel's depth value being less than a depth threshold, the polygon is determined to be a visible polygon in the virtual scene; The region composed of multiple visible polygons is defined as the visible region of the virtual object in the virtual scene.

12. The method according to any one of claims 1 to 10, characterized in that, Prior to the triggering operation of the start baking control included in the lightmap generation entry, the method further includes: The color shader is invoked to perform the following processing: The mesh of the virtual object is split into multiple polygons, and the following processing is performed on each polygon: Send a query request carrying the identifier of the polygon, wherein the query request is used to query whether the polygon is visible in the virtual scene; The region consisting of a plurality of polygons visible in the virtual scene is defined as the visible region of the virtual object in the virtual scene.

13. The method according to any one of claims 1 to 10, characterized in that, Prior to the triggering operation of the start baking control included in the lightmap generation entry, the method further includes: The color shader is invoked to perform the following processing: The mesh of the virtual object is split into multiple polygons, and the following processing is performed on each polygon: Starting from the location of the virtual camera included in the virtual scene, a detection ray is emitted along the orientation of the virtual camera; In response to the detection ray intersecting the polygon and the intersection point being located inside the polygon, the polygon is determined to be a visible polygon in the virtual scene; The region composed of multiple visible polygons is defined as the visible region of the virtual object in the virtual scene.

14. The method according to any one of claims 1 to 10, characterized in that, After displaying the lightmap of the virtual scene obtained through baking, the method further includes: When performing global illumination rendering on the virtual scene, the visible area is tinted based on the lightmap, and The invisible areas of the virtual object in the virtual scene are colored based on the reflectance multiplied by a constant.

15. A texture processing device for a virtual scene, characterized in that, The device includes: The display module is used to display the selected virtual scene in the development tool, wherein the development tool includes a lightmap generation entry point, and the virtual scene includes virtual objects; The display module is also configured to display a configuration interface in the development tool in response to a trigger operation of the configuration control included in the lightmap generation entry. The display module is further configured to, in response to the first configuration operation, display a color shader configured for the virtual object in the configuration interface, wherein the color shader is included in the development tool and is configured to determine the visible area of ​​the virtual object in the virtual scene; The display module is further configured to respond to a trigger operation of the start baking control included in the lightmap generation entry, and display the baked lightmap of the virtual scene, wherein the lightmap stores the lighting information of the visible area.

16. An electronic device, characterized in that, include: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the texture processing method for a virtual scene as described in any one of claims 1 to 14.

17. A computer-readable storage medium storing computer-executable instructions, characterized in that, When the computer-executable instructions are executed by the processor, they implement the texture processing method for the virtual scene as described in any one of claims 1 to 14.

18. 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 the processor, the texture processing method for the virtual scene as described in any one of claims 1 to 14 is implemented.