A display control method and device in a game

By combining the lighting baking technology of inherent color and self-luminous maps in game rendering, the shortcomings of lighting probes and lighting maps are solved, and efficient lighting effects and low performance consumption are achieved.

CN114191815BActive Publication Date: 2025-07-25NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111322318.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-09
Publication Date
2025-07-25
Estimated Expiration
2041-11-09

AI Technical Summary

Technical Problem

In the prior art In game rendering, lighting probe technology cannot take into account both good lighting effects and performance consumption, while lighting map technology has the problem of performance consumption and inability to show rich artistic effects.

Method used

By obtaining the inherent color map and self-luminous map, lighting bake, combining the self-luminous information into the light map, replacing the self-luminous information in the inherent color map, obtaining the target map, and rendering it according to the target map, achieving indirect lighting effects.

Benefits of technology

Enhances the artistic expression of self-luminous effects, reduces map storage, and allows dynamic modification of lighting effects at extremely low performance costs when the game is running, such as making lighter, darker effects and modifying the colors of light.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114191815B_ABST
    Figure CN114191815B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention provides a display control method and device in a game. The method includes: obtaining a base color map, where the base color map contains the base color information of the game scene and the self-illumination information in the self-illumination map; performing light baking according to the self-illumination information and the base color information to obtain a light map; storing the self-illumination information in the self-illumination map into the light map; replacing the self-illumination information in the base color map with the light information in the light map to obtain a target map; rendering the game scene according to the target map to display a game scene with an indirect lighting effect on the graphical user interface. By means of Emission, the effect of baking the map can be achieved, and it is possible to conveniently modify the artistic expression of lighting at a very low performance cost during the game operation, such as creating a gradually brightening or dimming effect, modifying the color of the light, and so on.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer graphics processing, and in particular to a display control method in a game and a display control device in a game. Background Art

[0002] In the rendering calculation of a game, the lighting calculation is a part with relatively large performance overhead. Due to the strong interactivity of the game, in order to ensure that the player experience during the game is as smooth as possible, high performance requirements are put forward for the rendering calculation of the game.

[0003] Currently, in the process of rendering lighting calculation, the global illumination algorithm, because it contains a large amount of lighting information related to the environment, that is, when calculating the brightness information of a local point, it is necessary to additionally consider the complex situation of the part of the environment where the point is located, which belongs to the part with relatively large performance overhead. In the game resource production stage, it is often inclined to pre-calculate and store this part of the lighting information as much as possible. By pre-calculation to improve the real-time rendering lighting calculation speed, the common solutions include: the light probe technology and the light map technology.

[0004] Among them, the light probe technology collects the lighting information in the game scene by setting some fixed light probes in the game scene. During the game operation, the object only needs to read the lighting information stored in the light probes near its current position for rendering. The light map technology creates a separate UV space and an additional light map for each static object. During the pre-calculation process, the corresponding lighting information for each object is calculated and stored as the illumination map. During the game operation, the object only needs to read the information stored in the light map as the ambient lighting information and directly use it as the parameter for the subsequent rendering lighting calculation.

[0005] However, the light probe technology abstracts the lighting information in a continuous three-dimensional space into the lighting information at a limited number of discrete sampling point positions. The resulting information loss will inevitably cause a loss in the lighting effect. Moreover, when using the light probe technology, the quality of the pre-calculated lighting effect has a very strong correlation with the number of light probes used. In order to achieve better artistic performance, it is often necessary to distribute and use more light probes in the scene. And when the object dynamically collects the information of multiple nearby light probes and performs interpolation during the game operation, it will also cause a loss in performance.

[0006] For the light map technology, it is necessary to use an additional light map to record the lighting information in the scene. This increases the number of textures to be sampled during the game operation and also increases the amount of data transmitted to the GPU during rendering. These will all cause performance losses. And the light map statically stores the lighting information of the scene and cannot be combined with the dynamic state of the object during the game operation to obtain a more rich artistic performance effect. Summary of the Invention

[0007] In view of the problems in the above-mentioned pre-computation solution for the lighting information of static objects, where the lighting probe technology cannot balance good lighting effects and performance consumption, and the light mapping technology has performance consumption when reading light maps and cannot represent richer art effects, embodiments of the present invention are proposed to provide a display control method in a game and a corresponding display control device in a game that overcome the above problems or at least partially solve the above problems.

[0008] Embodiments of the present invention disclose a display control method in a game, including:

[0009] Obtain a base color map; wherein, the base color map contains the base color information of the game scene and the self-illumination information in the self-illumination map;

[0010] Perform light baking based on the self-illumination information and the base color information to obtain a light map;

[0011] Store the self-illumination information in the self-illumination map into the light map;

[0012] Use the lighting information in the light map to replace the self-illumination information in the base color map to obtain a target map;

[0013] Render the game scene according to the target map to display a game scene with indirect lighting effects on the graphical user interface.

[0014] Optionally, before the step of obtaining the base color map, it includes:

[0015] Store the self-illumination information in the self-illumination map into the Alpha channel of the base color map.

[0016] Optionally, the step of using the lighting information in the light map to replace the self-illumination information in the base color map to obtain a target map includes:

[0017] Use the lighting information in the light map to replace the self-illumination information in the Alpha channel of the base color map to obtain a target map.

[0018] Optionally, the self-illumination map is stored according to a first texture space, and there is overlapping content in the maps in the first texture space; the light map is stored according to a second texture space, and there is no overlapping content in the maps in the second texture space.

[0019] Optionally, after the step of performing light baking based on the self-illumination information and the base color information to obtain a light map, it further includes:

[0020] Convert the light map into a grayscale map.

[0021] Optionally, storing the self-illumination information in the self-illumination map into the light map includes:

[0022] Convert the self-illumination map stored according to the first texture space into the second texture space;

[0023] Merge the converted self-illumination map into the light map in the second texture space.

[0024] Optionally, rendering the game scene according to the target map includes:

[0025] Sample self-illumination information from the target map, and calculate target color information according to preset color information and the self-illumination information;

[0026] Render the game scene according to the target color.

[0027] An embodiment of the present invention also discloses a display control device in a game, including:

[0028] A map acquisition module, configured to acquire a base color map; wherein, the base color map contains the base color information of the game scene and the self-illumination information in the self-illumination map;

[0029] A light baking module, configured to perform light baking according to the self-illumination information and the base color information to obtain a light map;

[0030] A map merging module, configured to store the self-illumination information in the self-illumination map into the light map;

[0031] A map information replacement module, configured to replace the self-illumination information in the base color map with the light information in the light map to obtain a target map;

[0032] A rendering module, configured to render the game scene according to the target map to display a game scene with an indirect lighting effect on a graphical user interface.

[0033] An embodiment of the present invention also discloses an electronic device, including:

[0034] A processor and a storage medium, the storage medium stores machine-readable instructions executable by the processor, and when the electronic device runs, the processor executes the machine-readable instructions to perform the method according to any one of the embodiments of the present invention.

[0035] An embodiment of the present invention also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the method according to any one of the embodiments of the present invention.

[0036] The embodiments of the present invention include the following advantages:

[0037] In an embodiment of the present invention, a base color map is obtained; wherein, the base color map contains the base color information of the game scene and the self-illumination information in the self-illumination map; lighting baking is performed according to the self-illumination information and the base color information to obtain a lighting map; the self-illumination information in the self-illumination map is stored in the lighting map; the self-illumination information in the base color map is replaced with the lighting information in the lighting map to obtain a target map; the game scene is rendered according to the target map to display a game scene with an indirect lighting effect on the graphical user interface. Among them, the self-illumination information is used to describe the source of the ambient light information and record the intensity of the light emission. By storing the self-illumination information for rendering, the dynamic influence effect of the light-emitting object on the surrounding environment can be presented during the game, enhancing the artistic expression of the self-illumination effect. And, since both the lighting information and the self-illumination information are stored in the base color map, the storage amount of the map can be reduced, so as to achieve the effect of the light gradually brightening and dimming with lower performance. By implementing the baking map effect through the Emission method, it is possible to conveniently modify the artistic expression of the lighting with extremely low performance cost during the game operation, such as making the gradually brightening and dimming effects, modifying the color of the light, and so on. Description of the Drawings

[0038] In order to more clearly illustrate the technical solutions of the present invention, the drawings required for the description of the present invention will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0039] Figure 1 is a flowchart of the steps of a display control method in a game provided by an embodiment of the present invention;

[0040] Figure 2 is a schematic diagram of a self-illumination map provided by an embodiment of the present invention;

[0041] Figure 3 is a schematic diagram of the display effect after coloring an object provided by an embodiment of the present invention;

[0042] Figure 4A is a schematic diagram of a map stored according to the first texture space provided by an embodiment of the present invention;

[0043] Figure 4B It is a schematic diagram of a texture map stored according to the second texture space provided by an embodiment of the present invention;

[0044] Figure 5 It is a schematic diagram of a lighting map provided by an embodiment of the present invention;

[0045] Figure 6 It is a schematic diagram of a combined lighting map provided by an embodiment of the present invention;

[0046] Figure 7A It is a schematic diagram of a lighting effect provided by an embodiment of the present invention;

[0047] Figure 7B It is a schematic diagram of another lighting effect provided by an embodiment of the present invention;

[0048] Figure 8 It is a structural block diagram of a display control device in a game provided by an embodiment of the present invention;

[0049] Figure 9 It is a structural block diagram of an electronic device of the present invention;

[0050] Figure 10 It is a structural block diagram of a computer-readable storage medium of the present invention. Detailed implementation manners

[0051] To make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific implementation manners. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0052] FPS: First Person Shooter, a first-person shooting game. It refers to a game in which the player takes the view of the character he operates as the main view and uses shooting weapons to fight against opponents in the game.

[0053] Rendering: The process of calculating visible image content by calculating through a defined calculation formula based on certain descriptive content, including information such as recorded models, lighting, animations, cameras, etc.

[0054] Real-time Rendering: Since the rendering process is a huge set of computing tasks, and games, which are highly interactive with players, require quick and immediate responses to player operations, if a picture (i.e., a frame) is not drawn within a certain required time (e.g., 30ms), the content will no longer be valuable due to the loss of timeliness, and the system must immediately turn to the drawing task of the next picture, and the content that has been drawn last time will also be discarded. This type of rendering method that has strict requirements on rendering speed is called real-time rendering.

[0055] Offline Rendering: Offline Rendering, in contrast to real-time rendering, is used if there is no strict mandatory requirement for the drawing time of a picture. For example, in movie production, since the audience does not interact with the movie content, it can take a long time to draw each frame in detail (maybe several hours), and finally all the pictures can be played continuously.

[0056] Lighting baking technology: For objects that will not change due to the interaction between the player and the system (called static objects), the lighting calculation content related to them will basically not change in the game, so many parts can be transferred to before the game is run (usually when the game is made), that is, the calculation is completed in advance and the results are stored in the file. When the relevant part of the calculation needs to be performed during the game, it is only necessary to load the file and read the data in it to participate in the subsequent calculation, which reduces the calculation complexity of the real-time calculation link. This pre-calculation process is also called light baking technology.

[0057] Shader: Mainly refers to the shader program running on the GPU (Graphics Processing Unit), which is used to perform calculations related to object drawing in real-time rendering, including lighting, deformation, drawing position, drawing method, etc. In order to achieve precise control of rendering results, it is necessary to write relevant Shader codes in a targeted manner in game development to complete relevant calculations.

[0058] In the rendering calculation of the game, the lighting calculation is the link with the highest performance cost. Since the game has strong interactivity, in order to ensure that the player's gaming experience is as smooth as possible, higher performance requirements are placed on the game's rendering calculation. Usually, a game needs to reach a drawing speed of at least 30 frames per second so that the player can experience the game without noticing obvious delays. In some games with strong interactive performance requirements, such as FPS games, due to the fast game rhythm, the rendering calculation is often required to reach a drawing speed of 60 or even 90 frames per second.

[0059] Therefore, when planning a technical solution for a game, adopting an appropriate lighting strategy is the key to whether a game can meet the expected real-time lighting calculation performance requirements.

[0060] To improve the speed of lighting calculation in rendering, common approaches include:

[0061] 1. Reduce the amount of calculation during rendering. The essence of rendering is a calculation process, and there is room for simplification in many of these steps. For example, in the Shader, operations that need to be calculated per fragment can be modified to per-vertex operations, the sampling density of the used textures can be reduced, the amount of models can be decreased, and so on.

[0062] 2. Increase the requirements for hardware performance. The size of the GPU video memory, memory bandwidth, etc. will all have a significant impact on the rendering speed. Using hardware with better performance can also improve the rendering speed.

[0063] 3. Move more calculations to the offline process. Although there are a large number of user-system interaction behaviors in the game, which cause many rendering contents to change according to the player's actions and thus must be calculated in real time when the player is playing the game. However, upon careful distinction, there are still many contents that do not interact with the player. For example, relatively fixed scene contents such as distant mountains and buildings (of course, this is also related to the specific game play design).

[0064] During the rendering lighting calculation process, the global illumination algorithm, due to containing a large amount of environment-related lighting information, that is, when calculating the brightness information of a local point, it is necessary to additionally consider the complex situation of the environment part where the point is located, which belongs to the part with relatively large performance overhead. During the game resource production stage, there is often a tendency to pre-calculate and store this part of the lighting information as much as possible. To improve the real-time rendering lighting calculation speed through pre-calculation, common solutions in the existing technology include:

[0065] Light Probe Technology: This technology collects the light information in the game scene by setting some fixed light probes (a specific type of virtual object) in the game scene. Each light probe stores the ambient light information received at its own center position during the pre-computation process. During the game runtime, an object only needs to read the light information stored in the light probes near its current position (it can read multiple and perform weighted interpolation calculations based on the distance), and directly use this pre-stored ambient light information in the rendering calculation. In this way, a large amount of rendering performance overhead can be saved, thus improving the rendering speed per frame during real-time rendering. However, the light probe technology abstracts the light information in a continuous three-dimensional space into the light information at a finite number of discrete sampling points. The resulting information loss will inevitably cause a loss in the lighting effect. In addition, when using the light probe technology, the quality of the pre-computed lighting effect is highly correlated with the number of light probes used. To achieve better artistic performance, it is often necessary to distribute and use more light probes in the scene. And when the object dynamically collects the information of multiple nearby light probes and performs interpolation during the game runtime, it will also cause performance loss.

[0066] Light Map Technology: Adopting this technical solution, it is necessary to create a separate uv space and an additional light map for each static object. During the pre-computation process, the ambient light information in the three-dimensional space calculated for each object will be stored at the corresponding position in the new uv space (two-dimensional space) corresponding to the points in this space with pixels as the carrier. During the game runtime, the object only needs to read the information stored in the light map as the ambient light information according to its second set of uv space coordinate systems, and directly use it as a parameter for the subsequent rendering light calculation. In this way, the calculation of the ambient light can be saved during the game runtime, thus reducing the rendering calculation overhead and improving the real-time rendering speed. However, the light map technology needs to use additional light maps to record the light information in the scene. This increases the number of textures to be sampled during the game runtime and also increases the amount of data transferred to the GPU during rendering, which will all cause performance losses. And the light map stores the light information of the static scene statically and cannot be combined with the dynamic state of the object during the game runtime to obtain a more rich artistic performance effect.

[0067] To solve the texture problems existing in the above-mentioned existing rendering solutions, in the embodiments of the present invention, by using the self-illumination information Emission in the drawn self-illumination map for light baking, and then integrating the baking result with the original drawing into a new Emission information, a more realistic ambient light effect can be provided, reducing the storage capacity of the traditional light map method, and being able to implement the function of dynamically adjusting the light intensity and color during the game runtime with a relatively low system overhead.

[0068] Specifically, by obtaining an intrinsic color map; wherein the intrinsic color map contains the intrinsic color information of the game scene and the self-luminous information in the self-luminous map; performing lighting baking according to the self-luminous information and the intrinsic color information to obtain a lighting map; storing the self-luminous information in the self-luminous map in the lighting map; using the lighting information in the lighting map to replace the self-luminous information in the intrinsic color map to obtain a target map; rendering the game scene according to the target map to display the game scene with indirect lighting effects on a graphical user interface. Among them, the self-luminous information is used to describe the source of the ambient lighting information and record the intensity of the light. By storing the self-luminous information for rendering, the dynamic effect of the luminous object on the surrounding environment can be presented during the game, thereby enhancing the artistic expression of the self-luminous effect. In addition, since both the lighting information and the self-luminous information are stored in the intrinsic color map, the storage amount of the map can be reduced, thereby achieving the effect of gradually brightening and dimming the light with lower performance. By using Emission to achieve the effect of baked maps, you can easily and dynamically modify the artistic performance of lighting at a very low performance cost while the game is running, such as creating gradual brightening and darkening effects, changing the color of light, etc.

[0069] Reference Figure 1 , shows a flowchart of a display control method in a game provided by an embodiment of the present invention, which may specifically include the following steps:

[0070] Step 101, obtaining an intrinsic color map; wherein the intrinsic color map contains intrinsic color information of the game scene and self-luminous information in the self-luminous map;

[0071] Among them, the intrinsic color map is used to store the intrinsic color of the game scene, and the intrinsic color refers to the color presented by the inherent attributes of the object under normal light source.

[0072] In the embodiment of the present invention, the game designer can draw the intrinsic color map in advance according to the effect required by the game screen. At the same time, for the objects that emit light in the game scene, the self-luminous maps corresponding to these objects are drawn, and the self-luminous information Emission is stored in the self-luminous map. The Emission information is used to describe the source of the ambient light information and record the intensity of the light.

[0073] A texture usually contains color information in four channels: RGBA. Among them, R represents Red, G represents Green, B represents Blue, and A represents Alpha (opacity). In specific implementation, the solid color information of the game scene is usually stored in the RGB three channels of the solid color texture, that is, no information is stored in the Alpha channel. Therefore, the self-illumination texture can be drawn as a single-channel texture after removing the hue information, and then the self-illumination information in this single-channel texture can be directly stored in the solid color texture to reduce the amount of textures to be stored.

[0074] Step 102: Perform light baking based on the self-illumination information and the solid color information to obtain a light map.

[0075] In specific implementation, some 3D modeling software usually provides the function of light baking. The light baking can be performed according to the self-illumination information and the solid color information through the light baking function. Thus, a light map storing the pre-computed result can be obtained. By baking the light map, the light calculation related to the environment can be pre-positioned in the offline process, saving the light calculation in real-time rendering, and thus improving the rendering efficiency during game operation.

[0076] As an example, in Unity, the baking system Light Mapper provides the function of light baking. The self-illumination information and the solid color information in the solid color texture can be provided to the Light Mapper of Unity's baking system for light baking to obtain a light map. Light Mapper uses the solid color information Albedo and the self-illumination information Emission provided by the Shader for the calculation of the light map. Therefore, in the object Shader, a new Meta channel can be created, and the Pass rendering pass can be set through Meta to specify a program participating in the light baking calculation in Unity. By outputting the interpolated texture coordinates as the position information Position in the clip space Clip Space in the vertex Shader, and outputting the Albedo and Emission information in the fragment Shader for light baking calculation.

[0077] Step 103: Store the self-illumination information in the self-illumination texture into the light map.

[0078] Specifically, the self-illumination texture and the light map can be merged into one texture. By merging the textures, the number of textures that need to be sampled by the Shader during rendering is reduced, and there is no need to use an additional light map, improving the calculation efficiency of real-time rendering.

[0079] Step 104, replace the self - illumination information in the base color map with the illumination information in the light map to obtain a target map;

[0080] Specifically, since the illumination information stored in the light map includes the self - illumination information in the self - illumination map, it is possible to replace the self - illumination information in the base color map with the illumination information in the light map to obtain a target map, thereby further reducing the number of maps that need to be stored.

[0081] Step 105, render the game scene according to the target map to display a game scene with indirect illumination effects on the graphical user interface.

[0082] In the embodiment of the present invention, the game scene can be rendered according to the target map to display a game scene with indirect illumination effects on the graphical user interface. Since the effect of baking the map is achieved through the Emission method, it is possible to conveniently modify the artistic expression of illumination at a very low performance cost during the running of the game, such as creating fade - in and fade - out effects, modifying the color of the light, etc.

[0083] In a preferred embodiment of the present invention, before the step of obtaining the base color map, it includes:

[0084] Store the self - illumination information in the self - illumination map into the Alpha channel of the base color map.

[0085] Specifically, the self - illumination map is usually stored as a single - channel map. By storing the self - illumination information (Emission) in the single - channel self - illumination map into the base color map, the amount of maps that need to be stored can be reduced. As an example, as Figure 2 shown, it is a self - illumination map corresponding to a glowing window, and this self - illumination map is drawn as a single - channel grayscale map.

[0086] In specific implementation, since the self - illumination map is a single - channel map, it can only represent the intensity of the glowing object and cannot represent the color of the glowing object. Therefore, during rendering, in the Shader of this object, a new self - illumination color attribute of Emission Color needs to be created to specify the color of the glowing object. Then, in the Shader, the texture coordinate information in the first texture space is used to extract the information of the Alpha channel of the base color map, multiply it by the color value corresponding to the Emission Color attribute, and use the result as the shading result of the object. Since this step only performs pre - calculation for the self - illumination effect, in order to avoid interference from other illumination information on the calculation result, it is necessary to turn off all other lights in the scene in advance: turn off the directional light in the scene and set the ambient color to black (i.e., no energy contribution). As Figure 3As shown, it is a schematic diagram of the display effect after coloring an object. The color presented by the object can be set by the user according to the requirements of the picture effect, and the adjustment can be completed through the color value passed in by the Emission Color attribute.

[0087] In a preferred embodiment of the present invention, the step 104 includes:

[0088] Replace the self-illumination information in the Alpha channel of the solid color map with the illumination information in the light map to obtain a target map.

[0089] In the embodiment of the present invention, the illumination information in the light map can be replaced with the self-illumination information in the Alpha channel of the solid color map to obtain a target map, so as to store the illumination information and the solid color map in one map, reducing the number of maps to be read in the subsequent rendering process.

[0090] In a preferred embodiment of the present invention, the self-illumination map is stored according to the first texture space, and there is overlapping content in the maps in the first texture space; the light map is stored according to the second texture space, and there is no overlapping content in the maps in the second texture space.

[0091] In the embodiment of the present invention, the self-illumination map can be stored according to the first texture space, and the light map is stored according to the second texture space. Among them, there is overlapping content in the maps in the first texture space. For example, in a game scene, there are 10 identical windows, then only one self-illumination map corresponding to one window needs to be stored, that is, these 10 windows sample the map content according to the same texture coordinates. There is no overlapping content in the maps in the second texture space. In a game scene, there are 10 identical windows, then 10 self-illumination maps corresponding to 10 windows need to be stored, that is, these 10 windows sample the map content according to different texture coordinates.

[0092] As an example, Figure 4A is a schematic diagram of a map stored according to the first texture space, Figure 4B is a schematic diagram of a map stored according to the second texture space, where Figure 4B the content of the same part is stored repeatedly, and there is no overlapping content.

[0093] In a preferred embodiment of the present invention, after the step 102, it further includes:

[0094] Convert the light map into a grayscale map.

[0095] Since the light map only needs to represent the intensity change information of the light and does not need the color change information, the three-channel light map is converted into a single-channel (black and white) grayscale image, thereby saving the data storage capacity occupied by the map.

[0096] In a preferred embodiment of the present invention, step 103 includes:

[0097] The self-illumination map stored in the first texture space is converted into the second texture space; and the converted self-illumination map is merged into the light map in the second texture space.

[0098] Specifically, since the lighting information in the light map is stored according to the second texture space, in order to obtain accurate baking effects, it is necessary to ensure that the model has the correct UV settings. When merging maps, the self-illumination map stored in the first texture space can be converted to the second texture space; the converted self-illumination map can be merged into the light map in the second texture space.

[0099] As an example, use Unity's Light Mapper to bake and get the effect of the self-luminous window illuminating the building. Although the effect here has achieved the expected final picture effect visually, there is a lot of performance loss in the lighting effect at this time: the lighting color of the window part is provided by the Emission map sampled in the UV1 space (first texture space), and the lighting color of the building outside the window is provided by the Light Mapper map sampled in the UV2 space (second texture space). These two parts need to be integrated and optimized. Figure 5 As shown, the above Figure 2 The Emission map sampled in UV1 space is converted to UV2 space, and you can see Figure 2 In comparison, although the glowing art effect of the window has not changed, since the UV2 space does not allow UV overlap, and there are 10 identical windows on the model, the same image content is copied 10 times, but the visual effect will not change when pasted back to the model compared to using UV1.

[0100] As another example, Figure 6 As shown, the light map baked in UV2 space is combined with the self-illumination map converted to UV2 space according to the spatial coordinate system of UV2, and it can be observed that Figure 6 The content in the upper right corner is Figure 5 The conversion result in .

[0101] In a preferred embodiment of the present invention, rendering according to the target map includes:

[0102] Sample the self - illumination information from the target texture map, and calculate the target color information based on the preset color information and the self - illumination information; render the game scene according to the target color.

[0103] During game rendering, the self - illumination information can be sampled from the target texture map, and the target color information can be calculated based on the preset color information and the self - illumination information, and the game scene is rendered according to the target color. Among them, the preset color information is used to describe the color of the pre - set light - emitting object, and in the Shader, the preset color information can be set through the self - illumination color attribute of Emission Color.

[0104] In the specific implementation, since the self - illumination information of the Alpha channel in the target texture map is stored according to the second texture space, the Shader can be modified to use the texture coordinate information in the second texture space to sample the Alpha channel of the base color texture map and use it as the intensity of Emission, multiply it with the preset color information corresponding to the object as the Emission color in the Shader calculation result. Finally, rendering according to the Emission color can obtain the final effect. As Figure 7A - 7B shown, it is the effect diagram of rendering the Figure 3 window shown according to the self - illumination information. Comparing Figure 3 (before self - illumination effect baking) with Figure 7A - 7B (after baking), it can be clearly seen that the result after baking enhances the artistic expressiveness of the self - illumination effect. The effect of the light gradually getting brighter and darker can be achieved with lower performance, and the overall color effect can also be modified by modifying the preset color information in the material. These are all impossible to achieve by storing baking data in the form of light maps in the prior art.

[0105] In the embodiment of the present invention, by first using the drawn self - illumination texture map (drawn in UV1 space) as the source of ambient light information, the self - illumination information is drawn as a single color and stored as the Alpha channel of the base color texture map, thus saving the data storage capacity occupied by the texture map.

[0106] Write a Shader to pass the base color (Albedo) and self - illumination (Emission) information to the light baking system for a light baking calculation (calculated in UV2 space), and thus a light map storing the pre - calculation result can be obtained. This step pre - positions the light calculation related to the environment in the offline process, saving the light calculation in real - time rendering, thereby improving the rendering efficiency during game operation.

[0107] Since only the intensity change information of light is required here and not the color change information, the three-channel light map (color) is converted into a single-channel (black and white) map, and this step saves the data storage capacity occupied by the map again.

[0108] The self-illumination map originally drawn in UV1 space is converted to UV2 space and integrated with the newly calculated baked light map into one map. This step reduces the number of maps that need to be sampled during map sampling in the Shader by merging the maps, and no additional light map is required, improving the computational efficiency of real-time rendering.

[0109] The merged single-channel map (UV2) is placed at the position where the original self-illumination map was drawn, that is, stored in the Alpha channel of the base color map. Since the UV space used has changed from UV1 to UV2, the Shader needs to be modified here to change the sampling method originally using the UV1 coordinate system to using the UV2 coordinate system and participate in the subsequent real-time lighting calculation in the form of Emission. This step realizes the effect of the baked map through the emission method, and can conveniently modify the artistic expression of lighting at a very low performance cost during the game operation, such as making fading-in and fading-out effects, modifying the color of light, etc.

[0110] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present invention.

[0111] Refer to Figure 8 , which shows the structural block diagram of a display control device in a game provided by an embodiment of the present invention, and specifically may include the following modules:

[0112] The map acquisition module 801 is used to acquire the base color map; wherein, the base color map contains the base color information of the game scene and the self-illumination information in the self-illumination map;

[0113] The light baking module 802 is used to perform light baking according to the self-illumination information and the base color information to obtain a light map;

[0114] The map merging module 803 is used to store the self-illumination information in the self-illumination map into the light map;

[0115] The texture information replacement module 804 is configured to replace the self - emission information in the base color texture with the illumination information in the light map to obtain a target texture;

[0116] The rendering module 805 is configured to render the game scene according to the target texture, so as to display a game scene with an indirect illumination effect on the graphical user interface.

[0117] In a preferred embodiment of the present invention, it includes:

[0118] The self - emission information storage module is configured to store the self - emission information in the self - emission texture into the Alpha channel of the base color texture.

[0119] In a preferred embodiment of the present invention, the texture information replacement module 804 includes:

[0120] The texture information replacement sub - module is configured to replace the self - emission information in the Alpha channel of the base color texture with the illumination information in the light map to obtain a target texture.

[0121] In a preferred embodiment of the present invention, the self - emission texture is stored according to a first texture space, and there is overlapping content in the textures in the first texture space; the light map is stored according to a second texture space, and there is no overlapping content in the textures in the second texture space.

[0122] In a preferred embodiment of the present invention, it further includes:

[0123] The texture conversion module is configured to convert the light map into a grayscale map.

[0124] In a preferred embodiment of the present invention, the texture merging module 803 includes:

[0125] The texture space conversion sub - module of the texture is configured to convert the self - emission texture stored according to the first texture space into the second texture space;

[0126] The texture merging sub - module is configured to merge the converted self - emission texture into the light map in the second texture space.

[0127] In a preferred embodiment of the present invention, the rendering module 805 includes:

[0128] The target color information calculation sub - module is configured to sample the self - emission information from the target texture and calculate the target color information according to the preset color information and the self - emission information;

[0129] The rendering sub - module is configured to render the game scene according to the target color.

[0130] For the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For related parts, please refer to the corresponding descriptions in the method embodiments.

[0131] The embodiments of the present invention also provide an electronic device, as Figure 9 shown, including:

[0132] A processor 901 and a storage medium 902, where the storage medium 902 stores machine-readable instructions executable by the processor 901. When the electronic device runs, the processor 901 executes the machine-readable instructions to perform the method according to any one of the embodiments of the present invention. The specific implementation manners and technical effects are similar and will not be elaborated here.

[0133] The embodiments of the present invention also provide a computer-readable storage medium, as Figure 10 shown, on which a computer program 1001 is stored. When the computer program 1001 is run by a processor, it executes the method according to any one of the embodiments of the present invention. The specific implementation manners and technical effects are similar and will not be elaborated here.

[0134] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other.

[0135] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a device, or a computer program product. Therefore, the embodiments of the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.

[0136] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the processes and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing terminal devices to generate a machine, so that the instructions executed by the processors of the computer or other programmable data processing terminal devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0137] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction means which implements the functions specified in one or more of the processes and / or blocks Figure 1 one or more of the processes and / or blocks Figure 1 specified in the block or blocks.

[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one or more of the processes and / or blocks Figure 1 one or more of the processes and / or blocks Figure 1 specified in the block or blocks.

[0139] Although the preferred embodiments of the embodiments of the present invention have been described, additional changes and modifications can be made by those skilled in the art once they learn the basic creative concept. Therefore, the appended claims are intended to be construed to cover the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0140] Finally, it should also be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or apparatus. Without further limitation, an element defined by the phrase "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or apparatus including the element.

[0141] The above has introduced in detail a display control method and a display control device in a game provided by the present invention. Specific examples are used in this article to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims

1. A display control method in a game, characterized in that, including: Obtain a base color map; wherein, the base color map contains the base color information of the game scene and the self - illumination information in the self - illumination map; Perform light baking based on the self - illumination information and the base color information to obtain a light map; Store the self - illumination information in the self - illumination map into the light map; Replace the self - illumination information in the base color map with the light information in the light map to obtain a target map; Render the game scene according to the target map to display a game scene with an indirect lighting effect on the graphical user interface; Wherein, the self - illumination map is stored according to a first texture space, and there is overlapping content in the maps in the first texture space; the light map is stored according to a second texture space, and there is no overlapping content in the maps in the second texture space.

2. The method according to claim 1, characterized in that, Before the step of obtaining the base color map, it includes: Store the self - illumination information in the self - illumination map into the Alpha channel of the base color map.

3. The method according to claim 2, wherein Replacing the self - illumination information in the base color map with the light information in the light map to obtain a target map includes: Replace the self - illumination information in the Alpha channel of the base color map with the light information in the light map to obtain a target map.

4. The method according to claim 1, wherein After the step of performing light baking based on the self - illumination information and the base color information to obtain a light map, it further includes: Convert the light map into a grayscale map.

5. The method according to claim 4, characterized in that, Storing the self - illumination information in the self - illumination map into the light map includes: Convert the self - illumination map stored according to the first texture space into the second texture space; Merge the converted self - illumination map into the light map in the second texture space.

6. The method according to claim 1, characterized in that, The rendering according to the target map includes: Sample the self - illumination information from the target map, and calculate the target color information according to the preset color information and the self - illumination information; Render the game scene according to the target color.

7. A display control device in a game, characterized in that, including: A map acquisition module, configured to obtain a base color map; wherein, the base color map contains the base color information of the game scene and the self - illumination information in the self - illumination map; A light baking module, configured to perform light baking based on the self - illumination information and the base color information to obtain a light map; A map merging module, configured to store the self - illumination information in the self - illumination map into the light map; A map information replacement module, configured to replace the self - illumination information in the base color map with the light information in the light map to obtain a target map; A rendering module, configured to render the game scene according to the target map to display a game scene with an indirect lighting effect on the graphical user interface; Wherein, the self - illumination map is stored according to a first texture space, and there is overlapping content in the maps in the first texture space; the light map is stored according to a second texture space, and there is no overlapping content in the maps in the second texture space.

8. An electronic device, characterized in that, including: A processor and a storage medium, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device runs, the processor executes the machine-readable instructions to perform the method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, A computer program is stored on the storage medium, and when the computer program is run by the processor, the method according to any one of claims 1-6 is performed.

Citation Information

Patent Citations

  • Scene rendering method and device, computer storage medium and electronic equipment

    CN113144611A