Game scene processing method and device, electronic equipment and storage medium

CN116983627BActive Publication Date: 2026-10-09NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311016109.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-11
Publication Date
2026-10-09
Estimated Expiration
2043-08-11

AI Technical Summary

Technical Problem

[0003]本发明实施例是提供一种游戏场景的处理方法、装置、电子设备以及计算机可读存储介质,以解决或部分解决游戏场景的显示过于单一,且开发过程中消耗大量的时间和人力的问题

Benefits of technology

[0019] In this embodiment of the invention, for the presentation of game scenes, the game can obtain the position of the virtual character in the game scene, and determine the target scene object to be occluded based on the position. Then, according to the object parameters of the target scene object and the character parameters of the virtual character, the target scene object is occluded to obtain a grayscale mask image for the target scene object. This grayscale mask image is then used to render and output the target scene object. For players, by occluding some scene objects in the game scene using the grayscale mask image, and based on the different rendering outputs of the scene objects, a corresponding environmental atmosphere is created in the game scene, improving the realism of the game scene and enriching the display effect of the game scene. Furthermore, as the virtual character moves in the game scene, the game scene can change synchronously according to the position of the virtual character, ensuring the consistency of the game scene presentation. For game developers, by adjusting the position, character parameters, and object parameters during the development process, a large number of adjustments to the virtual model can be reduced, greatly reducing the time and effort required for game development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116983627B_ABST
    Figure CN116983627B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a game scene processing method and device, electronic equipment and storage medium, applied to the technical field of games, the method comprises: obtaining the position of a virtual character in a game scene; determining a target scene object to be shielded from the game scene based on the position; shielding the target scene object according to the object parameters of the target scene object and the character parameters of the virtual character, obtaining a grayscale mask image for the target scene object; and rendering and outputting the target scene object according to the grayscale mask image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of game technology, and in particular to a method for processing game scenes, a device for processing game scenes, an electronic device, and a computer-readable storage medium. Background Technology

[0002] In games, rich gameplay can bring players great enjoyment, while the presentation of game scenes can also provide players with a good visual experience and a strong sense of immersion. In some games, the style of the game scene presentation is similar to or the same as the game's style, with all scene objects belonging to the same theme, such as pastoral, dark, or cartoon styles. However, an overly uniform display method not only causes visual fatigue and reduces the visual experience for players, but also requires developers to make adjustments for each scene object during the game development process, resulting in a huge consumption of time and manpower. Summary of the Invention

[0003] The present invention provides a method, apparatus, electronic device, and computer-readable storage medium for processing game scenes, in order to solve or partially solve the problem that the display of game scenes is too monotonous and that a lot of time and manpower are consumed during the development process.

[0004] This invention discloses a method for processing game scenes, including:

[0005] Obtain the location of the virtual character in the game scene;

[0006] The target scene object to be occluded is determined from the game scene based on the location;

[0007] Based on the object parameters of the target scene object and the role parameters of the virtual character, the target scene object is occluded to obtain a grayscale mask image for the target scene object;

[0008] The target scene object is rendered and output based on the grayscale mask image.

[0009] This invention also discloses a game scene processing device, comprising:

[0010] The location acquisition module is used to obtain the location of the virtual character in the game scene;

[0011] A scene object determination module is used to determine the target scene object to be occluded from the game scene based on the location;

[0012] The masking image generation module is used to mask the target scene object based on the object parameters of the target scene object and the role parameters of the virtual character, and obtain a grayscale masking image for the target scene object.

[0013] The rendering module is used to render and output the target scene object based on the grayscale mask image.

[0014] This invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0015] The memory is used to store computer programs;

[0016] When the processor executes a program stored in the memory, it implements the method described in the embodiments of the present invention.

[0017] This invention also discloses a computer-readable storage medium storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this invention.

[0018] The embodiments of the present invention have the following advantages:

[0019] In this embodiment of the invention, for the presentation of game scenes, the game can obtain the position of the virtual character in the game scene, and determine the target scene object to be occluded based on the position. Then, according to the object parameters of the target scene object and the character parameters of the virtual character, the target scene object is occluded to obtain a grayscale mask image for the target scene object. This grayscale mask image is then used to render and output the target scene object. For players, by occluding some scene objects in the game scene using the grayscale mask image, and based on the different rendering outputs of the scene objects, a corresponding environmental atmosphere is created in the game scene, improving the realism of the game scene and enriching the display effect of the game scene. Furthermore, as the virtual character moves in the game scene, the game scene can change synchronously according to the position of the virtual character, ensuring the consistency of the game scene presentation. For game developers, by adjusting the position, character parameters, and object parameters during the development process, a large number of adjustments to the virtual model can be reduced, greatly reducing the time and effort required for game development. Attached Figure Description

[0020] Figure 1 This is a flowchart of the steps of a game scene processing method provided in an embodiment of the present invention;

[0021] Figure 2 This is a schematic diagram of the game screen provided in an embodiment of the present invention;

[0022] Figure 3 This is a schematic diagram of the masking image provided in an embodiment of the present invention;

[0023] Figure 4 This is a schematic diagram of the masking image provided in an embodiment of the present invention;

[0024] Figure 5 This is a schematic diagram of a game scene provided in an embodiment of the present invention;

[0025] Figure 6 This is a schematic diagram of a game scene provided in an embodiment of the present invention;

[0026] Figure 7 This is a structural block diagram of a game scene processing device provided in an embodiment of the present invention;

[0027] Figure 8 This is a block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0028] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0029] As an example, in games with a specific atmosphere and a fixed perspective, the game scenes often contain numerous scenes with specific terrain features. These scenes typically use uniform lighting, which causes all models to appear the same brightness. This results in a monotonous display and poor visual depth, significantly reducing the player's visual experience. For instance, in dark-themed game scenes, the common approach is to manually adjust the models (terrain models, etc.) and use post-processing techniques like vignetting to darken the four corners of the screen, creating a bright center and dark edges. However, vignetting only darkens the edges of the screen. While it increases the sense of darkness, it reduces the depth and complexity of the game scene, resulting in poor display quality. Furthermore, manually adjusting the models adds significant workload for game developers, requiring considerable time and manpower.

[0030] In this invention, for the presentation of game scenes, the game can obtain the position of the virtual character in the game scene, and determine the target scene object to be occluded based on the position. Then, according to the object parameters of the target scene object and the character parameters of the virtual character, the target scene object is occluded to obtain a grayscale mask image for the target scene object. The target scene object is then rendered based on the grayscale mask image to present a dark atmosphere effect in the game scene. For players, by occluding scene objects in the game scene through the grayscale mask image, some scene objects are rendered normally, while others are rendered through the grayscale mask image. Based on the different rendering outputs of scene objects, a dark atmosphere effect is created in the game scene, improving the realism of the game scene and enriching the display effect. Furthermore, as the virtual character moves in the game scene, the game scene can change synchronously according to the position of the virtual character, ensuring the consistency of the game scene presentation. For game developers, by adjusting the position, character parameters, and object parameters during development, a large number of adjustments to the virtual model can be reduced, greatly reducing the time and effort required for game development.

[0031] Reference Figure 1 The diagram illustrates a flowchart of a game scene processing method provided in an embodiment of the present invention, which may specifically include the following steps:

[0032] Step 101: Obtain the location of the virtual character in the game scene.

[0033] Optionally, embodiments of the present invention can be applied to electronic devices. These devices provide a graphical user interface (GUI), and when running game applications, game mini-programs, or game pages, the corresponding game interface can be displayed within the GUI. The game interface can include a game scene and virtual characters located within that scene. The virtual characters can be virtual objects controlled by the player; the game scene can include several scene objects, such as vegetation, trees, rocks, and buildings.

[0034] In the game, electronic devices can respond to the player's control commands to the virtual character, controlling the virtual character to move in the game scene. During the movement of the virtual character, the electronic device can obtain the virtual character's position in the game scene in real time, so as to locate the virtual character by position, and then determine which scene objects need to be processed based on the location results.

[0035] Step 102: Determine the target scene object to be occluded from the game scene based on the location.

[0036] In some optional embodiments, a corresponding spatial coordinate system can be established for the game scene. The virtual object can then be treated as a point mass. As the point mass moves within the spatial coordinate system, the electronic device can obtain the virtual object's coordinates within the game scene, thus enabling the positioning of the virtual character. It should be noted that, limited by the display range of the electronic device's graphical user interface, only a portion of the game scene where the virtual character is located can be displayed during gameplay. Therefore, the position of the virtual character allows for the positioning of the game scene displayed in the graphical user interface, as well as the positioning of scene objects visible to the player.

[0037] In this system, electronic devices can define occlusion zones within the game scene based on the character's coordinates, and then target scene objects outside these occlusion zones. In one possible example, for a dark-themed game scene, the display characteristics are that areas closer to the virtual character are displayed at higher brightness (or normal brightness), while areas farther away are displayed at lower brightness. Based on this, the player can use the character's coordinates as the origin and define bright and occlusion zones within the game scene according to a preset distance threshold. Scene objects within the bright zones are displayed in their original colors, while those within the occlusion zones are obscured before being displayed, creating a sense of depth with a "bright center and dark surroundings" effect, thus improving the game's visual presentation.

[0038] For example, refer to Figure 2 The diagram illustrates a game screen provided in an embodiment of the present invention. Assuming a distance threshold of 15m (the distance threshold is a value set based on the coordinate parameters of the game scene), this distance threshold can be set based on the physical parameters within the game scene. That is, after obtaining the character coordinates of the virtual character in the game scene, a circle with a radius of 15m is constructed with the character coordinates as the origin. The area inside the circle is designated as the bright area, and the area outside the circle is designated as the occluded area. Different screen rendering processes are applied to the two areas respectively to create a sense of layering for the player, where the center is bright and the surrounding area is dark, thereby improving the display effect of the game screen.

[0039] Step 103: Based on the object parameters of the target scene object and the role parameters of the virtual character, the target scene object is occluded to obtain a grayscale mask image for the target scene object.

[0040] In this embodiment of the invention, the occlusion processing of the target scene object can be performed using a corresponding mask image. The texture of the target scene object is adjusted based on the parameters corresponding to the mask image to achieve the desired artistic effect, such as a dark atmosphere. During the processing, the electronic device can acquire the object parameters of the target scene object and the character parameters of the virtual object. Then, based on these parameters, the target scene object is occluded to obtain a corresponding grayscale mask image, which is then used to render the target scene object.

[0041] The object parameters can include the character height. The electronic device can use the character height and the object height to calculate the height difference between the virtual character and the target scene object. Then, it can obtain the original color corresponding to the target scene object, and then mask the target scene object according to the height difference and the original color to obtain a grayscale mask image for the target scene object, so as to render the target scene object according to the grayscale mask image.

[0042] It should be noted that scene objects can be composed of several fragments (such as triangular facets) and corresponding material maps added to these fragments. For example, a dungeon building can be composed of several fragments forming its structure, and a material map corresponding to the dungeon building can be added to this structure to obtain the dungeon building model in the game scene. Based on this, the original color can be the color of the material map itself. By rendering the scene object using a grayscale mask, the scene object can be displayed based on the adjusted color, allowing the same scene object to achieve a complex sense of depth and improving the display effect.

[0043] In one optional example, the character parameter may include a first ordinate representing the character's height, and the object parameter may include a second ordinate representing the object's height. The electronic device can then calculate the height difference between the virtual character and the target scene object using the first and second ordinates. Since the target scene object comprises several fragments, the electronic device can use the fragment with the largest ordinate as the target fragment for measuring the object's height. The same applies to the virtual character. Then, the maximum ordinates corresponding to the target scene object and the virtual character are subtracted, and the absolute value of the difference is taken as the height difference between the target scene object and the virtual character. In a game scene, to represent the field of view, excessively tall or short portions of the scene object can be occluded to achieve a layered effect with varying heights.

[0044] In some possible embodiments, if the height difference is less than a first height threshold, the original occlusion value corresponding to the original color is obtained; if the height difference is greater than or equal to the first height threshold, an unoccluded area and a gradient occlusion area are determined from the target scene object based on the height difference and the first height threshold, or an unoccluded area, a gradient occlusion area, and a fully occluded area are determined. Then, the target color for occluding the scene object and the area value corresponding to the gradient occlusion area are obtained. The target color is the color used to fully occlude the scene object. Then, the gradient occlusion area is occluded based on the area value, the original color, and the target color to obtain the gradient occlusion range for the gradient occlusion area. The gradient occlusion range is the range of occlusion values ​​that gradually transition from the original occlusion value to the target occlusion value. The target occlusion value is the occlusion value where the scene object is completely invisible relative to the light source. Then, a grayscale mask image for the target scene object is generated based on the original occlusion value, or the original occlusion value and the gradient occlusion range. The ordinate of each fragment in the gradient occlusion area can be used as the area value.

[0045] The unmasked area can be an area displayed in its original color, the gradient masked area can be an area that gradually transitions from its original color to the target color according to its height, and the fully masked area can be an area displayed in the target color. Optionally, the target color can be set according to the game theme. For example, for a dark game theme, the target color can be black. This invention does not limit this.

[0046] For gradient occlusion areas and complete occlusion areas, a first height threshold and a second height threshold can be used for determination. The first height threshold is the threshold at which occlusion of the target scene object begins, and the second height threshold is the threshold at which complete occlusion of the target scene object is determined. If the height difference is greater than or equal to the first height threshold and less than or equal to the second height threshold, the height difference and the first height threshold are used to determine the unoccluded area and the gradient occlusion area on the target scene object. If the height difference is greater than the second height threshold, the height difference, the first height threshold, and the second height threshold are used to determine the unoccluded area, the gradient occlusion area, and the complete occlusion area on the target scene object.

[0047] For example, assuming the height difference between the target scene object and the virtual character is 200, and the virtual character's height is 10, and the first height threshold is set to 100, and the second height threshold is set to 150, then in determining the unoccluded area, the gradually occluded area, and the fully occluded area, a mapping can be made using the virtual character's height, the height difference, the first height threshold, and the second height threshold. Different areas can be determined from the target scene object. The first height threshold represents the height at which occlusion begins on the target scene object; that is, occlusion begins when the height difference is 100. The height difference... 100 corresponds to the position of the target scene object 110. As can be seen, based on the aforementioned process, it can be determined that the area below 110 in the target scene object is an unobscured area, the area between 110 and 160 in height is a gradually obscured area, and the area above 160 in height is a completely obscured area. Thus, the target scene area can be divided into regions by the height difference, so that different regions can be displayed in different ways to create a sense of layering with varying heights and improve the display effect. Furthermore, by processing the game scene horizontally and vertically respectively, the presentation of the game scene is greatly enriched.

[0048] It should be noted that the units for the above values ​​can be set according to the game scene at a 1:1 scale, such as meters, or other units. This invention does not limit this.

[0049] When the target scene object is divided into "unoccluded area + gradient occluded area" or "unoccluded area + gradient occluded area + fully occluded area", the interpolation factor can be obtained for interpolation calculation. Then, the interpolation factor is used to interpolate the original color and the target color to obtain the corresponding gradient color range. The gradient color range is the range of color values ​​that transition from the original color of the target scene object to the target color. Then, the gradient color range is interpolated using the vertical coordinate of each target fragment in the gradient occluded area as the interpolation factor to obtain the gradient occlusion range for the gradient occlusion area. The gradient occlusion range is the range of occlusion values ​​that gradually transition from the original occlusion value to the target occlusion value. The original occlusion value is the occlusion value that allows the scene object to maintain its original color for display. The target occlusion value is the occlusion value that makes the scene object completely invisible relative to the light source. Therefore, for unoccluded areas, it corresponds to the original occlusion value; for gradient occlusion areas, it corresponds to the range of change from the original occlusion value to the target occlusion value; and for fully occluded areas, it corresponds to the target occlusion value.

[0050] In one possible example, refer to Figure 3 , 4The diagram illustrates a masking image provided in an embodiment of the present invention. For occlusion processing of a game scene, the surface of scene objects can be masked using the AO channel (Ambient Occlusion channel) to weaken the display of scene objects, thereby increasing the depth and three-dimensionality of the scene objects and enhancing the realism of the game scene. Optionally, Figure 3 It can be the grayscale mask image corresponding to the AO channel without any masking, when passed through Figure 3 When the corresponding grayscale mask image is used to process the game scene, the game scene can be displayed according to its original colors; while Figure 4 This can be the grayscale mask image corresponding to the AO channel, which is masked based on the height difference. Figure 4 When the corresponding grayscale mask is used to process the game scene, different heights of the corresponding scene objects in the game scene can be displayed in different ways to achieve a layered effect with varying heights.

[0051] Step 104: Render the target scene object according to the grayscale mask image.

[0052] The grayscale mask image generated based on the above embodiments contains corresponding image processing parameters. Electronic devices can then render target scene objects based on these image processing parameters to present a dark atmosphere effect of the target scene objects in the game scene. For players, the grayscale mask image masks scene objects in the game scene, creating a dark atmosphere effect, which improves the realism of the game scene and enriches the display effect of the game scene. Furthermore, as the virtual character moves in the game scene, the game scene can change synchronously according to the position of the virtual character, ensuring the consistency of the game scene presentation. For game developers, by adjusting the position, character parameters, and object parameters during the development process, a large number of adjustments to the virtual model can be reduced, greatly reducing the time and effort required for game development.

[0053] In some possible embodiments, differentiated display can be performed based on the height difference. If the height difference is less than a first height threshold, the target scene object is rendered according to the original occlusion value, and the original color of the target scene object is displayed.

[0054] If the height difference is greater than or equal to the first height threshold and less than or equal to the second height threshold, then the unoccluded area in the target scene object is rendered according to the original occlusion value, displaying the original color of the unoccluded area in the target scene object, and the gradient occluded area in the target scene object is rendered according to the gradient occlusion range, controlling the gradient occluded area to gradually transition from the original color to the target color.

[0055] If the height difference is greater than the second height threshold, the unoccluded area in the target scene object is rendered according to the original occlusion value, displaying the original color of the unoccluded area in the target scene object. The gradient occlusion area in the target scene object is rendered according to the gradient occlusion range, controlling the gradient occlusion area to transition from the original color to the target color. The fully occluded area in the target scene object is rendered according to the target occlusion value, and the fully occluded area is displayed with the target color.

[0056] In one possible example, refer to Figure 5 , 6 The diagram illustrates a game scene provided in an embodiment of the present invention, wherein... Figure 5 This is a schematic diagram of a game scene without any occlusion treatment. All objects in the game scene have the same brightness, resulting in a monotonous display lacking any sense of depth or layering. Figure 6 Based on Figure 4 The game scene after being masked by the corresponding grayscale mask image shows that areas closer to the virtual character are brighter, while areas farther away are darker, exhibiting a clear sense of depth and layering both horizontally and vertically. For players, masking objects in the game scene with grayscale images creates a dark atmosphere, enhancing the realism of the game scene and enriching its display. Furthermore, as the virtual character moves within the game scene, the scene changes synchronously with the character's position, ensuring consistency in the game scene presentation. For game developers, adjusting positions, character parameters, and object parameters during development reduces the need for extensive adjustments to the virtual model, significantly reducing development time and effort.

[0057] It should be noted that the embodiments of the present invention include, but are not limited to, the examples described above. It is understood that those skilled in the art can make further settings according to actual needs under the guidance of the ideas in the embodiments of the present invention, and the present invention does not limit such settings.

[0058] In this embodiment of the invention, for the presentation of game scenes, the game can obtain the position of the virtual character in the game scene, and determine the target scene object to be occluded based on the position. Then, according to the object parameters of the target scene object and the character parameters of the virtual character, the target scene object is occluded to obtain a grayscale mask image for the target scene object. This grayscale mask image is then used to render and output the target scene object. For players, by occluding some scene objects in the game scene using the grayscale mask image, and based on the different rendering outputs of the scene objects, a corresponding environmental atmosphere is created in the game scene, improving the realism of the game scene and enriching the display effect of the game scene. Furthermore, as the virtual character moves in the game scene, the game scene can change synchronously according to the position of the virtual character, ensuring the consistency of the game scene presentation. For game developers, by adjusting the position, character parameters, and object parameters during the development process, a large number of adjustments to the virtual model can be reduced, greatly reducing the time and effort required for game development.

[0059] To enable those skilled in the art to better understand the technical solution of the present invention, an example is provided below for illustration:

[0060] In the game, you can first obtain the character coordinates of the virtual character and the object coordinates of each fragment in the target scene object that needs to be occluded. Then, take the difference between the y-axis values ​​of the two coordinates to obtain the height difference between the virtual character and the scene object, and take the absolute value of the height difference.

[0061] Specifically, two values ​​can be set: a first occlusion height of 100 and a second complete occlusion height of 150. The height difference can then be compared with 100 and 150 respectively to divide the scene object into regions and obtain the corresponding region values. The relative region position y_diff between the fragment and the occlusion start height and complete occlusion height can take values ​​from 0 to 1, gradually increasing from the first occlusion height to the second complete occlusion height.

[0062] Next, we can first calculate the color of the strongest occlusion, that is, the original color and black float3(0.0, 0.0, 0.0) are linearly interpolated by 0.5. Finally, based on the value of y_diff, we interpolate the original color and the color of the strongest occlusion to obtain the final darkened color. After obtaining the adjusted colors, the occlusion value (AO value) can be obtained by interpolating between the original occlusion value and the highest occlusion value of 0.05 using the occlusion channel `mtl.occlusion` based on the value of `y_diff`. Then, a corresponding grayscale mask image is generated based on this AO value, and the scene objects are rendered according to the grayscale mask image. For players, the grayscale mask image occludes scene objects in the game scene, creating a dark atmosphere effect, improving the realism of the game scene, enriching the display effect of the game scene, and the game scene changes synchronously with the virtual character's position as the virtual character moves, ensuring the consistency of the game scene presentation. For game developers, by adjusting the position, character parameters, and object parameters during development, a large number of adjustments to the virtual model can be reduced, greatly reducing the time and effort required for game development. Furthermore, the code-controlled approach facilitates later modifications and improves the convenience of game development.

[0063] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0064] Reference Figure 7 The diagram illustrates a structural block diagram of a game scene processing device provided in an embodiment of the present invention, which may specifically include the following modules:

[0065] The location acquisition module 701 is used to acquire the location of the virtual character in the game scene;

[0066] Scene object determination module 702 is used to determine the target scene object to be occluded from the game scene based on the position;

[0067] The masking image generation module 703 is used to mask the target scene object according to the object parameters of the target scene object and the role parameters of the virtual character, and obtain a grayscale masking image for the target scene object.

[0068] The rendering module 704 is used to render and output the target scene object based on the grayscale mask image.

[0069] In some optional embodiments, the character parameter includes character height, the object parameter includes object height, and the mask image generation module 703 is specifically used for:

[0070] The height difference between the virtual character and the target scene object is calculated using the character's height and the object's height.

[0071] Obtain the original color corresponding to the target scene object;

[0072] The target scene object is masked based on the height difference and the original color to obtain a grayscale mask image for the target scene object.

[0073] In some optional embodiments, the mask image generation module 703 is specifically used for:

[0074] If the height difference is less than the first height threshold, then the original occlusion value corresponding to the original color is obtained;

[0075] If the height difference is greater than or equal to the first height threshold, then based on the height difference and the first height threshold, determine the unoccluded area and the gradually occluded area from the target scene object, or determine the unoccluded area, the gradually occluded area and the completely occluded area.

[0076] Obtain the target color used to occlude scene objects and the area value corresponding to the gradient occlusion area, wherein the target color is the color used to completely occlude scene objects.

[0077] The gradient occlusion area is occluded based on the region value, the original color, and the target color to obtain a gradient occlusion range for the gradient occlusion area. The gradient occlusion range is the range of occlusion values ​​that gradually transition from the original occlusion value to the target occlusion value. The target occlusion value is the occlusion value in which the scene object is completely invisible relative to the light source.

[0078] A grayscale mask image for the target scene object is generated based on the original occlusion value, or the original occlusion value and the gradient occlusion range.

[0079] In some optional embodiments, the mask image generation module 703 is specifically used for:

[0080] If the height difference is greater than or equal to the first height threshold and less than or equal to the second height threshold, then the height difference and the first height threshold are used to determine the unoccluded area and the gradually occluded area on the target scene object.

[0081] If the height difference is greater than the second height threshold, then the height difference, the first height threshold, and the second height threshold are used to determine the unoccluded area, the gradually occluded area, and the fully occluded area from the target scene object.

[0082] In some optional embodiments, the target scene object includes several fragments, and the mask image generation module 703 is specifically used for:

[0083] Obtain the interpolation factor used for interpolation operations;

[0084] The interpolation factor is used to perform interpolation between the original color and the target color to obtain the corresponding gradient color range, which is the range of color values ​​that transition from the original color of the target scene object to the target color.

[0085] Using the ordinate of each target fragment in the gradient occlusion region as an interpolation factor, interpolation is performed on the gradient color range to obtain the gradient occlusion range for the gradient occlusion region.

[0086] In some optional embodiments, the target scene object includes several fragments, and the mask image generation module 703 is specifically used for:

[0087] The ordinate of each fragment in the gradient occlusion region is used as the region value.

[0088] In some optional embodiments, the rendering module 704 is specifically used for:

[0089] If the height difference is less than the first height threshold, the target scene object is rendered according to the original occlusion value, and the original color of the target scene object is displayed.

[0090] In some optional embodiments, the rendering module 704 is specifically used for:

[0091] If the height difference is greater than or equal to the first height threshold and less than or equal to the second height threshold, then the unoccluded area in the target scene object is rendered according to the original occlusion value, and the original color of the unoccluded area in the target scene object is displayed.

[0092] The gradient occlusion area in the target scene object is rendered according to the gradient occlusion range, and the gradient occlusion area is controlled to gradually transition from the original color to the target color.

[0093] In some optional embodiments, the rendering module 704 is specifically used for:

[0094] If the height difference is greater than the second height threshold, then the unoccluded area in the target scene object is rendered according to the original occlusion value, and the original color of the unoccluded area in the target scene object is displayed.

[0095] The gradient occlusion area in the target scene object is rendered according to the gradient occlusion range, and the gradient occlusion area is controlled to gradually transition from the original color to the target color.

[0096] The fully occluded area in the target scene object is rendered according to the target occlusion value, and the fully occluded area is displayed with the target color.

[0097] In some optional embodiments, the location includes the character coordinates of the virtual character in the game scene, and the scene object determination module 702 is specifically used for:

[0098] Based on the character's coordinates, a concealed area is defined in the game scene;

[0099] The scene objects located outside the occluded area in the game scene are taken as the target scene objects.

[0100] In some optional embodiments, the character parameter includes a first ordinate representing the character's height, the object parameter includes a second ordinate representing the object's height, and the mask image generation module 703 is specifically used for:

[0101] The height difference between the virtual character and the target scene object is obtained by calculating using the first and second ordinates.

[0102] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0103] In addition, this invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described game scene processing method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0104] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described game scene processing method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0105] Figure 8 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.

[0106] The electronic device 800 includes, but is not limited to, components such as: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, a processor 810, and a power supply 811. Those skilled in the art will understand that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. In the embodiments of the present invention, the electronic device includes, but is not limited to, mobile phones, tablet computers, laptops, PDAs, in-vehicle terminals, wearable devices, and pedometers.

[0107] It should be understood that, in this embodiment of the invention, the radio frequency unit 801 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink data from the base station and processes it with the processor 810; additionally, it transmits uplink data to the base station. Typically, the radio frequency unit 801 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, etc. Furthermore, the radio frequency unit 801 can also communicate with networks and other devices through a wireless communication system.

[0108] Electronic devices provide users with wireless broadband internet access through network module 802, such as helping users send and receive emails, browse web pages, and access streaming media.

[0109] The audio output unit 803 can convert audio data received by the radio frequency unit 801 or the network module 802 or stored in the memory 809 into audio signals and output them as sound. Furthermore, the audio output unit 803 can also provide audio output related to specific functions performed by the electronic device 800 (e.g., call signal reception sound, message reception sound, etc.). The audio output unit 803 includes a speaker, a buzzer, and a receiver, etc.

[0110] Input unit 804 is used to receive audio or video signals. Input unit 804 may include a graphics processing unit (GPU) 8041 and a microphone 8042. The GPU 8041 processes image data of still images or videos acquired by an image capture device (such as a camera) in video capture mode or image capture mode. The processed image frames can be displayed on display unit 806. The image frames processed by GPU 8041 can be stored in memory 809 (or other storage medium) or transmitted via radio frequency unit 801 or network module 802. Microphone 8042 can receive sound and process such sound into audio data. The processed audio data can be converted into a format that can be transmitted to a mobile communication base station via radio frequency unit 801 in telephone call mode.

[0111] The electronic device 800 also includes at least one sensor 805, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 8061 according to the ambient light level, and the proximity sensor can turn off the display panel 8061 and / or backlight when the electronic device 800 is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used to identify the posture of the electronic device (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. The sensor 805 may also include a fingerprint sensor, pressure sensor, iris sensor, molecular sensor, gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., which will not be described in detail here.

[0112] The display unit 806 is used to display information input by the user or information provided to the user. The display unit 806 may include a display panel 8061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

[0113] User input unit 807 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of electronic devices. Specifically, user input unit 807 includes a touch panel 8071 and other input devices 8072. Touch panel 8071, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near touch panel 8071). Touch panel 8071 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 810, which receives and executes commands from the processor 810. In addition, touch panel 8071 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. Besides touch panel 8071, user input unit 807 may also include other input devices 8072. Specifically, other input devices 8072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, joysticks, etc., which will not be described in detail here.

[0114] Furthermore, the touch panel 8071 can cover the display panel 8061. When the touch panel 8071 detects a touch operation on or near it, it transmits the information to the processor 810 to determine the type of touch event. Subsequently, the processor 810 provides corresponding visual output on the display panel 8061 according to the type of touch event. It is understood that in one embodiment, the touch panel 8071 and the display panel 8061 are implemented as two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 8071 and the display panel 8061 can be integrated to realize the input and output functions of the electronic device. The specific implementation is not limited here.

[0115] Interface unit 808 serves as an interface for connecting external devices to electronic device 800. For example, external devices may include a wired or wireless headphone port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, and so on. Interface unit 808 can be used to receive input from external devices (e.g., data, power, etc.) and transmit the received input to one or more components within electronic device 800, or it can be used to transmit data between electronic device 800 and external devices.

[0116] The memory 809 can be used to store software programs and various data. The memory 809 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback, image playback, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, phonebook, etc.). Furthermore, the memory 809 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0117] The processor 810 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 809, and by calling data stored in the memory 809, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. The processor 810 may include one or more processing units; preferably, the processor 810 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 810.

[0118] The electronic device 800 may also include a power supply 811 (such as a battery) for supplying power to various components. Preferably, the power supply 811 is logically connected to the processor 810 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system.

[0119] In addition, the electronic device 800 includes some functional modules not shown, which will not be described in detail here.

[0120] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0121] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0122] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.

[0123] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0124] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0125] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0126] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0127] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0128] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0129] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for processing game scenes, characterized in that, include: Obtain the location of the virtual character in the game scene; Based on the location, determine the target scene object to be occluded from the game scene; Based on the object parameters of the target scene object and the role parameters of the virtual character, the target scene object is occluded to obtain a grayscale mask image for the target scene object; The target scene object is rendered and output based on the grayscale mask image; The character parameters include character height, the object parameters include object height, and the step of occluding the target scene object based on the object parameters of the target scene object and the character parameters of the virtual character to obtain a grayscale mask image for the target scene object includes: The height difference between the virtual character and the target scene object is calculated using the character's height and the object's height. Obtain the original color corresponding to the target scene object; The target scene object is masked based on the height difference and the original color to obtain a grayscale mask image for the target scene object; The step of occluding the target scene object based on the height difference and the original color to obtain a grayscale mask image for the target scene object includes: If the height difference is less than the first height threshold, then the original occlusion value corresponding to the original color is obtained; If the height difference is greater than or equal to the first height threshold, then based on the height difference and the first height threshold, determine the unoccluded area and the gradually occluded area from the target scene object, or determine the unoccluded area, the gradually occluded area and the completely occluded area. Obtain the target color used to occlude scene objects and the area value corresponding to the gradient occlusion area, wherein the target color is the color used to completely occlude scene objects. The gradient occlusion area is occluded based on the region value, the original color, and the target color to obtain a gradient occlusion range for the gradient occlusion area. The gradient occlusion range is the range of occlusion values ​​that gradually transition from the original occlusion value to the target occlusion value. The target occlusion value is the occlusion value in which the scene object is completely invisible relative to the light source. A grayscale mask image for the target scene object is generated based on the original occlusion value, or the original occlusion value and the gradient occlusion range.

2. The method according to claim 1, characterized in that, If the height difference is greater than or equal to the first height threshold, then based on the height difference and the first height threshold, determine the unoccluded area and the gradually occluded area from the target scene object, or determine the unoccluded area, the gradually occluded area, and the fully occluded area, including: If the height difference is greater than or equal to the first height threshold and less than or equal to the second height threshold, then the height difference and the first height threshold are used to determine the unoccluded area and the gradually occluded area on the target scene object. If the height difference is greater than the second height threshold, then the height difference, the first height threshold, and the second height threshold are used to determine the unoccluded area, the gradually occluded area, and the fully occluded area from the target scene object.

3. The method according to claim 1 or 2, characterized in that, The target scene object includes several fragments. The step of occluding the gradient occlusion area based on the region value, the original color, and the target color to obtain the gradient occlusion range for the gradient occlusion area includes: Obtain the interpolation factor used for interpolation operations; The interpolation factor is used to perform interpolation between the original color and the target color to obtain the corresponding gradient color range, which is the range of color values ​​that transition from the original color of the target scene object to the target color. Using the ordinate of each target fragment in the gradient occlusion region as an interpolation factor, interpolation is performed on the gradient color range to obtain the gradient occlusion range for the gradient occlusion region.

4. The method according to claim 1 or 2, characterized in that, The target scene object includes several fragments, and obtaining the region value corresponding to the gradient occlusion region includes: The ordinate of each fragment in the gradient occlusion region is used as the region value.

5. The method according to claim 1 or 2, characterized in that, The step of rendering and outputting the target scene object based on the grayscale mask image includes: If the height difference is less than the first height threshold, the target scene object is rendered according to the original occlusion value, and the original color of the target scene object is displayed.

6. The method according to claim 1 or 2, characterized in that, The step of rendering and outputting the target scene object based on the grayscale mask image includes: If the height difference is greater than or equal to the first height threshold and less than or equal to the second height threshold, then the unoccluded area in the target scene object is rendered according to the original occlusion value, and the original color of the unoccluded area in the target scene object is displayed. The gradient occlusion area in the target scene object is rendered according to the gradient occlusion range, and the gradient occlusion area is controlled to gradually transition from the original color to the target color.

7. The method according to claim 1 or 2, characterized in that, The step of rendering and outputting the target scene object based on the grayscale mask image includes: If the height difference is greater than the second height threshold, then the unoccluded area in the target scene object is rendered according to the original occlusion value, and the original color of the unoccluded area in the target scene object is displayed. The gradient occlusion area in the target scene object is rendered according to the gradient occlusion range, and the gradient occlusion area is controlled to gradually transition from the original color to the target color. The fully occluded area in the target scene object is rendered according to the target occlusion value, and the fully occluded area is displayed with the target color.

8. The method according to claim 1, characterized in that, The location includes the character coordinates of the virtual character in the game scene, and the step of determining the target scene object to be occluded from the game scene based on the location includes: Based on the character's coordinates, a concealed area is defined in the game scene; The scene objects located outside the occluded area in the game scene are taken as the target scene objects.

9. The method according to claim 1, characterized in that, The character parameters include a first ordinate representing the character's height, and the object parameters include a second ordinate representing the object's height. The step of calculating the height difference between the virtual character and the target scene object using the character's height and the object's height includes: The height difference between the virtual character and the target scene object is obtained by calculating using the first and second ordinates.

10. A device for processing game scenes, characterized in that, include: The location acquisition module is used to obtain the location of the virtual character in the game scene; A scene object determination module is used to determine the target scene object to be occluded from the game scene based on the location; The masking image generation module is used to mask the target scene object according to the object parameters of the target scene object and the role parameters of the virtual character, and obtain a grayscale masking image for the target scene object; The rendering module is used to render and output the target scene object based on the grayscale mask image; The character parameters include character height, the object parameters include object height, and the mask image generation module is specifically used for: The height difference between the virtual character and the target scene object is calculated using the character's height and the object's height. Obtain the original color corresponding to the target scene object; The target scene object is masked based on the height difference and the original color to obtain a grayscale mask image for the target scene object; The step of occluding the target scene object based on the height difference and the original color to obtain a grayscale mask image for the target scene object includes: If the height difference is less than the first height threshold, then the original occlusion value corresponding to the original color is obtained; If the height difference is greater than or equal to the first height threshold, then based on the height difference and the first height threshold, determine the unoccluded area and the gradually occluded area from the target scene object, or determine the unoccluded area, the gradually occluded area and the completely occluded area. Obtain the target color used to occlude scene objects and the area value corresponding to the gradient occlusion area, wherein the target color is the color used to completely occlude scene objects. The gradient occlusion area is occluded based on the region value, the original color, and the target color to obtain a gradient occlusion range for the gradient occlusion area. The gradient occlusion range is the range of occlusion values ​​that gradually transition from the original occlusion value to the target occlusion value. The target occlusion value is the occlusion value in which the scene object is completely invisible relative to the light source. A grayscale mask image for the target scene object is generated based on the original occlusion value, or the original occlusion value and the gradient occlusion range.

11. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-9.

12. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Ink-wash style scene rendering method and device and storage medium

    CN113935894A

  • Game display control method and device, computer equipment and medium

    CN115888103A