Game object contour drawing method and device

By using layer masking and depth texture mapping technology in game objects, the rendering pressure and frame rate problems caused by game objects outline drawing in the prior art are solved, and efficient and accurate outline drawing effects are achieved.

CN119295630APending Publication Date: 2025-01-10ARC GAMES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311653209.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing game object outline drawing method leads to large rendering pressure and resource consumption of terminal equipment, affecting the game running frame rate and reducing the effectiveness of outline drawing.

Method used

By configuring a layer mask on the game object to be rendered, the depth information is stored in the depth texture map, and the depth texture map is sampled during the scene rendering to determine the stroke information, and drawing with the outline transparency blend model to achieve multi-purpose Outline drawing of game objects.

Benefits of technology

It greatly reduces the rendering pressure and performance consumption of end devices, ensures high running frame rates, and improves the accuracy and uniformity of outline drawing through depth texture and transparency color fusion techniques.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295630A_ABST
    Figure CN119295630A_ABST
Patent Text Reader

Abstract

The invention discloses a game object contour drawing method and device, and relates to the technical field of game development. Under the condition that a to-be-rendered game object is configured with a layer mask, depth information of the game object is stored in a depth texture map; under the condition of performing scene rendering on the game object, sampling a plurality of target texels obtained by the depth texture mapping, and determining stroke information based on the target texels; and drawing the stroke information through the contour transparency hybrid model to obtain the contour of the game object. The problem that existing game object contour drawing is low in effectiveness is solved, contour drawing of multiple game objects is completed through one-time screen rendering, the rendering pressure and performance consumption of terminal equipment are greatly reduced, the high operation frame rate is guaranteed, meanwhile, stroke is conducted based on scene depth textures, the accuracy and uniformity of contour drawing are guaranteed, and the efficiency of contour drawing is improved. Therefore, the effectiveness of game object contour drawing is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of game development, and in particular to a method and device for drawing the outline of a game object. Background Art

[0002] In game development, in order to show the visual effects of the game, the outlines of the character or scene models are outlined to make the characters or scenes stand out more clearly.

[0003] At present, the existing outline stroke is usually based on the model or model vertex extending in the normal direction to render the edge of each model one by one to achieve the purpose of stroke. However, rendering each model one by one greatly increases the rendering pressure and resource consumption of the terminal device for scene rendering, which will lead to a decrease in the game running frame rate, thereby affecting the effectiveness of the outline drawing of the game object. Summary of the invention

[0004] In view of this, the present invention provides a method and device for drawing the outline of a game object, the main purpose of which is to solve the problem that the terminal device rendering pressure and resource consumption of the existing game object outline drawing are large and the effectiveness is low.

[0005] According to one aspect of the present invention, there is provided a method for drawing the outline of a game object, comprising:

[0006] Under the condition that the game object to be rendered is configured with a layer mask, the depth information of the game object is stored in a depth texture map, where the depth texture map is obtained by image processing of all game scenes within the visible range of the screen;

[0007] Under the condition of performing scene rendering on the game object, sampling a plurality of target texels obtained from the depth texture map, and determining stroke information based on the target texels;

[0008] The stroke information is drawn using a contour transparency hybrid model to obtain the contour of the game object. The contour transparency hybrid model is used to characterize a method for drawing based on transparency and color overlapping factors.

[0009] Furthermore, the sampling of the depth texture map to obtain a plurality of target texels and determining the stroke information based on the target texels includes:

[0010] Sampling a plurality of the target texels from the depth texture map, and acquiring associated texels of the target texels, wherein the associated texels are texels having inner and outer circle positional relationships with the target texels;

[0011] The stroke information is determined based on the target texel and the depth value corresponding to the associated texel.

[0012] Further, the determining the stroke information based on the target texel and the depth value corresponding to the associated texel includes:

[0013] Under the condition that the depth value is less than or equal to the scene depth value, determining that the target texel and the associated texel are contour texels;

[0014] An interpolation calculation is performed on the contour texels, and a contour position is determined based on the interpolated contour texels, and stroke information is generated based on the contour color, contour width, and the contour position.

[0015] Further, the associated texels include inner circle texels and outer circle texels, the inner circle texels include the texels directly above, directly below, directly to the left, and directly to the right of the target texel, and the outer circle texels include the upper left texel, the lower left texel, the upper right texel, and the lower right texel, and the method further includes:

[0016] Obtaining the radii of the inner circle texels and the outer circle texels, and determining the upper texel, the lower texel, the left texel, the right texel, the upper left texel, the lower left texel, the upper right texel, and the lower right texel based on the radii;

[0017] The total texel values ​​of the texel directly above, the texel directly below, the texel directly to the left, the texel directly to the right, the upper left texel, the lower left texel, the upper right texel, and the lower right texel are calculated by texel weights, and the contour width is determined based on the total texel value.

[0018] Furthermore, the drawing of the stroke information by using the contour transparency hybrid model to obtain the contour of the game object includes:

[0019] Determine the outline transparency of the outline color, and calculate the drawing color corresponding to the outline color, the outline transparency and the scene color based on the outline transparency blending model;

[0020] The outline of the game object is obtained by drawing according to the drawing color and the stroke information through a shader.

[0021] Furthermore, the method further comprises:

[0022] The outline color is linearly attenuated according to the depth value of the outline texel, so as to update the stroke information with the linearly attenuated outline color.

[0023] Furthermore, before storing the depth information of the game object as a depth texture map, the method further includes:

[0024] Determine a game object to be outlined in a game scene, and configure a layer mask for the game object to store depth information of the game object as a depth texture map when rendering the game object.

[0025] According to another aspect of the present invention, there is provided a device for drawing an outline of a game object, comprising:

[0026] A storage module, used for storing the depth information of the game object as a depth texture map under the condition that the game object to be rendered is configured with a layer mask;

[0027] A determination module, configured to sample a plurality of target texels obtained by the depth texture map under the condition of performing scene rendering on the game object, and determine stroke information based on the target texels;

[0028] A drawing module is used to draw the stroke information through a contour transparency hybrid model to obtain the contour of the game object.

[0029] Furthermore, the determining module includes:

[0030] A sampling unit, configured to sample a plurality of the target texels from the depth texture map, and obtain an associated texel of the target texel, wherein the associated texel is a texel having an inner and outer circle position relationship with the target texel;

[0031] A determination unit is used to determine stroke information based on the target texel and the depth value corresponding to the associated texel.

[0032] Further, in a specific application scenario, the determining unit is specifically used to determine that the target texel and the associated texel are contour texels under the condition that the depth value is less than or equal to the scene depth value;

[0033] An interpolation calculation is performed on the contour texels, and a contour position is determined based on the interpolated contour texels, and stroke information is generated based on the contour color, contour width, and the contour position.

[0034] Furthermore, the device also includes:

[0035] an acquisition module, configured to acquire the radii of the inner circle texels and the outer circle texels, and determine the upper texel, the lower texel, the left texel, the right texel, the upper left texel, the lower left texel, the upper right texel, and the lower right texel based on the radii;

[0036] A calculation module is used to calculate the total texel value of the texel directly above, the texel directly below, the texel directly to the left, the texel directly to the right, the texel directly to the upper left, the texel directly to the lower left, the texel directly to the upper right, and the texel directly to the lower right through the texel weights, and determine the contour width based on the total texel value.

[0037] Furthermore, the drawing module includes:

[0038] a calculation unit, configured to determine the outline transparency of the outline color, and calculate a drawing color corresponding to the outline color, the outline transparency, and the scene color based on an outline transparency hybrid model;

[0039] A drawing unit is used to draw according to the drawing color and the stroke information through a shader to obtain the outline of the game object.

[0040] Furthermore, the device also includes:

[0041] The processing module is used to perform linear attenuation processing on the outline color according to the depth value of the outline texel, so as to update the stroke information through the linearly attenuated outline color.

[0042] Furthermore, the device also includes:

[0043] A configuration module is used to determine a game object whose outline is to be drawn in a game scene, and configure a layer mask for the game object so as to store the depth information of the game object as a depth texture map when rendering the game object.

[0044] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute operations corresponding to the above-mentioned method for drawing the outline of a game object.

[0045] According to another aspect of the present invention, there is provided a terminal, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0046] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned method for drawing the outline of the game object.

[0047] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:

[0048] The present invention provides a method and device for drawing the outline of a game object. First, under the condition that the game object to be rendered is configured with a layer mask, the depth information of the game object is stored in a depth texture map, and the depth texture map is obtained by image processing of all game scenes within the visible range of the screen; under the condition that the game object is rendered, multiple target texels are sampled from the depth texture map, and stroke information is determined based on the target texels; the stroke information is drawn through a contour transparency hybrid model to obtain the outline of the game object, and the contour transparency hybrid model is used to characterize the method of drawing based on transparency color overlap factors. Compared with the prior art, the embodiment of the present invention marks the game objects that need to be outlined based on the layer mask, so that the game objects that are outlined at a single time are not limited to one, and the outline drawing of multiple game objects is completed by one screen rendering, which greatly reduces the rendering pressure and performance consumption of the terminal device and ensures a high running frame rate. At the same time, by storing the depth information of the game object in the depth texture map obtained by image processing of the entire game scene within the visible range of the screen, and determining the stroke information based on the scene depth texture, transparency color fusion technology and image detection technology, the accuracy and uniformity of the outline drawing are ensured, thereby ensuring the effectiveness of the outline drawing of the game object.

[0049] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0051] Figure 1 A flow chart of a method for drawing the outline of a game object provided by an embodiment of the present invention is shown;

[0052] Figure 2 A rendering of the outline of a game object provided by an embodiment of the present invention is shown;

[0053] Figure 3 A flow chart of another method for drawing the outline of a game object provided by an embodiment of the present invention is shown;

[0054] Figure 4 A schematic diagram of a texel position relationship provided by an embodiment of the present invention is shown;

[0055] Figure 5 A logic flow chart of contour drawing provided by an embodiment of the present invention is shown;

[0056] Figure 6 A block diagram showing a device for drawing the outline of a game object provided by an embodiment of the present invention;

[0057] Figure 7 A schematic diagram of the structure of a terminal provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0058] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0059] Existing outline strokes usually render the edges of each model one by one based on the model or model vertex extending in the normal direction to achieve the purpose of stroke. However, rendering each model one by one greatly increases the rendering pressure and resource consumption of the terminal device for scene rendering, which will cause the game running frame rate to drop, resulting in problems that affect the effectiveness of the outline drawing of the game object.

[0060] The embodiment of the present invention provides a method for drawing the outline of a game object, such as Figure 1 As shown, the method includes:

[0061] 101. Under the condition that the game object to be rendered is configured with a layer mask, store the depth information of the game object in a depth texture map.

[0062] In the embodiment of the present invention, in order to ensure a realistic and vivid game screen display effect, it is necessary to draw the outline of the game object according to the depth information of the game object in the overall game screen. Since in the game rendering page, only some individuals in the entire screen need to be outlined, not all, therefore, the layer mask is used as a mark, and the object to be rendered configured with the layer mask is used as the game object that is expected to be outlined, and the depth information of the game object is stored in the depth texture map. Among them, the depth texture map is obtained by image processing of all game scenes within the visible range of the screen, that is, the rendering information of all game scenes of the overall screen except the game object is stored in the depth texture map. The game object is an individual in the game screen to be rendered, for example, a game character, a building, a ship, a mountain in the near distance, a tree, etc. in the display page, which is not specifically limited in the embodiment of the present invention.

[0063] It should be noted that the game object can be one, two or more, that is, a layer mask can be configured for multiple game objects, and the depth information of multiple game objects can be stored in the depth texture map. Based on the marking of the layer mask, in the subsequent contour drawing process, multiple game objects can be contoured at the same time, avoiding contour drawing of game objects one by one, so as to greatly reduce the rendering pressure and resource consumption of the terminal device for scene rendering.

[0064] 102. Under the condition of performing scene rendering on the game object, sample a plurality of target texels obtained by the depth texture map, and determine stroke information based on the target texels.

[0065] In an embodiment of the present invention, the target texel is a sampled pixel corresponding to a texture that is expected to be outlined in the constituent texture of the game object. When it is necessary to render the game object in the game screen, the edge pixels of the game object in the depth texture map are sampled. Among them, the sampling interval can be customized according to the image quality presentation requirements, and the embodiment of the present invention does not specifically limit it. After determining the target texel of the game object, the depth information of the target texel is used to determine whether the game object needs to be outlined, and if outline drawing is required, the outline position, outline width and other stroke information of the outline drawing are determined. For example, the game object is a fluttering flag in the game scene. According to the visual principle, the outline clarity and width of the flag will present a gradient effect as the depth in the scene extends. Therefore, it is necessary to calculate the information required to draw the outline of each target texel, that is, the stroke information, based on the depth information of different target texels of the flag.

[0066] It should be noted that by sampling multiple target texels of the depth texture map and determining the stroke information based on the target texels, batch processing of global stroke information in the game scene is achieved, avoiding the confirmation of stroke information for game objects one by one. In addition, stroking based on the target texel and the depth information of the target texel improves the correlation between the game object and the overall picture on the screen, which can greatly improve the delicacy of the stroke, so that the stroke information is more in line with the visual requirements of contour presentation.

[0067] 103. Draw the stroke information through a contour transparency hybrid model to obtain a contour of the game object.

[0068] In the embodiment of the present invention, the rendering of the game object includes the rendering of graphics and colors. The three-dimensional effect of the outline needs to be reflected not only by the graphic changes such as the outline width, but also by the color of the outline. The outline color is affected by many factors such as the color of the game object, the outline depth, and the color of the scene around the outline. Therefore, after determining the stroke information of the game object, it is necessary to draw the stroke information with the help of the outline transparency hybrid model to obtain the outline of the rendered game object. Figure 2 As shown in the figure, the floating edge of the game character's clothes and the edge of the near-field rocks are all outlines drawn based on the above method. Among them, the outline transparency hybrid model is used to characterize the method of drawing based on the transparency color overlapping factor.

[0069] It should be noted that contour drawing is performed based on the depth information of game objects and the contour transparency hybrid model, which enables refined outlining of game objects from two dimensions: spatial vision and color vision. While implementing batch processing of game object contours and ensuring the game running frame rate, it ensures the delicacy of contour drawing and meets contour rendering requirements, thereby ensuring the effectiveness of contour drawing of game objects.

[0070] In one embodiment of the present invention, for further explanation and limitation, as shown in FIG. Figure 3 As shown, the step of sampling the multiple target texels obtained from the depth texture map and determining the stroke information based on the target texels includes:

[0071] 301. Sample a plurality of target texels from the depth texture map, and obtain associated texels of the target texels.

[0072] 302. Determine stroke information based on the target texel and the depth value corresponding to the associated texel.

[0073] In the embodiment of the present invention, the outline of the game object is a graphic area that occupies a certain number of pixels, and the target texel is a texel base point used as a positioning graphic area. In order to draw a complete outline, it is also necessary to expand the outline area based on the target texel and in combination with the associated texel of the target texel to determine the outline area information of a larger range. Among them, the associated texel is a texel that has an inner and outer circle position relationship with the target texel. For example, the current target texel is texel A, then with texel A as the center, a circle is drawn according to a smaller first preset radius to obtain circle a, and a circle is drawn according to a larger second preset radius to obtain circle b. The texels in circle a or the texels passed by circle a are associated texels that have an inner circle position relationship with texel A; the texels in circle b or the texels passed by circle b are associated texels that have an outer circle position relationship with texel A. After determining the associated texels, due to the sampling of the target texels and the determination of the associated texels, the pixel points are screened from the perspective of the plane adjacency relationship of the pixels in the picture, but the pixel points are not screened from the dimension of the picture depth. For example, the texture pixels at the edge of the game object can be visible edges or occluded areas; similarly, the associated texels that satisfy the plane distance relationship with the target texel can be areas that need to be stroked or parts of the game object that are occluded. Therefore, in order to accurately filter out the areas that need to be outlined, it is also necessary to generate stroke information based on the depth information of the target texel and the associated texel.

[0074] In one embodiment of the present invention, for further explanation and limitation, the step of determining the stroke information based on the target texel and the depth value corresponding to the associated texel includes:

[0075] Under the condition that the depth value is less than or equal to the scene depth value, determining that the target texel and the associated texel are contour texels;

[0076] An interpolation calculation is performed on the contour texels, and a contour position is determined based on the interpolated contour texels, and stroke information is generated based on the contour color, contour width, and the contour position.

[0077] In an embodiment of the present invention, the depth information records the depth values ​​corresponding to different texels in the form of a depth map. The depth value in the picture is used to characterize the distance from the camera. The larger the depth value, the farther the distance from the camera, and the smaller the depth value, the closer the distance from the camera. If the depth value corresponding to the current target texel or the associated texel is greater than the depth value of the current scene, it indicates that the current pixel is blocked and does not need to be stroked, then the corresponding target texel or the associated texel is filtered out, and only the target texel and the associated texel with a depth value greater than or equal to the scene depth value are retained as the contour texels that constitute the stroke contour. Among them, the scene depth value can be a custom configuration value of the current scene depth, or it can be obtained by performing depth extraction on the current scene, which is not specifically limited in the embodiment of the present invention.

[0078] After determining the contour texel, since the target texel is the sampling pixel point of the game object, it has intervals and discontinuities, and the associated texels associated with it also have the above characteristics. Therefore, it is necessary to perform interpolation calculations on the contour texels to improve the smoothness of the contour curve.

[0079] It should be noted that by screening the target texels and associated texels based on the depth value, the blocked invalid stroke pixels can be effectively filtered out, the integration of the game object and the entire game screen scene can be enhanced, and the accuracy of the stroke can be improved. In addition, interpolation calculation of the outline texels can improve the accuracy of the outline texels, making the outline drawing effect smoother, thereby improving the visual quality of the stroke.

[0080] In one embodiment of the present invention, for further explanation and limitation, the method further includes:

[0081] Obtaining the radii of the inner circle texels and the outer circle texels, and determining the upper texel, the lower texel, the left texel, the right texel, the upper left texel, the lower left texel, the upper right texel, and the lower right texel based on the radii;

[0082] The total texel values ​​of the texel directly above, the texel directly below, the texel directly to the left, the texel directly to the right, the upper left texel, the lower left texel, the upper right texel, and the lower right texel are calculated by texel weights, and the contour width is determined based on the total texel value.

[0083] In the embodiment of the present invention, the associated texels include inner circle texels and outer circle texels. The inner circle texels are determined based on the radius of the inner circle texels with the target texel as the center, including the upper texel directly above the target texel, the lower texel directly below, the left texel directly on the horizontal left, and the right texel directly on the horizontal right. The outer circle texels are determined based on the radius of the outer circle texels with the target texel as the center, such as Figure 4 As shown, it includes the upper left texel, the lower left texel, the upper right texel, and the lower right texel, which are located in the upper left, lower left, upper right, and lower right diagonal directions of the target texel. Among them, the radius of the inner circle texel is smaller than the radius of the outer circle texel, and the radius of the inner circle texel is larger than 1 / 2 of the pixel diagonal size. The specific radius value can be customized according to actual application requirements, and the embodiment of the present invention does not make specific limitations. The texel weight includes the inner circle texel weight and the outer circle texel weight. Based on the inner circle texel weight and the outer circle texel weight, the weight matrix corresponding to the target texel and the upper texel, the lower texel, the left texel, the right texel, the upper left texel, the lower left texel, the upper right texel, and the lower right texel can be determined. For example, the inner circle texel weight is n, the outer circle texel weight is m, and the target texel weight is x, then the texel weight matrix is:

[0084]

[0085] Different texels are multiplied by the corresponding texel weights in the matrix, and the products of each texel and the weight are summed to obtain the total texel value. The texel weight can be determined based on the size of the pixel area occupied by the game object. For example, for a game object with a larger pixel area, a larger weight can be configured for the outer circle texel, and a smaller weight can be configured for the inner circle texel, so that the contour width is larger and the contour line is thicker; for a game object with a smaller pixel area, a smaller weight can be configured for the outer circle texel, and a larger weight can be configured for the inner circle texel, so that the contour width is smaller and the contour line is thinner. The texel weight can also be determined based on the depth information of the contour texel. For example, the larger the depth value of the wheel pixel, the smaller the weight configuration of the outer circle texel, and the larger the weight configuration of the outer circle texel; the smaller the depth value of the wheel pixel, the larger the weight configuration of the outer circle texel, and the smaller the weight configuration of the outer circle texel, which is not specifically limited in the embodiment of the present invention. After determining the total texel value, the total texel value can be used as the contour width, or an adjustment coefficient can be configured, and the product of the adjustment coefficient and the total texel value can be used as the contour width.

[0086] It should be noted that by dividing the associated texels into inner circle texels and outer circle texels, and configuring corresponding texel weights for texels in different circles, it is equivalent to calculating the contour width based on a two-layer operator. By adjusting the configuration parameters of texel weights in different circles, the stroke thickness can be flexibly adjusted to improve the matching degree between the contour line and the game object, thereby improving the quality of contour drawing.

[0087] In one embodiment of the present invention, for further explanation and limitation, the step of drawing the stroke information through the contour transparency hybrid model to obtain the contour of the game object includes:

[0088] Determine the outline transparency of the outline color, and calculate the drawing color corresponding to the outline color, the outline transparency and the scene color based on the outline transparency blending model;

[0089] The outline of the game object is obtained by drawing according to the drawing color and the stroke information through a shader.

[0090] In the embodiment of the present invention, the contour transparency blending model is constructed based on Alpha blending. This model can be used to solve the contour drawing color. The drawing color is set to drColor, and the formula is:

[0091] drColor=srcAlpha*srcColor+(1-srcAlpha)*desColor;

[0092] Among them, srcAlpha is the alpha value of the stroke; srcColor is the color value of the stroke; desColor is the screen background color, that is, the scene color value. Among them, the outline transparency can be determined based on information such as the object category of the game object and the scene category of the game screen. For example, the outline transparency of the game character is less than the outline transparency of the rock; the outline transparency of the water scene is less than the outline transparency of the land scene. It can be customized according to specific application requirements, and the embodiment of the present invention does not make specific limitations. After determining the drawing color, the shader is used to complete the drawing of the game object outline according to the color information of the drawing color and the texel information in the stroke information. The outline color, outline transparency and scene color are superimposed on the transparency and color through the outline transparency hybrid model to determine the outline drawing color, which realizes the fusion of the individual outline of the game object and the overall color of the scene, so that the color of the outline is more in line with the scene of the entire game screen, and the color transition is more natural, thereby effectively improving the picture quality of the outline drawing.

[0093] In one embodiment of the present invention, for further explanation and limitation, the method further includes:

[0094] The outline color is linearly attenuated according to the depth value of the outline texel, so as to update the stroke information with the linearly attenuated outline color.

[0095] In the embodiment of the present invention, in order to make the contour color more consistent with the visual principle that the color decays as the depth value increases, and to obtain a more realistic and vivid picture, the contour color is linearly decayed based on the depth value of the contour texel, so that the contour color becomes lighter as the depth value increases, thereby making the contour present a more natural transition effect. In addition, the color gradient can also be realized by exponentially decaying the contour color based on the depth value of the contour texel. After testing and verification, the linear decay processing effect is better than the exponential decay processing.

[0096] In one embodiment of the present invention, for further explanation and limitation, before the step of storing the depth information of the game object as a depth texture map, the method further includes:

[0097] Determine a game object to be outlined in a game scene, and configure a layer mask for the game object to store depth information of the game object as a depth texture map when rendering the game object.

[0098] In the embodiment of the present invention, the game object to be outlined in the game scene can be determined based on the primary and secondary relationship of the game object in the screen presentation, for example, the game character controlled by the game player, the ship occupying a large area of ​​the screen, etc. In order to highlight this game object in the game scene, it can be configured as the game object to be outlined. It can also be based on the distance relationship of the game object. For example, in the game scene displayed by the camera perspective from behind the rock, the rock is the closest game object in the entire game scene, so it is configured as the game object to be outlined. The game object to be outlined can also be determined based on the specific scene requirements, which is not specifically limited in the embodiment of the present invention.

[0099] It should be noted that in order to distinguish the game objects that need to be outlined from the full-screen game scene during the object rendering process, and store the depth information of the game objects in the depth texture map, a layer mask (rendering layer mask) is configured in advance for the game objects that will be outlined. Through the configuration of this layer mask, the game objects that need to be outlined can be accurately identified from the game scene, avoiding the need to outline each game object that needs to be outlined one by one. After determining the stroke information and outline color, only one screen drawing is required to complete the drawing of all the game objects to be outlined on the screen, which greatly improves the outline efficiency and reduces resource consumption and terminal device rendering pressure.

[0100] As a specific implementation scenario of the embodiment of the present invention, it can be based on the following Figure 5 The flowchart shown is used to stroke the outer contour of the game object (stroked object). Specifically, a layer mask layer is set for the stroked object in the game scene, and then a custom depth texture is rendered. At the same time, the depth sampling result is obtained by calculating the texel coordinates based on the rendered custom depth texture. In the post-processing stage, image detection is performed on the depth sampling result and the custom depth texture to obtain the target texel and the associated texel. A depth test is performed on the texel based on the scene depth value (the depth value corresponding to the texel is greater than the scene depth value, the test fails, and the depth value corresponding to the texel is less than or equal to the scene depth value, and the test passes). If the test fails, the corresponding pixel (texel) is deleted. If the test passes, the stroke adjustment is performed based on the texel that passed the test, and the drawing of the stroke is completed by setting the blending mode of the contour transparency blending model.

[0101] The present invention provides a method for drawing the outline of a game object. First, under the condition that the game object to be rendered is configured with a layer mask, the depth information of the game object is stored in a depth texture map, and the depth texture map is obtained by image processing of all game scenes within the visible range of the screen; under the condition that the game object is rendered, multiple target texels are sampled from the depth texture map, and stroke information is determined based on the target texels; the stroke information is drawn through a contour transparency hybrid model to obtain the outline of the game object, and the contour transparency hybrid model is used to characterize the method of drawing based on transparency color overlap factors. Compared with the prior art, the embodiment of the present invention marks the game objects that need to be outlined based on the layer mask, so that the game objects that are outlined at a single time are not limited to one, and the outline drawing of multiple game objects is completed by one screen rendering, which greatly reduces the rendering pressure and performance consumption of the terminal device and ensures a high running frame rate. At the same time, by storing the depth information of the game object in the depth texture map obtained by image processing of the entire game scene within the visible range of the screen, and determining the stroke information based on the scene depth texture, transparency color fusion technology and image detection technology, the accuracy and uniformity of the outline drawing are ensured, thereby ensuring the effectiveness of the outline drawing of the game object.

[0102] Furthermore, as a response to the above Figure 1 The embodiment of the present invention provides a device for drawing the outline of a game object, such as Figure 6 As shown, the device comprises:

[0103] The storage module 61 is used to store the depth information of the game object as a depth texture map under the condition that the game object to be rendered is configured with a layer mask;

[0104] A determination module 62, configured to sample a plurality of target texels obtained from the depth texture map under the condition of performing scene rendering on the game object, and determine stroke information based on the target texels;

[0105] The drawing module 63 is used to draw the stroke information through a contour transparency hybrid model to obtain the contour of the game object.

[0106] Further, the determination module 62 includes:

[0107] A sampling unit, configured to sample a plurality of the target texels from the depth texture map, and obtain an associated texel of the target texel, wherein the associated texel is a texel having an inner and outer circle position relationship with the target texel;

[0108] A determination unit is used to determine stroke information based on the target texel and the depth value corresponding to the associated texel.

[0109] Further, in a specific application scenario, the determining unit is specifically used to determine that the target texel and the associated texel are contour texels under the condition that the depth value is less than or equal to the scene depth value;

[0110] An interpolation calculation is performed on the contour texels, and a contour position is determined based on the interpolated contour texels, and stroke information is generated based on the contour color, contour width, and the contour position.

[0111] Furthermore, the device also includes:

[0112] an acquisition module, configured to acquire the radii of the inner circle texels and the outer circle texels, and determine the upper texel, the lower texel, the left texel, the right texel, the upper left texel, the lower left texel, the upper right texel, and the lower right texel based on the radii;

[0113] A calculation module is used to calculate the total texel value of the texel directly above, the texel directly below, the texel directly to the left, the texel directly to the right, the texel directly to the upper left, the texel directly to the lower left, the texel directly to the upper right, and the texel directly to the lower right through the texel weights, and determine the contour width based on the total texel value.

[0114] Furthermore, the drawing module 63 includes:

[0115] a calculation unit, configured to determine the outline transparency of the outline color, and calculate a drawing color corresponding to the outline color, the outline transparency, and the scene color based on an outline transparency hybrid model;

[0116] A drawing unit is used to draw according to the drawing color and the stroke information through a shader to obtain the outline of the game object.

[0117] Furthermore, the device also includes:

[0118] The processing module is used to perform linear attenuation processing on the outline color according to the depth value of the outline texel, so as to update the stroke information through the linearly attenuated outline color.

[0119] Furthermore, the device also includes:

[0120] A configuration module is used to determine a game object whose outline is to be drawn in a game scene, and configure a layer mask for the game object so as to store the depth information of the game object as a depth texture map when rendering the game object.

[0121] The present invention provides a device for drawing the outline of a game object. First, under the condition that the game object to be rendered is configured with a layer mask, the depth information of the game object is stored in a depth texture map, and the depth texture map is obtained by image processing of all game scenes within the visible range of the screen; under the condition that the game object is rendered, multiple target texels are sampled from the depth texture map, and stroke information is determined based on the target texels; the stroke information is drawn through a contour transparency hybrid model to obtain the outline of the game object, and the contour transparency hybrid model is used to characterize the method of drawing based on transparency color overlap factors. Compared with the prior art, the embodiment of the present invention marks the game objects that need to be outlined based on the layer mask, so that the game objects that are outlined at a single time are not limited to one, and the outline drawing of multiple game objects is completed by one screen rendering, which greatly reduces the rendering pressure and performance consumption of the terminal device and ensures a high running frame rate. At the same time, by storing the depth information of the game object in the depth texture map obtained by image processing of the entire game scene within the visible range of the screen, and determining the stroke information based on the scene depth texture, transparency color fusion technology and image detection technology, the accuracy and uniformity of the outline drawing are ensured, thereby ensuring the effectiveness of the outline drawing of the game object.

[0122] According to an embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the method for drawing the outline of a game object in any of the above method embodiments.

[0123] Figure 7 A schematic diagram of the structure of a terminal provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the terminal.

[0124] like Figure 7 As shown, the terminal may include: a processor (processor) 702 , a communication interface (Communications Interface) 704 , a memory (memory) 706 , and a communication bus 708 .

[0125] The processor 702 , the communication interface 704 , and the memory 706 communicate with each other via a communication bus 708 .

[0126] The communication interface 704 is used to communicate with other devices such as clients or other servers.

[0127] The processor 702 is used to execute the program 710, and specifically can execute the relevant steps in the above-mentioned embodiment of the method for drawing the outline of the game object.

[0128] Specifically, the program 710 may include program codes, which include computer operation instructions.

[0129] The processor 702 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiment of the present invention. The one or more processors included in the terminal may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0130] The memory 706 is used to store the program 710. The memory 706 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0131] The program 710 may be specifically configured to enable the processor 702 to perform the following operations:

[0132] Under the condition that the game object to be rendered is configured with a layer mask, the depth information of the game object is stored in a depth texture map, where the depth texture map is obtained by image processing of all game scenes within the visible range of the screen;

[0133] Under the condition of performing scene rendering on the game object, sampling a plurality of target texels obtained from the depth texture map, and determining stroke information based on the target texels;

[0134] The stroke information is drawn using a contour transparency hybrid model to obtain the contour of the game object. The contour transparency hybrid model is used to characterize a method for drawing based on transparency and color overlapping factors.

[0135] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0136] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for drawing the outline of a game object, characterized in that: include: Under the condition that the game object to be rendered is configured with a layer mask, the depth information of the game object is stored in a depth texture map, where the depth texture map is obtained by image processing of all game scenes within the visible range of the screen; Under the condition of performing scene rendering on the game object, sampling a plurality of target texels obtained from the depth texture map, and determining stroke information based on the target texels; The stroke information is drawn using a contour transparency hybrid model to obtain the contour of the game object. The contour transparency hybrid model is used to characterize a method for drawing based on transparency and color overlapping factors.

2. The method according to claim 1, characterized in that The sampling of the depth texture map to obtain a plurality of target texels and determining the stroke information based on the target texels includes: Sampling a plurality of the target texels from the depth texture map, and acquiring associated texels of the target texels, wherein the associated texels are texels having inner and outer circle positional relationships with the target texels; The stroke information is determined based on the target texel and the depth value corresponding to the associated texel.

3. The method according to claim 2, characterized in that The determining of the stroke information based on the target texel and the depth value corresponding to the associated texel comprises: Under the condition that the depth value is less than or equal to the scene depth value, determining that the target texel and the associated texel are contour texels; An interpolation calculation is performed on the contour texels, and a contour position is determined based on the interpolated contour texels, and stroke information is generated based on the contour color, contour width, and the contour position.

4. The method according to claim 2, characterized in that: The associated texels include inner circle texels and outer circle texels, the inner circle texels include the texels directly above, directly below, directly to the left, and directly to the right of the target texel, and the outer circle texels include the upper left texel, the lower left texel, the upper right texel, and the lower right texel, and the method further includes: Obtaining the radii of the inner circle texels and the outer circle texels, and determining the upper texel, the lower texel, the left texel, the right texel, the upper left texel, the lower left texel, the upper right texel, and the lower right texel based on the radii; The total texel values ​​of the texel directly above, the texel directly below, the texel directly to the left, the texel directly to the right, the upper left texel, the lower left texel, the upper right texel, and the lower right texel are calculated by texel weights, and the contour width is determined based on the total texel value.

5. The method according to claim 3, characterized in that: Drawing the stroke information by using the contour transparency hybrid model to obtain the contour of the game object includes: Determine the outline transparency of the outline color, and calculate the drawing color corresponding to the outline color, the outline transparency and the scene color based on the outline transparency blending model; The outline of the game object is obtained by drawing according to the drawing color and the stroke information through a shader.

6. The method according to claim 3, characterized in that: The method further comprises: The outline color is linearly attenuated according to the depth value of the outline texel, so as to update the stroke information with the linearly attenuated outline color.

7. The method according to any one of claims 1 to 6, characterized in that: Before storing the depth information of the game object as a depth texture map, the method further includes: Determine a game object to be outlined in a game scene, and configure a layer mask for the game object to store depth information of the game object as a depth texture map when rendering the game object.

8. A device for drawing the outline of a game object, characterized in that: include: A storage module, used for storing the depth information of the game object as a depth texture map under the condition that the game object to be rendered is configured with a layer mask; A determination module, configured to sample a plurality of target texels obtained by the depth texture map under the condition of performing scene rendering on the game object, and determine stroke information based on the target texels; A drawing module is used to draw the stroke information through a contour transparency hybrid model to obtain the contour of the game object.

9. A storage medium storing at least one executable instruction, wherein the executable instruction enables a processor to execute operations corresponding to the method for drawing the outline of a game object as described in any one of claims 1 to 7.

10. A terminal, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the method for drawing the outline of a game object as described in any one of claims 1-7.