Virtual character display method and device, equipment and medium

By setting template values ​​for 3D virtual characters and conducting template testing, the occlusion relationship was determined, which solved the problem of virtual characters penetrating the display in a 3D environment and improved the visual effect.

CN120919630APending Publication Date: 2025-11-11TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410600876.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-11
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

In a 3D virtual environment, virtual characters may exhibit a display penetration problem, resulting in poor visual effects.

Method used

Set template values ​​for each virtual character, determine occlusion relationships through template testing, and selectively render virtual characters to avoid displaying through them.

Benefits of technology

This effectively avoids the 3D models of virtual characters from showing through at overlapping areas, thus improving the visual effect of the 3D virtual environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120919630A_ABST
    Figure CN120919630A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual character display method and device, equipment and a medium, and belongs to the technical field of image rendering. The method comprises the following steps: respectively setting template values for different virtual characters in a three-dimensional virtual environment, wherein the different virtual characters comprise a first virtual character and a second virtual character; under the condition that the first virtual character and the second virtual character are overlapped, executing a template test based on a first template value corresponding to the first virtual character and a second template value corresponding to the second virtual character so as to determine a shielding relationship between the first virtual character and the second virtual character; and rendering the first virtual character and the second virtual character according to the occlusion relationship to obtain a display frame. According to the method, different virtual characters can be selectively rendered by determining the shielding relation between the different virtual characters when the different virtual characters are overlapped, and display abnormity can be effectively avoided when the different virtual characters are overlapped.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image rendering technology, and in particular to a method, apparatus, device, and medium for displaying virtual characters. Background Technology

[0002] In most side-scrolling games, the game environment is usually two-dimensional, and different virtual characters in the two-dimensional virtual environment can only move on a two-dimensional plane.

[0003] When two virtual characters overlap, they will be displayed according to a fixed rule. For example, if the fixed rule is that the display priority of the first virtual character is higher than that of the second virtual character, then when the first and second virtual characters overlap, the first virtual character will be displayed first at the point of overlap.

[0004] However, when the virtual environment of a side-scrolling game changes from two-dimensional to three-dimensional, the two virtual characters overlap, that is, the three-dimensional models corresponding to the two virtual characters overlap. At this time, the three-dimensional models corresponding to the two virtual characters may appear to pass through each other at the point of overlap, which is the phenomenon of "clipping". Summary of the Invention

[0005] This application provides a method, apparatus, device, and storage medium for displaying virtual characters. The technical solution is as follows:

[0006] According to one aspect of this application, a method for displaying a virtual character is provided, the method being performed by a computer device, the method comprising:

[0007] Template values ​​are set for different virtual characters in a three-dimensional virtual environment, including a first virtual character and a second virtual character.

[0008] In the case where the first virtual character and the second virtual character overlap, a template test is performed based on the first template value corresponding to the first virtual character and the second template value corresponding to the second virtual character to determine the occlusion relationship between the first virtual character and the second virtual character.

[0009] Based on the occlusion relationship, the first virtual character and the second virtual character are rendered to obtain a display frame.

[0010] According to another aspect of this application, a display device for a virtual character is provided, the device comprising:

[0011] A template is set to set template values ​​for different virtual characters in a 3D virtual environment, including a first virtual character and a second virtual character.

[0012] The determination module is used to perform template testing based on the first template value corresponding to the first virtual character and the second template value corresponding to the second virtual character when the first virtual character and the second virtual character overlap, so as to determine the occlusion relationship between the first virtual character and the second virtual character.

[0013] The rendering module is used to render the first virtual character and the second virtual character to obtain display frames based on the occlusion relationship.

[0014] According to another aspect of this application, a computer device is provided, the computer device comprising: a processor and a memory, the memory storing at least one program, the at least one program being loaded and executed by the processor to implement the virtual character display method as described above.

[0015] According to another aspect of this application, a computer-readable storage medium is provided, which stores at least one program that is loaded and executed by a processor to implement the virtual character display method as described above.

[0016] According to another aspect of this application, a computer program product is provided, comprising at least one program segment stored in a computer-readable storage medium; a processor of a computer device reads the at least one program segment from the computer-readable storage medium, and the processor executes the at least one program segment, causing the computer device to perform the virtual character display method as described above.

[0017] The beneficial effects of the technical solution provided in this application include at least the following:

[0018] In a 3D virtual environment with at least two virtual characters, by setting different template values ​​for each virtual character, the occlusion relationship between the 3D models of multiple virtual characters can be determined based on the template values ​​of each virtual character when their respective 3D models overlap. Then, based on the established occlusion relationship between the 3D models of multiple virtual characters, selective rendering is performed on the overlapping areas to avoid the 3D models of multiple virtual characters penetrating each other at the overlapping points. For example, when the occlusion relationship between the first and second virtual characters is that the first virtual character occludes in front of the second virtual character, only the first virtual character can be rendered at the overlapping area, while the second virtual character is not rendered, thus preventing the first 3D model corresponding to the first virtual character and the second 3D model corresponding to the second virtual character from penetrating each other at the overlapping area. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic diagram of a virtual character display method provided in an exemplary embodiment of this application;

[0021] Figure 2 This is a schematic diagram of a virtual character display method provided in an exemplary embodiment of this application;

[0022] Figure 3 This is a schematic diagram of a computer system provided in an exemplary embodiment of this application;

[0023] Figure 4 This is a flowchart illustrating a method for displaying a virtual character provided in an exemplary embodiment of this application;

[0024] Figure 5 This is a schematic diagram of a virtual character display method provided in an exemplary embodiment of this application;

[0025] Figure 6 This is a schematic diagram of a virtual character display method provided in an exemplary embodiment of this application;

[0026] Figure 7 This is a flowchart illustrating a method for displaying a virtual character provided in an exemplary embodiment of this application;

[0027] Figure 8 This is a flowchart illustrating a method for displaying a virtual character provided in an exemplary embodiment of this application;

[0028] Figure 9 This is a schematic diagram of a virtual character display method provided in an exemplary embodiment of this application;

[0029] Figure 10 This is a block diagram of a virtual character display device provided in an exemplary embodiment of this application;

[0030] Figure 11 This is a block diagram of a computer device provided in an exemplary embodiment of this application. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0032] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0033] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0034] It should be noted that the object information (including but not limited to object device information, object personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the object or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0035] It should be understood that although the terms first, second, etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, a first parameter may also be referred to as a second parameter, and similarly, a second parameter may also be referred to as a first parameter. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0036] First, a brief introduction to the terms used in the embodiments of this application:

[0037] Side-scrolling games: Games where the movement of the game character is controlled within a horizontal plane. In side-scrolling games, the movement of the game character (the main virtual character) is entirely or mostly horizontal. Based on content, side-scrolling games can be categorized into side-scrolling platformers, side-scrolling adventurers, side-scrolling action games, and side-scrolling strategy games; based on technology, they can be divided into 2D side-scrolling games and 3D side-scrolling games.

[0038] Virtual environment: This refers to the virtual environment displayed (or provided) by an application when it runs on a terminal. This virtual environment can be a simulation of the real world, a semi-simulated / semi-fictional environment, or a purely fictional environment. The virtual environment can be any of a two-dimensional, 2.5-dimensional, or three-dimensional virtual environment; this application does not limit it to any particular type. The following embodiments use a three-dimensional virtual environment as an example. Optionally, this virtual environment can be a battle environment for virtual characters.

[0039] Virtual character: refers to an actionable object that a player plays in a virtual world. The main virtual character can be a virtual person, virtual animal, anime character, etc., such as a person or animal displayed in a 3D virtual world. Optionally, the main virtual character is a 3D model created based on animation skeletal technology. Each main virtual character has its own shape and volume in the 3D virtual world and occupies a portion of the space within that world.

[0040] A stencil is a graphics processing technique that helps achieve specific rendering effects, such as masks, outlines, and shadows. Simply put, a stencil is like a "pattern template" that determines which pixels need to be rendered and which do not.

[0041] Stencil Buffer: In Unreal Engine 4 (UE4), a stencil buffer is used to store the stencil value for each pixel. The stencil buffer works in conjunction with the depth buffer to enable more efficient pixel processing during rendering.

[0042] Template testing: The template value in the template buffer is compared with the template reference value. If the template value in the template buffer and the template reference value meet the test configuration requirements, the template test is considered to have passed; otherwise, the template test is considered to have failed. The test configuration requirements can be arbitrary, such as the template value in the template buffer being greater than the template reference value, or the template value in the template buffer being greater than or equal to the template reference value, or the template value in the template buffer being less than the template reference value, and so on.

[0043] Depth Buffer: In UE, a depth buffer is used to store the depth information of each pixel. The purpose of the depth buffer is to record the depth value of each pixel during rendering for reference and comparison in subsequent processing.

[0044] Mesh: Also known as a polygonal mesh, it is a collection of vertices, edges and faces that make up a 3D object. Each vertex in a polygonal mesh stores information about the 3D coordinates x, y and z, and each face contains surface information. By defining the vertices of each polygonal face and the connection relationships between vertices, many triangular or quadrilateral faces can be obtained, and these faces can be used to approximate the model effect of the object.

[0045] Overlap: This refers to the stacking or intersection of different 3D models corresponding to different virtual characters. For example, in the case of overlap between the first virtual character and the second virtual character, it means that at least one part of the first 3D model corresponding to the first virtual character and the second 3D model corresponding to the second virtual character overlaps or intersects.

[0046] In related technologies, the virtual game environment corresponding to most side-scrolling games is typically two-dimensional. For example... Figure 1 As shown, the virtual characters in the game move on a two-dimensional plane. For example, taking the plane as the display screen of the first terminal 120 used by the first user, the first user has a first account logged in on the first terminal 120 to control the first virtual character 10 corresponding to the first account. It should be understood that the virtual characters moving in the two-dimensional virtual environment are also two-dimensional, and each virtual character corresponds to its own two-dimensional model. For example, the first virtual character 10 corresponds to a first two-dimensional model.

[0047] In some embodiments, the two-dimensional virtual environment includes one or more virtual characters. This application embodiment uses multiple virtual characters as an example. For instance, it includes a first virtual character 10 and a second virtual character 20. From the perspective of the virtual characters, the first virtual character 10 / second virtual character 20 can move forward and backward along the x-axis and jump up and down along the z-axis. Or, from the user's perspective, the first virtual character 10 / second virtual character 20 can move left and right along the x-axis and jump up and down along the z-axis.

[0048] In some embodiments, the side-scrolling game is displayed in units of display frames. When the virtual character's position moves, different display frames are displayed to follow the virtual character's movement. For example, a first display frame 11 is displayed at a first moment, and a second display frame 12 is displayed at a second moment when the first virtual character 10 moves from a first position to a second position. The first position corresponds to the position in the first display frame 11, and the second position corresponds to the position in the second display frame 12.

[0049] In some embodiments, when at least two virtual characters overlap in a two-dimensional virtual environment, that is, when the two-dimensional models corresponding to at least two virtual characters overlap, the two-dimensional models of the overlapping virtual characters will be sorted and displayed according to a fixed rule. For example, such as... Figure 1 As shown, assuming the fixed rule is that the display priority of the first virtual character 10 is higher than that of the second virtual character 20, when the first two-dimensional model corresponding to the first virtual character 10 and the second two-dimensional model corresponding to the second virtual character 20 overlap, the first virtual character 10 will be displayed first at the overlapping point.

[0050] In some embodiments, when the virtual environment of a side-scrolling game changes from two-dimensional to three-dimensional, such as Figure 2 As shown, virtual characters in the game move within a three-dimensional space. In this three-dimensional virtual environment, the virtual characters themselves are also three-dimensional, each corresponding to its own three-dimensional model. For example, Figure 2 In this model, the first virtual character 10 corresponds to the first 3D model, and the second virtual character 20 corresponds to the second 3D model. From the perspective of the virtual characters, the first virtual character 10 / second virtual character 20 can move forward and backward along the x-axis, move left and right along the y-axis, and jump up and down along the z-axis. Alternatively, from the user's perspective, the first virtual character 10 / second virtual character 20 can move left and right along the x-axis, move forward and backward along the y-axis, and jump up and down along the z-axis.

[0051] In some embodiments, when at least two virtual characters overlap in a 3D virtual environment, that is, when the 3D models corresponding to at least two virtual characters overlap, it is possible that at least two virtual characters will appear to penetrate each other at the point of overlap. For example, as shown below... Figure 2 As shown, when the first 3D model corresponding to the first virtual character 10 and the second 3D model corresponding to the second virtual character 20 overlap, the first virtual character 10 and the second virtual character 20 are displayed through each other. Figure 2 As shown, the first virtual character 10 and the second virtual character 20 are displayed overlapping each other within region 21. At this time, the overall visual effect of the side-scrolling game is poor. To solve the problem of overlapping 3D models corresponding to different virtual characters in a 3D virtual environment, this application provides a method for displaying virtual characters, the specific implementation of which is described below.

[0052] Figure 3 A structural block diagram of a computer system provided in an exemplary embodiment of this application is shown. The computer system 100 includes: a first terminal 120, a server 140, and a second terminal 160.

[0053] The first terminal 120 has a client 122 installed and running that supports a 3D virtual environment. The client 122 supporting the 3D virtual environment can be any of the following: a 3D map program, a shooting game, an adventure game, a fighting game, a virtual reality (VR) application, or an augmented reality (AR) program. The first terminal 120 is the terminal used by the first user, who uses the first terminal 120 to control a first virtual character located in the 3D virtual environment to perform activities, including: adjusting body posture, walking, running, jumping, riding, driving, aiming, picking up, using throwable items, and attacking other virtual characters. For example, the first virtual character is a virtual person, such as a simulated character or an anime character. For example, the first user controls the first virtual character's activities through user interface (UI) controls on the virtual environment screen.

[0054] The first terminal 120 is connected to the server 140 via a wireless network or a wired network.

[0055] Server 140 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Exemplarily, server 140 includes a processor 144 and a memory 142. Memory 142 includes a receiving module 1421, a control module 1422, and a sending module 1423. The receiving module 1421 receives requests sent by clients; the control module 1422 controls the rendering of display frames, which include at least a 3D virtual environment and virtual characters within that environment; the sending module 1423 sends responses to clients, such as sending display frames. Server 140 provides background services to clients supporting 3D virtual environments. Optionally, server 140 undertakes the primary computational work, while the first terminal 120 and the second terminal 160 undertake secondary computational work; or, server 140 undertakes secondary computational work, while the first terminal 120 and the second terminal 160 undertake primary computational work; or, server 140, the first terminal 120, and the second terminal 160 collaborate using a distributed computing architecture.

[0056] The second terminal 160 has a client 162 installed and running that supports a 3D virtual environment. The client 162 supporting the 3D virtual environment can be any of the following: a 3D map program, a shooting game, an adventure game, a fighting game, a VR application, or an AR program. The second terminal 160 is a terminal used by a second user. The second user uses the second terminal 160 to control a second virtual character located in the 3D virtual environment to perform activities, including: adjusting body posture, walking, running, jumping, riding, driving, aiming, picking up, using throwable items, and attacking other virtual characters. For example, the second virtual character is a virtual person, such as a realistic character or an anime character. For example, the second user controls the second virtual character's activities through user interface (UI) controls on the virtual environment screen.

[0057] Optionally, the first virtual character and the second virtual character reside in the same three-dimensional virtual environment. Optionally, the first virtual character and the second virtual character can belong to the same team, the same organization, the same faction, have a friend relationship, or have temporary communication permissions. Optionally, the first virtual character and the second virtual character can also belong to different factions, different teams, different organizations, or have an adversarial relationship.

[0058] Optionally, the applications installed on the first terminal 120 and the second terminal 160 are the same, or the applications installed on the two terminals are the same type of application on different operating system platforms. The first terminal 120 can refer to one of multiple terminals, and the second terminal 160 can refer to one of multiple terminals; this application only uses the first terminal 120 and the second terminal 160 as examples. The device types of the first terminal 120 and the second terminal 160 may be the same or different, and these device types include at least one of: smartphones, tablet computers, e-book readers, laptops, and desktop computers. This application uses smartphones as an example of a terminal.

[0059] Those skilled in the art will understand that the number of terminals described above can be more or less. For example, there may be only one terminal, or there may be dozens or hundreds of terminals, or even more. This application does not limit the number of terminals or the type of device.

[0060] Figure 4 This is a schematic diagram of a method for displaying a virtual character provided in an exemplary embodiment of this application. The method is... Figure 1 The server 140 shown executes this method, which includes:

[0061] Step 220: Set template values ​​for different virtual characters in the 3D virtual environment;

[0062] In some embodiments, the three-dimensional virtual environment includes at least two virtual characters, each of which can move freely within the three-dimensional virtual environment. For example, the different virtual characters include a first virtual character and a second virtual character.

[0063] In some embodiments, the virtual characters in the 3D virtual environment are also 3D, and each virtual character corresponds to a 3D model. For example, the first virtual character corresponds to a first 3D model, and the second virtual character corresponds to a second 3D model.

[0064] In some embodiments, the first virtual character and the second virtual character are controlled by different users on different terminals. For example, the first virtual character is controlled by a first user on a first terminal, and the second virtual character is controlled by a second user on a second terminal. In some embodiments, the first and second virtual characters are controlled by the same user on the same terminal. For example, both the first and second virtual characters are controlled by the first user on the first terminal. In some embodiments, the first virtual character is controlled by the user on the terminal, and the second virtual character is automatically controlled by the terminal. This embodiment does not impose limitations on these embodiments.

[0065] In some embodiments, template values ​​are set for each virtual character in the 3D virtual environment, on a per-character basis. For example, a first template value is set for a first virtual character, and a second template value is set for a second virtual character. In some embodiments, each virtual character in the 3D virtual environment is considered as a mesh model. Each mesh model is a basic 3D model composed of a series of vertices, faces, materials, textures, etc. Setting template values ​​for each virtual character is equivalent to setting template values ​​for each mesh model. For example, a first template value is set for the first mesh model corresponding to the first virtual character, and a second template value is set for the second mesh model corresponding to the second virtual character.

[0066] In some embodiments, setting a template value for each virtual character can be achieved by setting a template value for each pixel corresponding to the virtual character. In some embodiments, since each virtual character corresponds to at least one pixel, the template value for each virtual character can be understood as a set of template sub-values ​​for the pixels corresponding to the virtual character. For example, assuming the first virtual character corresponds to pixels 1, 2, and 3, then template sub-value 1 is set for pixel 1, template sub-value 2 is set for pixel 2, and template sub-value 3 is set for pixel 3. That is, the first template value for the first virtual character is a set including template sub-value 1, template sub-value 2, and template sub-value 3.

[0067] In some embodiments, the template value is used to indicate the distance between a virtual character (or a mesh model, or a skeletal point of the virtual character, or a point on the mesh model of the virtual character, or a pixel corresponding to the virtual character) and a camera model in a 3D virtual environment. In some embodiments, by using template technology, a template value can be set for each pixel corresponding to the virtual character. For example, Figure 5 As shown, before imaging and displaying the virtual character, the camera model 30 first displays the outline of the virtual character via the rendering plane 22. The area encompassed by the outline of the virtual character includes the pixels corresponding to the virtual character.

[0068] In some embodiments, a first virtual character corresponds to a first rendering plane, and the first rendering plane includes at least pixels corresponding to the first virtual character. A first template value is set for the pixels corresponding to the first virtual character on the first rendering plane. In some embodiments, a second virtual character corresponds to a second rendering plane, and the second rendering plane includes at least pixels corresponding to the second virtual character. A second template value is set for the pixels corresponding to the second virtual character on the second rendering plane.

[0069] For example, such as Figure 5 As shown, template values ​​are set for the pixels corresponding to the virtual character on the rendering plane 22, such as {1,2,3,4,5}. In some embodiments, template default values ​​are set for pixels on the rendering plane other than those corresponding to the virtual character. Optionally, the template default value in UE4 is 0 by default, which means that if the template default value is not explicitly set, the template value of all pixels will be 0. It should be noted that since this application embodiment mainly focuses on how to set the template value of the pixels corresponding to the virtual character, the template values ​​of pixels other than those corresponding to the virtual character are considered as template default values, that is, they will not be rendered. However, in the actual rendering process, the 3D objects corresponding to the pixels other than those corresponding to the virtual character may also be rendered, which is not limited here.

[0070] Step 240: In the case of overlap between the first virtual character and the second virtual character, perform template testing based on the first template value corresponding to the first virtual character and the second template value corresponding to the second virtual character to determine the occlusion relationship between the first virtual character and the second virtual character;

[0071] In some embodiments, different virtual characters in a 3D virtual environment may overlap during activities. That is, the 3D models corresponding to different virtual characters may overlap. For example, Figure 6As shown, the first virtual character 10 and the second virtual character 20 overlap, meaning the first 3D model corresponding to the first virtual character 10 overlaps with the second 3D model corresponding to the second virtual character 20. In this case, a template test is performed based on the first template value corresponding to the first virtual character and the second template value corresponding to the second virtual character. The template test method includes comparing the first template value and the second template value (corresponding to the same pixel). The purpose of the template test is to determine the occlusion relationship between the first virtual character and the second virtual character. Specifically, it is to determine the occlusion relationship between the first 3D model corresponding to the first virtual character and the second 3D model corresponding to the second virtual character.

[0072] In some embodiments, when the first virtual character and the second virtual character overlap, the occlusion relationship between the first virtual character and the second virtual character includes a first occlusion relationship and a second occlusion relationship. Specifically, the first occlusion relationship is that the first virtual character occludes in front of the second virtual character, and the second occlusion relationship is that the second virtual character occludes in front of the first virtual character. More specifically, the first occlusion relationship is that the first 3D model corresponding to the first virtual character occludes in front of the second 3D model corresponding to the second virtual character, and the second occlusion relationship is that the second 3D model corresponding to the second virtual character occludes in front of the first 3D model corresponding to the first virtual character.

[0073] In some embodiments, the overlap between the first and second virtual characters is detected by collision box detection. The collision box continuously detects collisions between different virtual characters in the 3D virtual environment.

[0074] Step 260: Render the first virtual character and the second virtual character to obtain the display frame based on the occlusion relationship.

[0075] In some embodiments, based on the determined occlusion relationship between the first virtual character and the second virtual character, the first 3D model corresponding to the first virtual character and the second 3D model corresponding to the second virtual character are selectively rendered to obtain a display frame including the first virtual character and the second virtual character.

[0076] In some embodiments, when the occlusion relationship between the first virtual character and the second virtual character is a first occlusion relationship, the first virtual character is fully rendered, and the non-overlapping parts of the second virtual character and the first virtual character are also fully rendered to obtain a display frame. That is, when the occlusion relationship between the first virtual character and the second virtual character is a first occlusion relationship, it can be determined that the first 3D model corresponding to the first virtual character is occluded in front of the second 3D model corresponding to the second virtual character. Therefore, during rendering, the non-overlapping parts of the first 3D model corresponding to the first virtual character and the second 3D model corresponding to the second virtual character can be fully rendered, and the overlapping parts of the first 3D model corresponding to the first virtual character and the second 3D model corresponding to the second virtual character can be rendered only for the first virtual character, thereby avoiding the situation where the first 3D model corresponding to the first virtual character and the second 3D model corresponding to the second virtual character have related penetration at the overlapping point.

[0077] In some embodiments, when the occlusion relationship between the first virtual character and the second virtual character is a second occlusion relationship, the second virtual character is fully rendered, and the non-overlapping parts of the first and second virtual characters are also fully rendered to obtain a display frame. That is, when the occlusion relationship between the first and second virtual characters is a second occlusion relationship, it can be determined that the second 3D model corresponding to the second virtual character is occluded in front of the first 3D model corresponding to the first virtual character. Therefore, during rendering, the non-overlapping parts of the first and second 3D models corresponding to the first and second virtual characters can be fully rendered, and the overlapping parts of the first and second 3D models corresponding to the first and second virtual characters can be rendered only for the second virtual character, thereby avoiding any penetration between the first and second 3D models corresponding to the first and second virtual characters at the overlapping point.

[0078] In some embodiments, based on the occlusion relationship between the first virtual character and the second virtual character, the rendered first virtual character and the second virtual character will not be displayed through each other. That is, the first 3D model corresponding to the first virtual character and the second 3D model corresponding to the second virtual character will be displayed according to their respective occlusion relationships. For example, as shown... Figure 6 As shown, the first virtual character 10 is displayed in front of the second virtual character 20, and the first virtual character 10 and the second virtual character 20 do not penetrate each other.

[0079] In summary, the method provided in this embodiment, when there are at least two virtual characters in a 3D virtual environment, sets different template values ​​for each virtual character. This allows for the determination of occlusion relationships between the 3D models of multiple virtual characters when their respective 3D models overlap. Based on the established occlusion relationships, selective rendering is performed on the overlapping areas of the 3D models of multiple virtual characters to prevent them from penetrating each other at these points. For example, if the occlusion relationship between the first and second virtual characters is that the first virtual character occludes the second virtual character, only the first virtual character can be rendered at the overlapping area, preventing the first 3D model corresponding to the first virtual character from penetrating the second 3D model corresponding to the second virtual character.

[0080] In some embodiments, the template value for each virtual character is determined based on the distance between each virtual character and a camera model in the 3D virtual environment. Specifically, the template value for each virtual character is determined based on the distance between the 3D model corresponding to each virtual character and the camera model in the 3D virtual environment. Figure 7 This is a schematic diagram of a virtual character display method provided in an exemplary embodiment of this application.

[0081] This method is by Figure 1 The server 140 shown is executed. Step 220 above can be replaced with the following sub-steps:

[0082] Step 221: Set template values ​​for different virtual characters based on the distance between them and the camera model.

[0083] In some embodiments, the 3D virtual environment includes a camera model used to image and display display frames including different virtual characters. For example, Figure 6 As shown, the relative position of the camera model 30 and the 3D virtual environment remains unchanged. When the virtual character in the 3D virtual environment moves along the y-axis, the distance between the virtual character and the camera model 30 changes accordingly. For example, if the first virtual character 10 moves in the positive y-axis direction, the distance between the first virtual character 10 and the camera model 30 decreases; if the first virtual character moves in the negative y-axis direction, the distance between the first virtual character 10 and the camera model 30 increases.

[0084] In some embodiments, a template value is set for each virtual character based on the distance between each virtual character (or mesh model, or skeletal points of the virtual character, or points on the mesh model of the virtual character, or corresponding pixels of the virtual character) and the camera model. Specifically, a template value is set for the corresponding pixels of each virtual character on the rendering plane based on the distance between each virtual character and the camera model.

[0085] In some embodiments, the template value is used to indicate the distance between the virtual character and the camera model, or the template value is used to indicate the distance between the 3D model corresponding to the virtual character and the camera model. In some embodiments, the template value is proportional to the distance. For example, a smaller template value reflects a smaller distance between the virtual character and the camera model; a larger template value reflects a larger distance between the virtual character and the camera model.

[0086] In this application embodiment, the following three methods for setting template values ​​are specifically proposed:

[0087] Method 1: Set template values ​​based on the skeletal points corresponding to the virtual character;

[0088] In some embodiments, the method further includes: for any virtual character in a three-dimensional virtual environment, determining at least one skeletal point corresponding to the virtual character.

[0089] In some embodiments, for any virtual character in a 3D virtual environment, all the skeletal points corresponding to that virtual character are determined. In this case, it can be assumed that the number and types of skeletal points for each virtual character are consistent. For example, assuming that the first virtual character's skeletal points include 22 skeletal points on the head, torso, and limbs, then the second virtual character's skeletal points also include 22 skeletal points on the head, torso, and limbs. Of course, the number and types of skeletal points for different types of virtual characters can also be different.

[0090] In some embodiments, for any virtual character in a 3D virtual environment, partial skeletal points corresponding to that virtual character are determined. Optionally, these partial skeletal points are pre-selected skeletal points. For example, these partial skeletal points are joint points. Optionally, the determined partial skeletal points corresponding to different virtual characters are the same. For example, the determined partial skeletal points corresponding to the first virtual character are limb joint points, and the determined partial skeletal points corresponding to the second virtual character are also limb joint points. Optionally, the determined partial skeletal points corresponding to different virtual characters are different. For example, the determined partial skeletal points corresponding to the first virtual character are limb joint points, and the determined partial skeletal points corresponding to the second virtual character are torso skeletal points. Partial skeletal points corresponding to the needs of each virtual character can be determined according to the specific requirements of each virtual character.

[0091] In some embodiments, for any virtual character in a 3D virtual environment, skeletal points are determined where the virtual character overlaps with other virtual characters. For example, assuming the arm of a first virtual character overlaps with that of a second virtual character, skeletal points are determined at the arm of the first virtual character. Since the overlapping areas between different virtual characters may be the same or different, the skeletal points determined for different virtual characters may also be the same or different.

[0092] In some embodiments, the skeletal points corresponding to a virtual character can be understood as points used to control the movement of the mesh model corresponding to the virtual character. Optionally, the skeletal points corresponding to a virtual character can be understood as points located inside the mesh model corresponding to the virtual character, with each skeletal point used to drive a portion of the mesh or mesh points on the mesh model.

[0093] In some embodiments, when at least one skeletal point corresponding to any virtual character is determined, step 221 above can be replaced by the following sub-step:

[0094] Step 2211: Set template values ​​for the pixels associated with each bone point based on the distance between each bone point and the camera model.

[0095] In some embodiments, each skeletal point is associated with at least one pixel. In some embodiments, the template value is the same for all pixels associated with each skeletal point. For example, assuming a first skeletal point is associated with pixel 1 and pixel 2, then template sub-value 1 is set for pixel 1, and template sub-value 2 is set for pixel 2, with template sub-value 1 and template sub-value 2 being equal.

[0096] Method 2: Set template values ​​based on the pixels corresponding to the virtual character;

[0097] In some embodiments, the method further includes: for any virtual character in the three-dimensional virtual environment, determining at least one pixel corresponding to the virtual character.

[0098] In some embodiments, for any virtual character in a 3D virtual environment, all the pixels corresponding to that virtual character are determined. In some embodiments, the number of pixels corresponding to different virtual characters may be the same or different. For example, the first virtual character corresponds to 50 pixels, and the second virtual character corresponds to 80 pixels.

[0099] It should be noted that in this embodiment, the size of each pixel corresponding to different virtual characters is the same. For example, the first virtual character corresponds to 50 pixels, and the size of each pixel is 8 bits; the second virtual character corresponds to 80 pixels, and the size of each pixel is also 8 bits. Based on the above description of the embodiments, it can be understood that the pixels corresponding to the virtual characters in this embodiment refer to the points of the virtual characters on the corresponding rendering plane.

[0100] In some embodiments, the number of pixels corresponding to each virtual character is related to the size of the area occupied by the virtual character on the rendering plane. For example, suppose a first virtual character corresponds to a first rendering plane, and the size of the first area occupied by the first virtual character on the first rendering plane is 15 square centimeters; a second virtual character corresponds to a second rendering plane, and the size of the second area occupied by the second virtual character on the second rendering plane is 20 square centimeters; since 20 square centimeters is greater than 15 square centimeters, the number of pixels corresponding to the second virtual character is greater than the number of pixels corresponding to the first virtual character.

[0101] In some embodiments, for any virtual character in a 3D virtual environment, a subset of pixels corresponding to that virtual character is determined. Optionally, this subset of pixels is pre-selected. For example, this subset of pixels corresponds to the torso of the virtual character. Optionally, the number of subset pixels corresponding to different virtual characters is the same. For example, 30 pixels are determined for each virtual character. Optionally, the number of subset pixels corresponding to different virtual characters is different. For example, 30 pixels are determined for the first virtual character, and 50 pixels are determined for the second virtual character. Optionally, the positions of the subset pixels corresponding to different virtual characters are the same. For example, the subset of pixels corresponding to the torso of the first virtual character is determined, and the subset of pixels corresponding to the torso of the second virtual character is also determined. Optionally, the positions of the subset pixels corresponding to different virtual characters are different. For example, the subset of pixels corresponding to the torso of the first virtual character is determined, and the subset of pixels corresponding to the limbs of the second virtual character is determined. The subset of pixels corresponding to the needs of each virtual character can be determined according to the specific requirements of each virtual character.

[0102] In some embodiments, for any virtual character in a 3D virtual environment, the pixels at the points where the virtual character overlaps with other virtual characters are determined. For example, assuming the arm of a first virtual character overlaps with that of a second virtual character, the pixels at the arm of the first virtual character are determined. In this case, since the overlapping areas between different virtual characters may be the same or different, the pixels determined for different virtual characters may also be the same or different.

[0103] In some embodiments, when determining at least one pixel corresponding to any virtual character, step 221 above can be replaced by the following sub-steps:

[0104] Step 2212: Based on the distance between the virtual character and the camera model, set a template value for each pixel in at least one pixel point.

[0105] In some embodiments, a template value is set for the corresponding pixel on the rendering plane for each virtual character (or mesh model, or skeletal point of the virtual character, or point on the mesh model of the virtual character, or pixel corresponding to the virtual character) based on the distance between each virtual character (or mesh model, or skeletal point of the virtual character, or point on the mesh model of the virtual character, or pixel corresponding to the virtual character) and the camera model.

[0106] In some embodiments, the template value is used to indicate the distance between the virtual character and the camera model. In some embodiments, the template value is proportional to this distance. For example, a smaller template value reflects a smaller distance between the virtual character and the camera model; a larger template value reflects a larger distance between the virtual character and the camera model.

[0107] Method 3: Set template values ​​based on pre-selected reference points.

[0108] In some embodiments, the method further includes: for any virtual character in a three-dimensional virtual environment, determining at least one reference point corresponding to the virtual character.

[0109] In some embodiments, at least one reference point includes a subset of pre-selected skeletal points from the skeletal points corresponding to the virtual character. For example, assuming the skeletal points corresponding to the virtual character include skeletal point 1 and skeletal point 2, then at least one reference point could be skeletal point 1, or at least one reference point could be skeletal point 2, or at least one reference point could be both skeletal point 1 and skeletal point 2. Specifically, at least one reference point is pre-selected. For example, the pre-selected reference point is skeletal point 1.

[0110] In some embodiments, the skeletal points corresponding to different virtual characters may be the same or different. Optionally, the skeletal points corresponding to different virtual characters all include 22 skeletal points on the head, torso, and limbs. Optionally, the skeletal points corresponding to the first virtual character include the skeletal points corresponding to the head, and the skeletal points corresponding to the second virtual character include the skeletal points corresponding to the limbs.

[0111] In some embodiments, at least one reference point includes a pre-selected subset of pixels from the pixels corresponding to the virtual character. For example, assuming the pixels corresponding to the virtual character include pixel 1 and pixel 2, then at least one reference point could be pixel 1, or at least one reference point could be pixel 2, or at least one reference point could be both pixel 1 and pixel 2. Specifically, at least one reference point is pre-selected. For example, the pre-selected reference point is pixel 1.

[0112] In some embodiments, the pixels corresponding to different virtual characters may be the same or different.

[0113] In some embodiments, when determining at least one reference point corresponding to any virtual character, step 221 above can be replaced by the following sub-steps:

[0114] Step 2213: Based on the distance between the virtual character and the camera model, set template values ​​for the pixels associated with each of the at least one reference point.

[0115] In some embodiments, each reference point is associated with at least one pixel. In some embodiments, the template value is the same for all pixels associated with each reference point. For example, assuming a first reference point is associated with pixel 1 and pixel 2, then template sub-value 1 is set for pixel 1, and template sub-value 2 is set for pixel 2, with template sub-value 1 and template sub-value 2 being equal.

[0116] In some embodiments, there is a correspondence between the distance between the virtual character and the camera model and a template value. For example, the template value is set based on the interval to which the distance between the virtual character and the camera model belongs. An example is shown in Table 1 below:

[0117] Table 1

[0118] Distance range Template value Interval 1 Template value 1 Interval 2 Template value 2 …… ……

[0119] As shown in Table 1 above, when the distance between the virtual character and the camera model is in interval 1, the template value of the pixel corresponding to the virtual character is set to template value 1; when the distance between the virtual character and the camera model is in interval 2, the template value of the pixel corresponding to the virtual character is set to template value 2.

[0120] It should be noted that the template values ​​for different virtual characters may be set in the same or different ways. For example, the first template value for the first virtual character and the second template value for the second virtual character may both be set according to method one. Or, the first template value for the first virtual character may be set according to method one, while the second template value for the second virtual character may be set according to method two.

[0121] In summary, the method provided in this embodiment can determine the relative position between different virtual characters and the camera model by setting corresponding template values ​​for different virtual characters based on the distance between them.

[0122] The method provided in this embodiment further sets template values ​​for different virtual characters by determining at least one skeletal point, at least one pixel point, or at least one reference point corresponding to any virtual character. Different virtual characters can choose different methods to set template values ​​according to their needs, thereby achieving a more flexible way to determine the distance of different virtual characters relative to the camera model.

[0123] In some embodiments, after setting corresponding template values ​​for different virtual characters in a 3D virtual environment, when at least two virtual characters overlap, the occlusion relationship between the at least two virtual characters can be determined based on their respective template values. In this embodiment, the overlap of a first virtual character and a second virtual character is used as an example. Specifically, the overlap of a first virtual character and a second virtual character means that the first 3D model corresponding to the first virtual character overlaps with the second 3D model corresponding to the second virtual character.

[0124] In some embodiments, the occlusion relationship between the first virtual character and the second virtual character is determined by comparing the first template value of the first virtual character and the second template value of the second virtual character. Figure 8 This is a schematic diagram of a method for displaying a virtual character provided in an exemplary embodiment of this application. The method is... Figure 1 The server 140 shown is executed. Step 240 above can be replaced with the following sub-steps:

[0125] Step 241: If the first virtual character and the second virtual character overlap, compare the first template value and the second template value;

[0126] In some embodiments, when the first virtual character and the second virtual character overlap, the template values ​​of the first virtual character and the second virtual character at the overlap point are compared. For example, assuming that region 1 of the first virtual character and region 2 of the second virtual character overlap, and the volume occupied by region 1 and region 2 is the same, and the location of the region occupied by region 1 and region 2 is the same, then the template value corresponding to region 1 is compared with the template value corresponding to region 2. Here, region 1 of the first virtual character refers to region 1 in the first 3D model corresponding to the first virtual character, and region 2 of the second virtual character refers to region 2 in the second 3D model corresponding to the second virtual character. It can also be understood that, when the first virtual character and the second virtual character overlap, the first template value and the second template value of the corresponding pixels of the first virtual character and the second virtual character at the overlap point are compared.

[0127] In some embodiments, when comparing the template values ​​of the first virtual character and the second virtual character at their overlap, that is, when comparing the template value corresponding to region 1 and the template value corresponding to region 2, since the volume occupied by region 1 and region 2 is the same, and the position of the region occupied by region 1 and region 2 is the same, it can be considered that the number of pixels corresponding to region 1 and region 2 is the same, and the position of the pixels corresponding to region 1 and region 2 is the same. In this case, the template sub-values ​​included in the template value corresponding to region 1 correspond one-to-one with the template sub-values ​​included in the template value corresponding to region 2.

[0128] For example, assuming region 1 corresponds to pixels 1, 2, and 3, then region 2 also corresponds to pixels 1, 2, and 3. Assuming the template values ​​for region 1 include: template sub-value 1 corresponding to pixel 1, template sub-value 2 corresponding to pixel 2, and template sub-value 3 corresponding to pixel 3, and the template values ​​for region 2 include: template sub-value 11 corresponding to pixel 1, template sub-value 12 corresponding to pixel 2, and template sub-value 13 corresponding to pixel 3, then template sub-value 1 and template sub-value 11 are compared sequentially, template sub-value 2 and template sub-value 12 are compared, and template sub-value 3 and template sub-value 13 are compared sequentially.

[0129] Step 2421: If the first template value is less than or equal to the second template value, determine the occlusion relationship between the first virtual character and the second virtual character as the first occlusion relationship;

[0130] In some embodiments, if the first template value corresponding to the first virtual character is less than or equal to the second template value corresponding to the second virtual character, it reflects that the first distance of the first virtual character relative to the camera model is less than or equal to the second distance of the second virtual character relative to the camera model. Specifically, the first distance of the first 3D model corresponding to the first virtual character relative to the camera model is less than or equal to the second distance of the second 3D model corresponding to the second virtual character relative to the camera model.

[0131] In some embodiments, when the first distance between the first virtual character and the camera model is less than or equal to the second distance between the second virtual character and the camera model, the occlusion relationship between the first virtual character and the second virtual character is determined to be a first occlusion relationship. The first occlusion relationship means that the first virtual character occludes in front of the second virtual character. That is, the first 3D model corresponding to the first virtual character occludes in front of the second 3D model corresponding to the second virtual character.

[0132] In some embodiments, the first template value corresponding to the first virtual character includes *a* first template sub-values, where *a* is an integer greater than 0. The second template value corresponding to the second virtual character includes *b* second template sub-values, where *b* is an integer greater than 0.

[0133] Optionally, the values ​​of a and b are equal. For example, the first template value corresponding to the first virtual character includes 5 first template sub-values, and the second template value corresponding to the second virtual character includes 5 second template sub-values.

[0134] Optionally, the values ​​of a and b are not equal. For example, the first template value corresponding to the first virtual character includes 5 first template sub-values, and the second template value corresponding to the second virtual character includes 8 second template sub-values.

[0135] Optionally, the a first template sub-values ​​and b second template sub-values ​​are obtained by setting them in the same or different ways. For example, both the a first template sub-values ​​and b second template sub-values ​​are set according to method one above. Or, the a first template sub-values ​​are obtained by setting them according to method one above, and the b second template sub-values ​​are obtained by setting them according to method two above.

[0136] It's important to understand that, generally, all first template sub-values ​​in group 'a' are obtained by setting them in the same way, and all second template sub-values ​​in group 'b' are obtained by setting them in the same way. However, in some special cases, the first template sub-values ​​in group 'a' may be obtained by setting them in different ways. Or, the second template sub-values ​​in group 'b' may also be obtained by setting them in different ways. For example, the first template sub-values ​​in group 'a' include first template sub-value 1 and first template sub-value 2, where first template sub-value 1 is obtained by setting it in method one above, and first template sub-value 2 is obtained by setting it in method two above.

[0137] In some embodiments, if at least one of the a first template sub-values ​​is less than or equal to the minimum value among the b second template sub-values, the occlusion relationship between the first virtual character and the second virtual character is determined as a first occlusion relationship. That is, at least one pixel among the pixels corresponding to the first virtual character indicates that the distance between the first virtual character and the camera model is less than or equal to the distance between the second virtual character and the camera model indicated by all the pixels corresponding to the second virtual character.

[0138] In some embodiments, when there are c sets of template sub-values ​​that overlap between a first template sub-values ​​and b second template sub-values, the size relationship between the first and second template sub-values ​​in each set of template sub-values ​​in the c sets is compared; when the first quantity is greater than or equal to the second quantity, the occlusion relationship between the first virtual character and the second virtual character is determined as the first occlusion relationship, where the first quantity is the number of first template sub-values ​​in the c sets that are less than or equal to the second template sub-values, and the second quantity is the number of first template sub-values ​​in the c sets that are greater than the second template sub-values; each set of template sub-values ​​in the c sets corresponds to the same pixel. a is a positive integer greater than 0, b is a positive integer greater than 0, and c is a positive integer less than or equal to a and less than or equal to b.

[0139] In some embodiments, if a first number of first template sub-values ​​are less than or equal to a first number of second template sub-values ​​corresponding to the first number of first template sub-values ​​in b second template sub-values, and a second number of second template sub-values ​​are less than or equal to a second number of first template sub-values ​​corresponding to the second number of second template sub-values ​​in a second template value, and the first number is greater than or equal to the second number, then the occlusion relationship between the first virtual character and the second virtual character is determined as the first occlusion relationship.

[0140] For example, such as Figure 9As shown, assuming the first rendering plane 31 corresponds to the first virtual object, the a first template sub-values ​​corresponding to the first virtual object include the first template sub-value 1 (1) corresponding to the first pixel 1, the first template sub-value 2 (2) corresponding to the first pixel 2, the first template sub-value 3 (3) corresponding to the first pixel 3, the first template sub-value 4 (4) corresponding to the first pixel 4, and the first template sub-value 5 (5) corresponding to the first pixel 5.

[0141] Assuming the second virtual object corresponds to the second rendering plane 32, the b second template sub-values ​​corresponding to the second virtual object include the second template sub-value 1 (1) corresponding to the second pixel 1, the second template sub-value 2 (2) corresponding to the second pixel 2, the second template sub-value 3 (7) corresponding to the second pixel 3, the second template sub-value 4 (6) corresponding to the second pixel 4, the second template sub-value 5 (4) corresponding to the second pixel 5, the second template sub-value 6 (5) corresponding to the second pixel 6, and the second template sub-value 7 (3) corresponding to the second pixel 7.

[0142] In this diagram, the first pixel 3 corresponds to the second pixel 5, the first pixel 4 corresponds to the second pixel 6, and the first pixel 5 corresponds to the second pixel 7. That is, the positions corresponding to the first pixel 3, the first pixel 4, and the first pixel 5 overlap with the positions corresponding to the second pixel 5, the second pixel 6, and the second pixel 7.

[0143] At this point, the first template value 3(3) corresponding to the first pixel 3 is compared with the second template value 5(4) corresponding to the second pixel 5, the first template value 4(4) corresponding to the first pixel 4 is compared with the second template value 6(5) corresponding to the second pixel 6, and the first template value 5(5) corresponding to the first pixel 5 is compared with the second template value 7(3) corresponding to the second pixel 7.

[0144] For example, such as Figure 9 As shown, the first template value 3(3) corresponding to the first pixel 3 is less than the second template value 5(4) corresponding to the second pixel 5, the first template value 4(4) corresponding to the first pixel 4 is less than the second template value 6(5) corresponding to the second pixel 6, and the first template value 5(5) corresponding to the first pixel 5 is greater than the second template value 7(3) corresponding to the second pixel 7. Therefore, the first quantity is 2 and the second quantity is 1. At this time, the occlusion relationship between the first virtual character and the second virtual character is determined to be the first occlusion relationship.

[0145] In some embodiments, when the first number is greater than or equal to the second number, it reflects that the presence of more pixels in the pixels corresponding to the first virtual character indicates that the first virtual character is closer to the camera model.

[0146] Step 2422: If the first template value is greater than the second template value, determine the occlusion relationship between the first virtual character and the second virtual character as the second occlusion relationship.

[0147] In some embodiments, if the first template value corresponding to the first virtual character is greater than the second template value corresponding to the second virtual character, it reflects that the first distance of the first virtual character relative to the camera model is greater than the second distance of the second virtual character relative to the camera model. Specifically, the first distance of the first 3D model corresponding to the first virtual character relative to the camera model is greater than the second distance of the second 3D model corresponding to the second virtual character relative to the camera model.

[0148] In some embodiments, when the first distance between the first virtual character and the camera model is greater than the second distance between the second virtual character and the camera model, the occlusion relationship between the first and second virtual characters is determined to be a second occlusion relationship. The second occlusion relationship is that the second virtual character occludes in front of the first virtual character. That is, the second 3D model corresponding to the second virtual character occludes in front of the first 3D model corresponding to the first virtual character.

[0149] In some embodiments, the first template value corresponding to the first virtual character includes *a* first template sub-values, where *a* is an integer greater than 0. The second template value corresponding to the second virtual character includes *b* second template sub-values, where *b* is an integer greater than 0.

[0150] Optionally, the values ​​of a and b are equal. For example, the first template value corresponding to the first virtual character includes 5 first template sub-values, and the second template value corresponding to the second virtual character includes 5 second template sub-values.

[0151] Optionally, the values ​​of a and b are not equal. For example, the first template value corresponding to the first virtual character includes 5 first template sub-values, and the second template value corresponding to the second virtual character includes 8 second template sub-values.

[0152] Optionally, the a first template sub-values ​​and b second template sub-values ​​are obtained by setting them in the same or different ways. For example, both the a first template sub-values ​​and b second template sub-values ​​are set according to method one above. Or, the a first template sub-values ​​are obtained by setting them according to method one above, and the b second template sub-values ​​are obtained by setting them according to method two above.

[0153] It's important to understand that, generally, all first template sub-values ​​in group 'a' are obtained by setting them in the same way, and all second template sub-values ​​in group 'b' are obtained by setting them in the same way. However, in some special cases, the first template sub-values ​​in group 'a' may be obtained by setting them in different ways. Or, the second template sub-values ​​in group 'b' may also be obtained by setting them in different ways. For example, the first template sub-values ​​in group 'a' include first template sub-value 1 and first template sub-value 2, where first template sub-value 1 is obtained by setting it in method one above, and first template sub-value 2 is obtained by setting it in method two above.

[0154] In some embodiments, if the minimum value among the a first template sub-values ​​is greater than at least one of the b second template sub-values, the occlusion relationship between the first virtual character and the second virtual character is determined to be a second occlusion relationship. That is, at least one pixel among the pixels corresponding to the second virtual character indicates that the distance between the second virtual character and the camera model is less than or equal to the distance between the first virtual character and the camera model indicated by all the pixels corresponding to the first virtual character.

[0155] In some embodiments, when there are c sets of template sub-values ​​that overlap between a first template sub-values ​​and b second template sub-values, the size relationship between the first and second template sub-values ​​in each set of template sub-values ​​in the c sets is compared; when the first quantity is less than the second quantity, the occlusion relationship between the first virtual character and the second virtual character is determined as the second occlusion relationship. The first quantity is the number of first template sub-values ​​in the c sets that are less than or equal to the second template sub-values, and the second quantity is the number of first template sub-values ​​in the c sets that are greater than the second template sub-values; each set of template sub-values ​​in the c sets corresponds to the same pixel. The value of a is a positive integer greater than 0, the value of b is a positive integer greater than 0, and the value of c is a positive integer less than or equal to a and less than or equal to b.

[0156] In some embodiments, if a first number of first template sub-values ​​in a first template sub-values ​​are less than or equal to a first number of second template sub-values ​​in b second template sub-values ​​that correspond to the first number of first template sub-values, and b second template sub-values ​​in b second template sub-values ​​are less than or equal to a second number of first template sub-values ​​that correspond to the second number of second template sub-values, and the first number is less than the second number, then the occlusion relationship between the first virtual character and the second virtual character is determined to be the second occlusion relationship.

[0157] In some embodiments, when the first number is less than the second number, it reflects that the presence of more pixels in the pixels corresponding to the second virtual character indicates that the second virtual character is closer to the camera model.

[0158] In summary, the method provided in this embodiment determines the occlusion relationship between the first virtual character and the second virtual character by comparing the first template value corresponding to the first virtual character and the second template value corresponding to the second virtual character when the first virtual character and the second virtual character overlap. This allows for accurate rendering of the overlapping area of ​​the first virtual character and the second virtual character based on the occlusion relationship during subsequent rendering.

[0159] In some embodiments, the virtual character display method proposed in this application can be applied to 3D side-scrolling games. Specifically, the method is... Figure 1 The server 140 shown executes this method, which includes:

[0160] Step 2200: Set template values ​​for different game characters in the 3D side-scrolling game;

[0161] In some embodiments, a 3D side-scrolling game includes at least two game characters, each of whom can move freely within the game. For example, the different game characters may include a first game character and a second game character.

[0162] In some embodiments, the game characters in the 3D virtual environment are also 3D, with each game character corresponding to a 3D model. For example, the first game character corresponds to a first 3D model, and the second game character corresponds to a second 3D model.

[0163] In some embodiments, the first game character and the second game character are controlled by different users on different terminals. For example, the first game character is controlled by a first user on a first terminal, and the second game character is controlled by a second user on a second terminal. In some embodiments, the first game character and the second game character are controlled by the same user on the same terminal. For example, both the first game character and the second game character are controlled by the first user on the first terminal. In some embodiments, the first game character is controlled by the user on the terminal, and the second game character is automatically controlled by the terminal. This embodiment does not limit the scope of the embodiments.

[0164] In some embodiments, template values ​​are set for each individual game character in a 3D side-scrolling game. For example, a first template value is set for a first game character, and a second template value is set for a second game character. In some embodiments, each game character in a 3D side-scrolling game is considered a mesh model. Each mesh model is a basic 3D model composed of a series of vertices, faces, materials, textures, etc. Setting template values ​​for each game character is equivalent to setting template values ​​for each mesh model. For example, a first template value is set for the first mesh model corresponding to the first game character, and a second template value is set for the second mesh model corresponding to the second game character.

[0165] In some embodiments, setting a template value for each game character can be achieved by setting a template value for each pixel corresponding to the game character. In some embodiments, since each game character corresponds to at least one pixel, the template value for each game character can be understood as a set of template sub-values ​​for the pixels corresponding to the game character. For example, assuming the first game character corresponds to pixels 1, 2, and 3, then template sub-value 1 is set for pixel 1, template sub-value 2 is set for pixel 2, and template sub-value 3 is set for pixel 3. That is, the first template value for the first game character is a set including template sub-value 1, template sub-value 2, and template sub-value 3.

[0166] In some embodiments, the template value is used to indicate the distance between the game character (or mesh model, or skeletal points of the game character, or points on the mesh model of the game character, or corresponding pixels of the game character) and the camera model in a 3D side-scrolling game. In some embodiments, by using template technology, a template value can be set for each pixel corresponding to the game character. For example, Figure 5 As shown, before the camera model 30 displays the game character, it first displays the outline of the game character via the rendering plane 22. The area contained in the outline of the game character includes the corresponding pixels of the game character.

[0167] In some embodiments, a first game character corresponds to a first rendering plane, and the first rendering plane includes at least pixels corresponding to the first game character. A first template value is set for the pixels corresponding to the first game character on the first rendering plane. In some embodiments, a second game character corresponds to a second rendering plane, and the second rendering plane includes at least pixels corresponding to the second game character. A second template value is set for the pixels corresponding to the second game character on the second rendering plane. For example, such as... Figure 5As shown, template values ​​are set for the pixels corresponding to the game character on the rendering plane 22, such as {1,2,3,4,5}. In some embodiments, template default values ​​are set for pixels on the rendering plane other than those corresponding to the game character. Optionally, the template default value in UE4 is 0 by default, which means that if the template default value is not explicitly set, the template value of all pixels will be 0. It should be noted that since this application embodiment mainly focuses on how to set the template value of the pixels corresponding to the game character, the template values ​​of pixels other than those corresponding to the game character are considered as template default values, that is, they will not be rendered. However, in the actual rendering process, the 3D objects corresponding to the pixels other than those corresponding to the game character may also be rendered, which is not limited here.

[0168] Step 2400: In the case of overlap between the first game character and the second game character, perform template testing based on the first template value corresponding to the first game character and the second template value corresponding to the second game character to determine the occlusion relationship between the first game character and the second game character.

[0169] In some embodiments, different game characters in a 3D side-scrolling game may overlap during gameplay. The template testing method includes comparing a first template value and a second template value (corresponding to the same pixel). The purpose of the template testing is to determine the occlusion relationship between the first game character and the second game character. Specifically, it aims to determine the occlusion relationship between a first 3D model corresponding to the first game character and a second 3D model corresponding to the second game character.

[0170] In some embodiments, when the first game character and the second game character overlap, the occlusion relationship between the first game character and the second game character includes a first occlusion relationship and a second occlusion relationship. Specifically, the first occlusion relationship is that the first game character occludes in front of the second game character, and the second occlusion relationship is that the second game character occludes in front of the first game character. More specifically, the first occlusion relationship is that the first 3D model corresponding to the first game character occludes in front of the second 3D model corresponding to the second game character, and the second occlusion relationship is that the second 3D model corresponding to the second game character occludes in front of the first 3D model corresponding to the first game character.

[0171] Step 2600: Render the first game character and the second game character to obtain display frames based on the occlusion relationship.

[0172] In some embodiments, based on the determined occlusion relationship between the first game character and the second game character, the first game character and the second game character are selectively rendered to obtain a display frame including the first game character and the second game character.

[0173] In some embodiments, when the occlusion relationship between the first game character and the second game character is a first occlusion relationship, the first game character is fully rendered, and the non-overlapping parts of the second game character and the first game character are also fully rendered to obtain a display frame. That is, when the occlusion relationship between the first game character and the second game character is a first occlusion relationship, it can be determined that the first 3D model corresponding to the first game character is occluded in front of the second 3D model corresponding to the second game character. Therefore, during rendering, the non-overlapping parts of the first 3D model corresponding to the first game character and the second 3D model corresponding to the second game character can be fully rendered, and the overlapping parts of the first 3D model corresponding to the first game character and the second 3D model corresponding to the second game character can be rendered only for the first game character, thereby avoiding the situation where the first 3D model corresponding to the first game character and the second 3D model corresponding to the second game character have related penetration at the overlapping point.

[0174] In some embodiments, when the occlusion relationship between the first and second game characters is a second occlusion relationship, the second game character is rendered entirely, and the non-overlapping portions of the first and second game characters are also rendered to obtain a display frame. That is, when the occlusion relationship between the first and second game characters is a second occlusion relationship, it can be determined that the second 3D model corresponding to the second game character is occluded in front of the first 3D model corresponding to the first game character. Therefore, during rendering, the non-overlapping portions of the first and second 3D models corresponding to the first and second game characters can be rendered entirely, and the overlapping portions of the first and second 3D models corresponding to the first and second game characters can be rendered only for the second game character, thereby avoiding any penetration issues at the overlapping points of the first and second 3D models corresponding to the first and second game characters.

[0175] In some embodiments, the rendered first and second game characters will not be visible through each other, depending on the occlusion relationship between them. That is, the first and second game characters will be displayed according to their respective occlusion relationships.

[0176] In some embodiments, the template value for each game character is determined based on the distance between each game character and the camera model in the 3D side-scrolling game. Specifically, the template value for each game character is determined based on the distance between the 3D model corresponding to each game character and the camera model in the 3D virtual environment. Step 2200 above can be replaced with the following sub-steps:

[0177] Step 2210: Set template values ​​for different game characters based on the distance between them and the camera model.

[0178] In some embodiments, the 3D side-scrolling game includes a camera model used to image and display frames including different game characters. For example, Figure 6 As shown, the relative position of the camera model 30 and the 3D side-scrolling game remains unchanged. When the game character in the 3D side-scrolling game moves along the y-axis, the distance between the game character and the camera model 30 changes accordingly.

[0179] In some embodiments, a template value is set for each game character (or mesh model, or skeletal points of the game character, or points on the mesh model of the game character, or corresponding pixels of the game character) and the camera model. Specifically, a template value is set for the corresponding pixels of each game character on the rendering plane based on the distance between each game character and the camera model.

[0180] In some embodiments, the template value is used to indicate the distance between the game character and the camera model, or the template value is used to indicate the distance between the 3D model corresponding to the game character and the camera model. In some embodiments, the template value is proportional to the distance. For example, a smaller template value reflects a smaller distance between the game character and the camera model; a larger template value reflects a larger distance between the game character and the camera model.

[0181] In this application embodiment, the following three methods for setting template values ​​are specifically proposed:

[0182] Method 1: Set template values ​​based on the skeletal points corresponding to the game character;

[0183] In some embodiments, the method further includes: for any game character in a 3D side-scrolling game, determining at least one skeletal point corresponding to the game character.

[0184] In some embodiments, for any game character in a 3D side-scrolling game, all the skeletal points corresponding to that game character are determined. In this case, it can be assumed that the number and types of skeletal points for each game character are consistent. For example, assuming that the first game character's total skeletal points include 22 skeletal points on the head, torso, and limbs, then the second game character's total skeletal points also include 22 skeletal points on the head, torso, and limbs. Of course, the number and types of skeletal points can also differ for different types of game characters.

[0185] In some embodiments, for any game character in a 3D side-scrolling game, partial skeletal points corresponding to that game character are determined. Optionally, these partial skeletal points are pre-selected skeletal points. For example, these partial skeletal points are joint points. Optionally, the determined partial skeletal points corresponding to different game characters are the same. For example, the determined partial skeletal points corresponding to the first game character are limb joint points, and the determined partial skeletal points corresponding to the second game character are also limb joint points. Optionally, the determined partial skeletal points corresponding to different game characters are different. For example, the determined partial skeletal points corresponding to the first game character are limb joint points, and the determined partial skeletal points corresponding to the second game character are torso skeletal points. Partial skeletal points corresponding to the needs of each game character can be determined according to the specific requirements of each game character.

[0186] In some embodiments, for any character in a 3D side-scrolling game, the skeletal points where that character overlaps with other characters are determined. For example, assuming the arm of a first character overlaps with that of a second character, the skeletal points at the arm of the first character are determined. Since the overlapping areas between different characters may be the same or different, the determined skeletal points for different characters may also be the same or different.

[0187] In some embodiments, the skeletal points corresponding to a game character can be understood as points used to control the movement of the mesh model corresponding to the game character. Optionally, the skeletal points corresponding to a game character can be understood as points located inside the mesh model corresponding to the game character, with each skeletal point used to drive a portion of the mesh or mesh points on the mesh model.

[0188] In some embodiments, when determining at least one skeletal point corresponding to any game character, step 2210 above can be replaced by the following sub-steps:

[0189] Step 22110: Set template values ​​for the pixels associated with each bone point based on the distance between each bone point and the camera model.

[0190] In some embodiments, each skeletal point is associated with at least one pixel. In some embodiments, the template value is the same for all pixels associated with each skeletal point. For example, assuming a first skeletal point is associated with pixel 1 and pixel 2, then template sub-value 1 is set for pixel 1, and template sub-value 2 is set for pixel 2, with template sub-value 1 and template sub-value 2 being equal.

[0191] Method 2: Set template values ​​based on the pixels corresponding to the game characters;

[0192] In some embodiments, the method further includes: for any game character in a 3D side-scrolling game, determining at least one pixel corresponding to the game character.

[0193] In some embodiments, for any game character in a 3D side-scrolling game, all the pixels corresponding to that game character are determined. In some embodiments, the number of pixels corresponding to different game characters may be the same or different. For example, the first game character corresponds to 50 pixels, and the second game character corresponds to 80 pixels.

[0194] It should be noted that in this embodiment, the size of each pixel corresponding to different game characters is the same. For example, the first game character corresponds to 50 pixels, and the size of each pixel is 8 bits; the second game character corresponds to 80 pixels, and the size of each pixel is also 8 bits. Based on the above description of the embodiments, it can be understood that the pixels corresponding to the game characters in this embodiment refer to the points of the game characters on the corresponding rendering plane.

[0195] In some embodiments, the number of pixels corresponding to each game character is related to the size of the area occupied by that game character on the rendering plane. For example, suppose the first game character corresponds to the first rendering plane, and the size of the first area occupied by the first game character on the first rendering plane is 15 square centimeters; the second game character corresponds to the second rendering plane, and the size of the second area occupied by the second game character on the second rendering plane is 20 square centimeters; since 20 square centimeters is greater than 15 square centimeters, the number of pixels corresponding to the second game character is greater than the number of pixels corresponding to the first game character.

[0196] In some embodiments, for any game character in a 3D side-scrolling game, a subset of pixels corresponding to that game character is determined. Optionally, this subset of pixels is pre-selected. For example, this subset of pixels corresponds to the torso of the game character. Optionally, the number of subset pixels determined for different game characters is the same. For example, 30 pixels are determined for each different game character. Optionally, the number of subset pixels determined for different game characters is different. For example, 30 pixels are determined for the first game character, and 50 pixels are determined for the second game character. Optionally, the positions of the subset pixels determined for different game characters are the same. For example, the subset of pixels determined for the first game character corresponds to the torso, and the subset of pixels determined for the second game character also corresponds to the torso. Optionally, the positions of the subset pixels determined for different game characters are different. For example, the subset of pixels determined for the first game character corresponds to the torso, and the subset of pixels determined for the second game character corresponds to the limbs. Based on the needs of different game characters, the corresponding pixel points can be determined for each game character.

[0197] In some embodiments, for any character in a 3D side-scrolling game, the pixels at the points where that character overlaps with other characters are determined. For example, assuming the arm of a first character overlaps with that of a second character, the pixels at the arm of the first character are determined. In this case, since the overlapping areas between different characters may be the same or different, the pixels determined for different characters may also be the same or different.

[0198] In some embodiments, when determining at least one pixel corresponding to any game character, step 2210 above can be replaced by the following sub-steps:

[0199] Step 22120: Based on the distance between the game character and the camera model, set a template value for each pixel in at least one pixel.

[0200] In some embodiments, a template value is set for the corresponding pixel on the rendering plane for each game character (or mesh model, or skeletal point of the game character, or point on the mesh model of the game character, or pixel corresponding to the game character) based on the distance between each game character (or mesh model, or skeletal point of the game character, or point on the mesh model of the game character, or pixel corresponding to the game character) and the camera model.

[0201] In some embodiments, the template value is used to indicate the distance between the game character and the camera model. In some embodiments, the template value is proportional to this distance. For example, a smaller template value reflects a smaller distance between the game character and the camera model; a larger template value reflects a larger distance between the game character and the camera model.

[0202] Method 3: Set template values ​​based on pre-selected reference points.

[0203] In some embodiments, the method further includes: for any game character in a 3D side-scrolling game, determining at least one reference point corresponding to the game character.

[0204] In some embodiments, at least one reference point includes a subset of pre-selected bone points from the bone points corresponding to the game character. For example, assuming the bone points corresponding to the game character include bone point 1 and bone point 2, then at least one reference point could be bone point 1, or at least one reference point could be bone point 2, or at least one reference point could be both bone point 1 and bone point 2. Specifically, at least one reference point is pre-selected. For example, the pre-selected reference point is bone point 1.

[0205] In some embodiments, the skeletal points corresponding to different game characters may be the same or different. Optionally, the skeletal points corresponding to different game characters all include 22 skeletal points on the head, torso, and limbs. Optionally, the skeletal points corresponding to the first game character include the skeletal points corresponding to the head, and the skeletal points corresponding to the second game character include the skeletal points corresponding to the limbs.

[0206] In some embodiments, at least one reference point includes a pre-selected subset of pixels from the pixels corresponding to the game character. For example, assuming the pixels corresponding to the game character include pixel 1 and pixel 2, then at least one reference point could be pixel 1, or at least one reference point could be pixel 2, or at least one reference point could be both pixel 1 and pixel 2. Specifically, at least one reference point is pre-selected. For example, the pre-selected reference point is pixel 1.

[0207] In some embodiments, the pixels corresponding to different game characters may be the same or different.

[0208] In some embodiments, when determining at least one reference point corresponding to any game character, step 2210 above can be replaced by the following sub-steps:

[0209] Step 22130: Based on the distance between the game character and the camera model, set template values ​​for the pixels associated with each of the at least one reference point.

[0210] In some embodiments, each reference point is associated with at least one pixel. In some embodiments, the template value is the same for all pixels associated with each reference point. For example, assuming a first reference point is associated with pixel 1 and pixel 2, then template sub-value 1 is set for pixel 1, and template sub-value 2 is set for pixel 2, with template sub-value 1 and template sub-value 2 being equal.

[0211] In some embodiments, there is a correspondence between the distance between the game character and the camera model and a template value. For example, the template value is set according to the interval to which the distance between the game character and the camera model belongs.

[0212] It should be noted that the methods for setting template values ​​for different game characters may be the same or different. For example, the first template value for the first game character and the second template value for the second game character may both be set according to method one. Or, the first template value for the first game character may be set according to method one, while the second template value for the second game character may be set according to method two.

[0213] In some embodiments, after setting corresponding template values ​​for different game characters in a 3D side-scrolling game, when at least two game characters overlap, the occlusion relationship between the at least two game characters can be determined based on their respective template values. In this embodiment, the overlap of a first game character and a second game character is used as an example. Specifically, the overlap of a first game character and a second game character means that the first 3D model corresponding to the first game character overlaps with the second 3D model corresponding to the second game character.

[0214] In some embodiments, the occlusion relationship between the first game character and the second game character is determined by comparing the first template value of the first game character and the second template value of the second game character. Step 2400 above can be replaced by the following sub-steps:

[0215] Step 2410: If the first game character and the second game character overlap, compare the first template value and the second template value;

[0216] In some embodiments, when the first game character and the second game character overlap, the template values ​​of the first game character and the second game character at the overlap point are compared. For example, assuming that region 1 of the first game character and region 2 of the second game character overlap, and the volume occupied by region 1 and region 2 are the same, and the location of the region occupied by region 1 and region 2 are the same, then the template value corresponding to region 1 is compared with the template value corresponding to region 2. Here, region 1 of the first game character refers to region 1 in the first 3D model corresponding to the first game character, and region 2 of the second game character refers to region 2 in the second 3D model corresponding to the second game character.

[0217] In some embodiments, when comparing the template values ​​of the first game character and the second game character at their overlap, that is, when comparing the template value corresponding to region 1 and the template value corresponding to region 2, since the volume occupied by region 1 and region 2 is the same, and the position of the region occupied by region 1 and region 2 is the same, it can be considered that the number of pixels corresponding to region 1 and region 2 is the same, and the position of the pixels corresponding to region 1 and region 2 is the same. In this case, the template sub-values ​​included in the template value corresponding to region 1 correspond one-to-one with the template sub-values ​​included in the template value corresponding to region 2.

[0218] For example, assuming region 1 corresponds to pixels 1, 2, and 3, then region 2 also corresponds to pixels 1, 2, and 3. Assuming the template values ​​for region 1 include: template sub-value 1 corresponding to pixel 1, template sub-value 2 corresponding to pixel 2, and template sub-value 3 corresponding to pixel 3, and the template values ​​for region 2 include: template sub-value 11 corresponding to pixel 1, template sub-value 12 corresponding to pixel 2, and template sub-value 13 corresponding to pixel 3, then template sub-value 1 and template sub-value 11 are compared sequentially, template sub-value 2 and template sub-value 12 are compared, and template sub-value 3 and template sub-value 13 are compared sequentially.

[0219] Step 24210: If the first template value is less than or equal to the second template value, determine the occlusion relationship between the first game character and the second game character as the first occlusion relationship;

[0220] In some embodiments, if the first template value corresponding to the first game character is less than or equal to the second template value corresponding to the second game character, it reflects that the first distance of the first game character relative to the camera model is less than or equal to the second distance of the second game character relative to the camera model. Specifically, the first distance of the first 3D model corresponding to the first game character relative to the camera model is less than or equal to the second distance of the second 3D model corresponding to the second game character relative to the camera model.

[0221] In some embodiments, when the first distance between the first game character and the camera model is less than or equal to the second distance between the second game character and the camera model, the occlusion relationship between the first game character and the second game character is determined to be a first occlusion relationship. The first occlusion relationship means that the first game character occludes in front of the second game character. That is, the first 3D model corresponding to the first game character occludes in front of the second 3D model corresponding to the second game character.

[0222] In some embodiments, the first template value corresponding to the first game character includes 'a' first template sub-values, where 'a' is an integer greater than 0. The second template value corresponding to the second game character includes 'b' second template sub-values, where 'b' is an integer greater than 0.

[0223] Optionally, the values ​​of a and b are equal. For example, the first template value corresponding to the first game character includes 5 first template sub-values, and the second template value corresponding to the second game character includes 5 second template sub-values.

[0224] Optionally, the values ​​of a and b are not equal. For example, the first template value corresponding to the first game character includes 5 first template sub-values, and the second template value corresponding to the second game character includes 8 second template sub-values.

[0225] Optionally, the a first template sub-values ​​and b second template sub-values ​​are obtained by setting them in the same or different ways. For example, both the a first template sub-values ​​and b second template sub-values ​​are set according to method one above. Or, the a first template sub-values ​​are obtained by setting them according to method one above, and the b second template sub-values ​​are obtained by setting them according to method two above.

[0226] It's important to understand that, generally, all first template sub-values ​​in group 'a' are obtained by setting them in the same way, and all second template sub-values ​​in group 'b' are obtained by setting them in the same way. However, in some special cases, the first template sub-values ​​in group 'a' may be obtained by setting them in different ways. Or, the second template sub-values ​​in group 'b' may also be obtained by setting them in different ways. For example, the first template sub-values ​​in group 'a' include first template sub-value 1 and first template sub-value 2, where first template sub-value 1 is obtained by setting it in method one above, and first template sub-value 2 is obtained by setting it in method two above.

[0227] In some embodiments, if at least one of the a first template sub-values ​​is less than or equal to the minimum value among the b second template sub-values, the occlusion relationship between the first game character and the second game character is determined as a first occlusion relationship. That is, at least one pixel among the pixels corresponding to the first game character indicates that the distance between the first game character and the camera model is less than or equal to the distance between the second game character and the camera model indicated by all the pixels corresponding to the second game character.

[0228] In some embodiments, when there are c sets of template sub-values ​​that overlap between a first template sub-values ​​and b second template sub-values, the size relationship between the first template sub-values ​​and the second template sub-values ​​in each set of template sub-values ​​in the c sets is compared; when the first quantity is greater than or equal to the second quantity, the occlusion relationship between the first game character and the second game character is determined as the first occlusion relationship, the first quantity is the number of first template sub-values ​​in the c sets that are less than or equal to the second template sub-values, and the second quantity is the number of first template sub-values ​​in the c sets that are greater than the second template sub-values; each set of template sub-values ​​in the c sets corresponds to the same pixel.

[0229] In some embodiments, if a first number of first template sub-values ​​are less than or equal to a first number of second template sub-values ​​corresponding to the first number of first template sub-values ​​in b second template sub-values, and a second number of second template sub-values ​​are less than or equal to a second number of first template sub-values ​​corresponding to the second number of second template sub-values ​​in a second template value, and the first number is greater than or equal to the second number, then the occlusion relationship between the first game character and the second game character is determined as the first occlusion relationship.

[0230] In some embodiments, when the first number is greater than or equal to the second number, it reflects that the presence of more pixels in the pixels corresponding to the first game character indicates that the first game character is closer to the camera model.

[0231] Step 24220: If the first template value is greater than the second template value, determine the occlusion relationship between the first game character and the second game character as the second occlusion relationship.

[0232] In some embodiments, if the first template value corresponding to the first game character is greater than the second template value corresponding to the second game character, it reflects that the first distance between the first game character and the camera model is greater than the second distance between the second game character and the camera model. Specifically, the first distance between the first 3D model corresponding to the first game character and the camera model is greater than the second distance between the second 3D model corresponding to the second game character and the camera model.

[0233] In some embodiments, when the first distance between the first game character and the camera model is greater than the second distance between the second game character and the camera model, the occlusion relationship between the first game character and the second game character is determined to be a second occlusion relationship. The second occlusion relationship is that the second game character occludes in front of the first game character. That is, the second 3D model corresponding to the second game character occludes in front of the first 3D model corresponding to the first game character.

[0234] In some embodiments, the first template value corresponding to the first game character includes 'a' first template sub-values, where 'a' is an integer greater than 0. The second template value corresponding to the second game character includes 'b' second template sub-values, where 'b' is an integer greater than 0.

[0235] Optionally, the values ​​of a and b are equal. For example, the first template value corresponding to the first game character includes 5 first template sub-values, and the second template value corresponding to the second game character includes 5 second template sub-values.

[0236] Optionally, the values ​​of a and b are not equal. For example, the first template value corresponding to the first game character includes 5 first template sub-values, and the second template value corresponding to the second game character includes 8 second template sub-values.

[0237] Optionally, the a first template sub-values ​​and b second template sub-values ​​are obtained by setting them in the same or different ways. For example, both the a first template sub-values ​​and b second template sub-values ​​are set according to method one above. Or, the a first template sub-values ​​are obtained by setting them according to method one above, and the b second template sub-values ​​are obtained by setting them according to method two above.

[0238] It's important to understand that, generally, all first template sub-values ​​in group 'a' are obtained by setting them in the same way, and all second template sub-values ​​in group 'b' are obtained by setting them in the same way. However, in some special cases, the first template sub-values ​​in group 'a' may be obtained by setting them in different ways. Or, the second template sub-values ​​in group 'b' may also be obtained by setting them in different ways. For example, the first template sub-values ​​in group 'a' include first template sub-value 1 and first template sub-value 2, where first template sub-value 1 is obtained by setting it in method one above, and first template sub-value 2 is obtained by setting it in method two above.

[0239] In some embodiments, if the minimum value among the a first template sub-values ​​is greater than at least one of the b second template sub-values, the occlusion relationship between the first game character and the second game character is determined to be a second occlusion relationship. That is, at least one pixel among the pixels corresponding to the second game character indicates that the distance between the second game character and the camera model is less than or equal to the distance between the first game character and the camera model indicated by all the pixels corresponding to the first game character.

[0240] In some embodiments, when there are c sets of template sub-values ​​that overlap between a first template sub-values ​​and b second template sub-values, the size relationship between the first template sub-values ​​and the second template sub-values ​​in each set of template sub-values ​​in the c sets is compared; when the first quantity is less than the second quantity, the occlusion relationship between the first game character and the second game character is determined as the second occlusion relationship, the first quantity is the number of first template sub-values ​​in the c sets that are less than or equal to the second template sub-values, and the second quantity is the number of first template sub-values ​​in the c sets that are greater than the second template sub-values; each set of template sub-values ​​in the c sets corresponds to the same pixel.

[0241] In some embodiments, if a first number of first template sub-values ​​are less than or equal to a first number of second template sub-values ​​corresponding to the first number of first template sub-values ​​in b second template sub-values, and a second number of second template sub-values ​​are less than or equal to a second number of first template sub-values ​​corresponding to the second number of second template sub-values ​​in a second template value, and the first number is less than the second number, then the occlusion relationship between the first game character and the second game character is determined to be the second occlusion relationship.

[0242] In some embodiments, when the first number is less than the second number, it reflects that the presence of more pixels in the pixels corresponding to the second game character indicates that the second game character is closer to the camera model.

[0243] In related technologies, most side-scrolling fighting games do not have y-axis movement. Without y-axis movement, different game characters can be sorted according to fixed rules after overlapping, or push each other away after collision, without the need to achieve occlusion without "clipping". The virtual character display method provided in this application is a solution to maintain occlusion without "clipping" in side-scrolling fighting games when there is y-axis movement.

[0244] In some embodiments, when an overlap between a first game character and other game characters is detected, the template value of the first game character is read and then compared with the template values ​​of other game characters, thereby preventing "clipping" between the first game character and other game characters.

[0245] In some embodiments, the precision of the depth buffer is converted to an integer and stored in a 12-bit integer for subsequent sorting rendering commands. In the UE, the precision of the depth buffer is determined by the hardware and is typically a 24-bit or 32-bit floating-point number. This means that the depth buffer can store very fine-grained depth information for reference and comparison in subsequent pixel processing.

[0246] In some embodiments, a template value is set for each game character. In some embodiments, when using template technology, a template value can be set for each pixel to distinguish it in subsequent rendering. If no template value is set for a pixel, the template default value is used as its template value. In UE4, the default template default value is 0, which means that if no template value is explicitly set, the template value of all pixels will be 0.

[0247] In some embodiments, a base channel is specified to process the stencil values ​​corresponding to pixels in the stencil buffer. In some embodiments, the base channel is one of the channels in UE4 used to process the stencil values ​​corresponding to pixels in the stencil buffer. The base channel can specify information such as pixel depth and opacity to ensure correct occlusion culling during rendering. In UE4, the rendering pipeline sorts all objects in the scene and renders them according to their depth values. During this process, the base channel can specify the depth value of pixels to ensure correct occlusion culling during rendering. For example, the depth value of foreground objects can be set to be deeper than that of background objects, thus ensuring correct occlusion culling during rendering and achieving a more realistic effect. Additionally, the base channel can also specify pixel opacity information to ensure correct blending during rendering. For example, the opacity information of semi-transparent materials can be set to an appropriate value to ensure correct blending during rendering and achieve a more realistic effect.

[0248] In some embodiments, the specific implementation process of the virtual character display method provided in this application is as follows:

[0249] Step 1: When the first game character overlaps with the second game character, the engine will use template buffering technology to detect the first template value corresponding to the first game character and the second template value corresponding to the second game character.

[0250] Step 2: Read the first template value corresponding to the first game character and the second template value corresponding to the second game character, and compare the first template value corresponding to the first game character and the second template value corresponding to the second game character.

[0251] Step 3: If the first template value corresponding to the first game character is less than or equal to the second template value corresponding to the second game character, the occlusion relationship between the first game character and the second game character is determined as a first occlusion relationship, thereby preventing the first game character from passing through the second game character; if the first template value corresponding to the first game character is greater than the second template value corresponding to the second game character, the occlusion relationship between the first game character and the second game character is determined as a second occlusion relationship, thereby preventing the second game character from passing through the first game character.

[0252] Figure 10 A block diagram of a virtual character display device provided in an exemplary embodiment of this application is shown. The device includes:

[0253] The setting module 1010 is used to set template values ​​for different virtual characters in a 3D virtual environment.

[0254] In some embodiments, the three-dimensional virtual environment includes at least two virtual characters, each of which can move freely within the three-dimensional virtual environment. For example, the different virtual characters include a first virtual character and a second virtual character.

[0255] In some embodiments, the first virtual character and the second virtual character are controlled by different users on different terminals. For example, the first virtual character is controlled by a first user on a first terminal, and the second virtual character is controlled by a second user on a second terminal. In some embodiments, the first and second virtual characters are controlled by the same user on the same terminal. In some embodiments, the first virtual character is controlled by the user on the terminal, and the second virtual character is automatically controlled by the terminal. This application does not impose any limitations on these embodiments.

[0256] In some embodiments, template values ​​are set for each virtual character in the 3D virtual environment, on a per-character basis. For example, a first template value is set for a first virtual character, and a second template value is set for a second virtual character. In some embodiments, each virtual character in the 3D virtual environment is considered as a mesh model. Each mesh model is a basic 3D model composed of a series of vertices, faces, materials, textures, etc. Setting template values ​​for each virtual character is equivalent to setting template values ​​for each mesh model. For example, a first template value is set for the first mesh model corresponding to the first virtual character, and a second template value is set for the second mesh model corresponding to the second virtual character.

[0257] In some embodiments, setting a template value for each virtual character can be achieved by setting a template value for each pixel corresponding to the virtual character. In some embodiments, since each virtual character corresponds to at least one pixel, the template value for each virtual character can be understood as a set of template sub-values ​​for the pixels corresponding to the virtual character.

[0258] In some embodiments, the template value is used to indicate the distance between a virtual character (or a mesh model, or a skeletal point of the virtual character, or a point on the mesh model of the virtual character, or a pixel corresponding to the virtual character) and a camera model in a 3D virtual environment. In some embodiments, by using template technology, a template value can be set for each pixel corresponding to the virtual character.

[0259] The determination module 1020 is used to perform template testing based on the first template value corresponding to the first virtual character and the second template value corresponding to the second virtual character when the first virtual character and the second virtual character overlap, so as to determine the occlusion relationship between the first virtual character and the second virtual character.

[0260] In some embodiments, different virtual characters in a 3D virtual environment may overlap during activity. In this case, a template test is performed based on a first template value corresponding to a first virtual character and a second template value corresponding to a second virtual character. The template test method includes comparing the first template value and the second template value (corresponding to the same pixel). The purpose of the template test is to determine the occlusion relationship between the first virtual character and the second virtual character.

[0261] In some embodiments, when the first virtual character and the second virtual character overlap, the occlusion relationship between the first virtual character and the second virtual character includes a first occlusion relationship and a second occlusion relationship. The first occlusion relationship is that the first virtual character occludes in front of the second virtual character, and the second occlusion relationship is that the second virtual character occludes in front of the first virtual character.

[0262] The rendering module 1030 is used to render the first virtual character and the second virtual character to obtain display frames based on the occlusion relationship.

[0263] In some embodiments, the first virtual character and the second virtual character are rendered according to the determined occlusion relationship between the first virtual character and the second virtual character to obtain a display frame including the first virtual character and the second virtual character.

[0264] In some embodiments, based on the determined occlusion relationship between the first virtual character and the second virtual character, the first virtual character and the second virtual character are selectively rendered to obtain a display frame including the first virtual character and the second virtual character.

[0265] In some embodiments, when the occlusion relationship between the first virtual character and the second virtual character is a first occlusion relationship, the first virtual character is rendered in its entirety, and the parts of the second virtual character that do not overlap with the first virtual character are rendered in their entirety to obtain a display frame.

[0266] In some embodiments, when the occlusion relationship between the first virtual character and the second virtual character is a second occlusion relationship, the second virtual character is rendered in its entirety, and the parts of the first virtual character and the second virtual character that do not overlap are rendered in their entirety to obtain a display frame.

[0267] In some embodiments, based on the occlusion relationship between the first virtual character and the second virtual character, the rendered first virtual character and the second virtual character will not be displayed through each other. That is, the first virtual character and the second virtual character will be displayed according to their corresponding occlusion relationship.

[0268] In some embodiments, the template value for each virtual character is determined based on the distance between each virtual character and a camera model in the 3D virtual environment.

[0269] The setting module 1010 is also used to set template values ​​for different virtual characters based on the distance between different virtual characters and the camera model.

[0270] In some embodiments, the three-dimensional virtual environment is equipped with a camera model, which is used to image and display display frames including different virtual characters.

[0271] In some embodiments, a template value is set for each virtual character based on the distance between each virtual character (or mesh model, or skeletal points of the virtual character, or points on the mesh model of the virtual character, or corresponding pixels of the virtual character) and the camera model. Specifically, a template value is set for the corresponding pixels of each virtual character on the rendering plane based on the distance between each virtual character and the camera model.

[0272] In some embodiments, the template value is used to indicate the distance between the virtual character and the camera model. In some embodiments, the template value is proportional to this distance. For example, a smaller template value reflects a smaller distance between the virtual character and the camera model; a larger template value reflects a larger distance between the virtual character and the camera model.

[0273] In this application embodiment, the following three methods for setting template values ​​are specifically proposed:

[0274] Method 1: Set template values ​​based on the skeletal points corresponding to the virtual character;

[0275] The determination module 1020 is also used to determine at least one skeletal point corresponding to any virtual character in a three-dimensional virtual environment.

[0276] In some embodiments, for any virtual character in a 3D virtual environment, all skeletal points corresponding to that virtual character are determined. In this case, it can be assumed that the number and type of all skeletal points for each virtual character are consistent.

[0277] In some embodiments, for any virtual character in a 3D virtual environment, a subset of skeletal points corresponding to that virtual character are determined. Optionally, these subset of skeletal points are pre-selected skeletal points. Optionally, the subset of skeletal points corresponding to different virtual characters are the same. Optionally, the subset of skeletal points corresponding to different virtual characters are different.

[0278] In some embodiments, for any virtual character in a three-dimensional virtual environment, the skeletal points where the virtual character overlaps with other virtual characters are determined. Since the overlapping areas between different virtual characters may be the same or different, the skeletal points determined for different virtual characters may also be the same or different.

[0279] In some embodiments, the skeletal points corresponding to a virtual character can be understood as points used to control the movement of the mesh model corresponding to the virtual character. Optionally, the skeletal points corresponding to a virtual character can be understood as points located inside the mesh model corresponding to the virtual character, with each skeletal point used to drive a portion of the mesh or mesh points on the mesh model.

[0280] The setting module 1010 is also used to set template values ​​for each pixel associated with each bone point based on the distance between each bone point and the camera model in at least one bone point.

[0281] In some embodiments, each skeletal point is associated with at least one pixel. In some embodiments, the template value is the same as that of all pixels associated with each skeletal point.

[0282] Method 2: Set template values ​​based on the pixels corresponding to the virtual character;

[0283] The determining module 1020 is also used to determine at least one pixel point corresponding to any virtual character in the three-dimensional virtual environment.

[0284] In some embodiments, for any virtual character in a 3D virtual environment, all pixels corresponding to that virtual character are determined. In some embodiments, the number of all pixels corresponding to different virtual characters may be the same or different.

[0285] It should be noted that in this embodiment, the size of each pixel corresponding to different virtual characters is the same. Based on the above description of the embodiments, the pixels corresponding to the virtual characters in this embodiment refer to the points of the virtual characters on the corresponding rendering plane.

[0286] In some embodiments, the number of pixels corresponding to each virtual character is related to the size of the area occupied by the virtual character on the rendering plane.

[0287] In some embodiments, for any virtual character in a 3D virtual environment, a subset of pixels corresponding to that virtual character is determined. Optionally, these subset of pixels are pre-selected pixels. Optionally, the number of subsets of pixels corresponding to different virtual characters is the same. Optionally, the number of subsets of pixels corresponding to different virtual characters is different. Optionally, the positions of the subsets of pixels corresponding to different virtual characters are the same. Optionally, the positions of the subsets of pixels corresponding to different virtual characters are different.

[0288] In some embodiments, for any virtual character in a three-dimensional virtual environment, the pixels where the virtual character overlaps with other virtual characters are determined.

[0289] The setting module 1010 is also used to set template values ​​for each pixel in at least one pixel point according to the distance between the virtual character and the camera model.

[0290] In some embodiments, a template value is set for the corresponding pixel on the rendering plane for each virtual character (or mesh model, or skeletal point of the virtual character, or point on the mesh model of the virtual character, or pixel corresponding to the virtual character) based on the distance between each virtual character (or mesh model, or skeletal point of the virtual character, or point on the mesh model of the virtual character, or pixel corresponding to the virtual character) and the camera model.

[0291] Method 3: Set template values ​​based on pre-selected reference points.

[0292] The determination module 1020 is also used to determine at least one reference point corresponding to any virtual character in a three-dimensional virtual environment.

[0293] In some embodiments, at least one reference point includes a subset of pre-selected skeletal points from the skeletal points corresponding to the virtual character. In some embodiments, the skeletal points corresponding to different virtual characters may be the same or different.

[0294] In some embodiments, at least one reference point includes a pre-selected subset of pixels from the pixels corresponding to the virtual character. In some embodiments, the pixels corresponding to different virtual characters may be the same or different.

[0295] The setting module 1010 is also used to set template values ​​for each pixel associated with at least one reference point based on the distance between the virtual character and the camera model.

[0296] In some embodiments, each reference point is associated with at least one pixel. In some embodiments, the template value is the same for all pixels associated with each reference point.

[0297] It should be noted that different virtual characters may use the same or different methods to set template values.

[0298] In some embodiments, after setting corresponding template values ​​for different virtual characters in a 3D virtual environment, when at least two virtual characters overlap, the occlusion relationship between the at least two virtual characters can be determined based on their respective template values. In this embodiment, the overlap of a first virtual character and a second virtual character is used as an example for illustration.

[0299] In some embodiments, the occlusion relationship between the first virtual character and the second virtual character is determined by comparing the first template value of the first virtual character and the second template value of the second virtual character.

[0300] The determination module 1020 is also used to compare the first template value and the second template value when the first virtual character and the second virtual character overlap.

[0301] In some embodiments, when the first virtual character and the second virtual character overlap, the template values ​​of the first virtual character and the second virtual character at the overlap are compared. For example, assuming that region 1 of the first virtual character and region 2 of the second virtual character overlap, and the volume occupied by region 1 and region 2 is the same, and the region position occupied by region 1 and region 2 is the same, then the template value corresponding to region 1 and the template value corresponding to region 2 are compared.

[0302] In some embodiments, when comparing the template values ​​of the first virtual character and the second virtual character at their overlap, that is, when comparing the template value corresponding to region 1 and the template value corresponding to region 2, since the volume occupied by region 1 and region 2 is the same, and the position of the region occupied by region 1 and region 2 is the same, it can be considered that the number of pixels corresponding to region 1 and region 2 is the same, and the position of the pixels corresponding to region 1 and region 2 is the same. In this case, the template sub-values ​​included in the template value corresponding to region 1 correspond one-to-one with the template sub-values ​​included in the template value corresponding to region 2.

[0303] The determining module 1020 is further configured to determine the occlusion relationship between the first virtual character and the second virtual character as the first occlusion relationship when the first template value is less than or equal to the second template value.

[0304] In some embodiments, if the first template value corresponding to the first virtual character is less than or equal to the second template value corresponding to the second virtual character, it reflects that the first distance of the first virtual character relative to the camera model is less than or equal to the second distance of the second virtual character relative to the camera model.

[0305] In some embodiments, when the first distance between the first virtual character and the camera model is less than or equal to the second distance between the second virtual character and the camera model, the occlusion relationship between the first virtual character and the second virtual character is determined to be a first occlusion relationship. The first occlusion relationship is that the first virtual character occludes in front of the second virtual character.

[0306] In some embodiments, the first template value corresponding to the first virtual character includes *a* first template sub-values, where *a* is an integer greater than 0. The second template value corresponding to the second virtual character includes *b* second template sub-values, where *b* is an integer greater than 0.

[0307] Optionally, the values ​​of a and b are equal. Optionally, the values ​​of a and b are not equal. Optionally, the first template sub-values ​​a and the second template sub-values ​​b are obtained by setting them in the same or different ways.

[0308] It's important to understand that, generally, all first template sub-values ​​in group 'a' are obtained by setting them in the same way, and all second template sub-values ​​in group 'b' are obtained by setting them in the same way. However, in some special cases, the first template sub-values ​​in group 'a' may be obtained by setting them in different ways. Or, the second template sub-values ​​in group 'b' may also be obtained by setting them in different ways. For example, the first template sub-values ​​in group 'a' include first template sub-value 1 and first template sub-value 2, where first template sub-value 1 is obtained by setting it in method one above, and first template sub-value 2 is obtained by setting it in method two above.

[0309] In some embodiments, if at least one of the a first template sub-values ​​is less than or equal to the minimum value among the b second template sub-values, the occlusion relationship between the first virtual character and the second virtual character is determined as a first occlusion relationship. That is, at least one pixel among the pixels corresponding to the first virtual character indicates that the distance between the first virtual character and the camera model is less than or equal to the distance between the second virtual character and the camera model indicated by all the pixels corresponding to the second virtual character.

[0310] In some embodiments, when there are c sets of template sub-values ​​that overlap between a first template sub-values ​​and b second template sub-values, the size relationship between the first template sub-values ​​and the second template sub-values ​​in each set of template sub-values ​​in the c sets is compared; when the first quantity is greater than or equal to the second quantity, the occlusion relationship between the first virtual character and the second virtual character is determined to be the first occlusion relationship, the first quantity is the number of first template sub-values ​​in the c sets that are less than or equal to the second template sub-values, and the second quantity is the number of first template sub-values ​​in the c sets that are greater than the second template sub-values; each set of template sub-values ​​in the c sets corresponds to the same pixel.

[0311] In some embodiments, if a first number of first template sub-values ​​are less than or equal to a first number of second template sub-values ​​corresponding to the first number of first template sub-values ​​in b second template sub-values, and a second number of second template sub-values ​​are less than or equal to a second number of first template sub-values ​​corresponding to the second number of second template sub-values ​​in a second template value, and the first number is greater than or equal to the second number, then the occlusion relationship between the first virtual character and the second virtual character is determined as the first occlusion relationship.

[0312] The determination module 1020 is also used to determine the occlusion relationship between the first virtual character and the second virtual character as the second occlusion relationship when the first template value is greater than the second template value.

[0313] In some embodiments, if the first template value corresponding to the first virtual character is greater than the second template value corresponding to the second virtual character, it reflects that the first distance of the first virtual character relative to the camera model is greater than the second distance of the second virtual character relative to the camera model.

[0314] In some embodiments, when a first distance between the first virtual character and the camera model is greater than a second distance between the second virtual character and the camera model, the occlusion relationship between the first virtual character and the second virtual character is determined to be a second occlusion relationship. The second occlusion relationship is that the second virtual character occludes in front of the first virtual character.

[0315] In some embodiments, if the minimum value among the a first template sub-values ​​is greater than at least one of the b second template sub-values, the occlusion relationship between the first virtual character and the second virtual character is determined to be a second occlusion relationship. That is, at least one pixel among the pixels corresponding to the second virtual character indicates that the distance between the second virtual character and the camera model is less than or equal to the distance between the first virtual character and the camera model indicated by all the pixels corresponding to the first virtual character.

[0316] In some embodiments, when there are c groups of template sub-values ​​that overlap between a first template sub-values ​​and b second template sub-values, the size relationship between the first template sub-values ​​and the second template sub-values ​​in each group of template sub-values ​​in the c groups is compared; when the first quantity is less than the second quantity, the occlusion relationship between the first virtual character and the second virtual character is determined as the second occlusion relationship, the first quantity is the number of first template sub-values ​​in the c groups that are less than or equal to the second template sub-values, and the second quantity is the number of first template sub-values ​​in the c groups that are greater than the second template sub-values; each group of template sub-values ​​in the c groups corresponds to the same pixel.

[0317] In some embodiments, if a first number of first template sub-values ​​in a first template sub-values ​​are less than or equal to a first number of second template sub-values ​​in b second template sub-values ​​that correspond to the first number of first template sub-values, and b second template sub-values ​​in b second template sub-values ​​are less than or equal to a second number of first template sub-values ​​that correspond to the second number of second template sub-values, and the first number is less than the second number, then the occlusion relationship between the first virtual character and the second virtual character is determined to be the second occlusion relationship.

[0318] Figure 11 A schematic diagram of a computer device provided in an exemplary embodiment of this application is shown. Indicatively, the computer device 1100 includes a Central Processing Unit (CPU) 1101, a system memory 1104 including Random Access Memory (RAM) 1102 and Read-Only Memory (ROM) 1103, and a system bus 1105 connecting the system memory 1104 and the CPU 1101. The computer device 1100 also includes a basic input / output system 1106 to facilitate information transfer between various devices within the computer, and a mass storage device 1107 for storing an operating system 1113, application programs 1114, and other program modules 1115.

[0319] The basic input / output system 1106 includes a display 1108 for displaying information and an input device 1109 for user input, such as a mouse or keyboard. Both the display 1108 and the input device 1109 are connected to the central processing unit 1101 via an input / output controller 1110 connected to the system bus 1105. The basic input / output system 1106 may also include the input / output controller 1110 for receiving and processing input from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 1110 also provides output to a display screen, printer, or other types of output devices.

[0320] The mass storage device 1107 is connected to the central processing unit 1101 via a mass storage controller (not shown) connected to the system bus 1105. The mass storage device 1107 and its associated computer-readable media provide non-volatile storage for the computer device 1100. That is, the mass storage device 1107 may include computer-readable media (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0321] The computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer storage media are not limited to the above-mentioned types. The system memory 1104 and mass storage device 1107 described above can be collectively referred to as memory.

[0322] According to various embodiments of this application, the computer device 1100 can also be connected to a remote computer on a network, such as the Internet. That is, the computer device 1100 can be connected to the network 1112 via the network interface unit 1111 connected to the system bus 1105, or the network interface unit 1111 can be used to connect to other types of networks or remote computer systems (not shown).

[0323] An exemplary embodiment of this application also provides a computer-readable storage medium storing at least one program, which is loaded and executed by a processor to implement the virtual character display method provided in the above-described method embodiments.

[0324] An exemplary embodiment of this application also provides a computer program product, which includes at least one program segment stored in a readable storage medium; the processor of the communication device reads signaling from the readable storage medium, and the processor executes the signaling to cause the communication device to perform a method for displaying virtual characters provided in the above-described method embodiments.

[0325] It should be understood that "a plurality of" as used herein refers to two or more. Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0326] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0327] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent switching, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for displaying a virtual character, characterized in that, The method is performed by a computer device, and the method includes: Template values ​​are set for different virtual characters in a three-dimensional virtual environment, including a first virtual character and a second virtual character. In the case where the first virtual character and the second virtual character overlap, a template test is performed based on the first template value corresponding to the first virtual character and the second template value corresponding to the second virtual character to determine the occlusion relationship between the first virtual character and the second virtual character. Based on the occlusion relationship, the first virtual character and the second virtual character are rendered to obtain a display frame.

2. The method according to claim 1, characterized in that, In the case where the first virtual character and the second virtual character overlap, template testing is performed based on the first template value corresponding to the first virtual character and the second template value corresponding to the second virtual character to determine the occlusion relationship between the first virtual character and the second virtual character, including: In the case where the first virtual character and the second virtual character overlap, compare the first template value and the second template value; If the first template value is less than or equal to the second template value, the occlusion relationship between the first virtual character and the second virtual character is determined to be a first occlusion relationship; or, if the first template value is greater than the second template value, the occlusion relationship between the first virtual character and the second virtual character is determined to be a second occlusion relationship. Wherein, the first occlusion relationship is that the first virtual character is occluded in front of the second virtual character, and the second occlusion relationship is that the second virtual character is occluded in front of the first virtual character.

3. The method according to claim 2, characterized in that, The first template value includes a first template sub-values ​​corresponding to the first virtual character, and the second template value includes b second template sub-values ​​corresponding to the second virtual character; The step of determining the occlusion relationship between the first virtual character and the second virtual character as a first occlusion relationship when the first template value is less than or equal to the second template value includes: If at least one of the a first template sub-values ​​is less than or equal to the minimum value among the b second template sub-values, then the occlusion relationship between the first virtual character and the second virtual character is determined to be the first occlusion relationship; or, In the case where c sets of template sub-values ​​overlap between the a first template sub-values ​​and the b second template sub-values, the size relationship between the first template sub-values ​​and the second template sub-values ​​in each of the c sets of template sub-values ​​is compared; if the first quantity is greater than or equal to the second quantity, the occlusion relationship between the first virtual character and the second virtual character is determined to be the first occlusion relationship, where the first quantity is the number of first template sub-values ​​less than or equal to the second template sub-values ​​in the c sets of template sub-values, and the second quantity is the number of first template sub-values ​​greater than the second template sub-values ​​in the c sets of template sub-values; each set of template sub-values ​​in the c sets of template sub-values ​​corresponds to the same pixel. Where a is a positive integer greater than 0, b is a positive integer greater than 0, and c is a positive integer less than or equal to a and less than or equal to b.

4. The method according to claim 3, characterized in that, The step of determining the occlusion relationship between the first virtual character and the second virtual character as a second occlusion relationship when the first template value is greater than the second template value includes: If the minimum value among the a first template sub-values ​​is greater than at least one second template sub-value among the b second template sub-values, then the occlusion relationship between the first virtual character and the second virtual character is determined to be the second occlusion relationship; or, In the case where there are c sets of template sub-values ​​that overlap between the a first template sub-values ​​and the b second template sub-values, the size relationship between the first template sub-values ​​and the second template sub-values ​​in each group of template sub-values ​​in the c sets is compared; when the first quantity is less than the second quantity, the occlusion relationship between the first virtual character and the second virtual character is determined to be the second occlusion relationship, where the first quantity is the number of first template sub-values ​​in the c sets that are less than or equal to the second template sub-values, and the second quantity is the number of first template sub-values ​​in the c sets that are greater than the second template sub-values; each group of template sub-values ​​in the c sets corresponds to the same pixel.

5. The method according to any one of claims 1 to 4, characterized in that, The step of rendering the first virtual character and the second virtual character to obtain display frames based on the occlusion relationship includes: When the occlusion relationship between the first virtual character and the second virtual character is the first occlusion relationship, the first virtual character is fully rendered, and the non-overlapping portions of the second virtual character are also fully rendered to obtain the display frame; or, When the occlusion relationship between the first virtual character and the second virtual character is the second occlusion relationship, the second virtual character is rendered in its entirety, and the parts of the first virtual character and the second virtual character that do not overlap are rendered in their entirety to obtain the display frame.

6. The method according to any one of claims 1 to 5, characterized in that, A camera model is also set up in the three-dimensional virtual environment; The process of setting template values ​​for different virtual characters in a 3D virtual environment includes: Based on the distance between the different virtual characters and the camera model, the template value is set for each of the different virtual characters.

7. The method according to claim 6, characterized in that, The method further includes: For any virtual character in the three-dimensional virtual environment, determine at least one skeletal point corresponding to the virtual character; The step of setting template values ​​for different virtual characters based on the distance between the different virtual characters and the camera model includes: Based on the distance between each of the at least one skeleton point and the camera model, the template value is set for the pixel associated with each skeleton point.

8. The method according to claim 6, characterized in that, The method further includes: For any virtual character in the three-dimensional virtual environment, determine at least one pixel corresponding to the virtual character; The step of setting template values ​​for different virtual characters based on the distance between the different virtual characters and the camera model includes: Based on the distance between the virtual character and the camera model, the template value is set for each pixel in the at least one pixel.

9. The method according to claim 6, characterized in that, The method further includes: For any virtual character in the three-dimensional virtual environment, at least one reference point corresponding to the virtual character is determined. The at least one reference point includes a subset of skeletal points pre-selected from the skeletal points corresponding to the virtual character, or the at least one reference point includes a subset of pixel points pre-selected from the pixel points corresponding to the virtual character. The step of setting template values ​​for different virtual characters based on the distance between the different virtual characters and the camera model includes: Based on the distance between the virtual character and the camera model, the template value is set for the pixel associated with each of the at least one reference point.

10. A display device for a virtual character, characterized in that, The device includes: The settings module is used to set template values ​​for different virtual characters in a three-dimensional virtual environment, including a first virtual character and a second virtual character. The determination module is used to perform template testing based on the first template value corresponding to the first virtual character and the second template value corresponding to the second virtual character when the first virtual character and the second virtual character overlap, so as to determine the occlusion relationship between the first virtual character and the second virtual character. The rendering module is used to render the first virtual character and the second virtual character to obtain display frames based on the occlusion relationship.

11. A computer device, characterized in that, The computer device includes a processor and a memory, wherein the memory stores at least one program, which is loaded and executed by the processor to implement the method for displaying a virtual character as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one program, which is loaded and executed by a processor to implement the method for displaying a virtual character as described in any one of claims 1 to 9.

13. A computer program product, characterized in that, The computer program product includes at least one program segment stored in a computer-readable storage medium; a processor of a computer device reads the at least one program segment from the computer-readable storage medium, and the processor executes the at least one program segment, causing the computer device to perform the method for displaying a virtual character as described in any one of claims 1 to 9.