Display method, device, electronic equipment and readable storage medium in game
By generating a hollowed-out ink wash outline effect through multiple vertex expansions and multi-pass rendering, the problem of insufficient spatial sense and monotonous style of virtual outlines is solved, and the spatial sense of virtual models and ink wash style outline effects are realized.
Patent Information
- Application Number
- CN202411846853.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2044-12-13
AI Technical Summary
Existing virtual outlines in games suffer from poor spatial sense and lack stylized brushstroke expression.
The process involves generating a hollowed-out ink wash painting effect by expanding the vertex outwards multiple times. This includes multiple rendering passes, gradually expanding the outline and hollowed-out parts of the virtual model. Transparency and depth tests are used to generate an outline effect with a sense of space and ink wash painting style.
The virtual outlines have been given a greater sense of space and a dry brushstroke effect reminiscent of ink painting, which enhances the display of the virtual model.
Smart Images

Figure CN119919553B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically to a display method, apparatus, electronic device, and readable storage medium in a game. Background Technology
[0002] In the game, virtual outlines can be generated for virtual models. These virtual outlines can highlight the outlines of virtual models and improve their display effect.
[0003] However, current virtual strokes are usually too close to the virtual model, making them appear crowded and lacking a sense of space. In addition, current virtual strokes are rather monotonous and lack stylized brushstroke expression. Summary of the Invention
[0004] This disclosure provides a display method, apparatus, electronic device, and readable storage medium in a game to solve or at least partially solve the above-mentioned problems, as detailed below.
[0005] In a first aspect, this disclosure provides a display method in a game, the game including a virtual model, the method comprising:
[0006] In response to a rendering instruction for the virtual model, the virtual model is rendered to obtain the color data of the virtual model;
[0007] The virtual model is expanded to its first vertex to obtain the first model;
[0008] Based on the first model, generate color data for the first hollow portion located between the virtual model and the outline portion;
[0009] The virtual model is expanded a second time to obtain a second model; the expansion distance of the second expansion is greater than the expansion distance of the first expansion.
[0010] Based on the second model, color data for the second hollow portion located between the outline portion and the first hollow portion is generated;
[0011] The virtual model is expanded a third time to obtain a third model; at least some vertices of the virtual model have an expansion distance greater than that of the second vertex expansion.
[0012] The color data of the first stroke portion in the stroke portion is generated based on the third model;
[0013] The virtual model is expanded a fourth time to obtain a fourth model; the expansion distance of the fourth expansion is greater than the expansion distance of the third expansion.
[0014] Based on the fourth model, generate color data for the second stroke portion, which is located on the side of the first stroke portion that is far away from the virtual model;
[0015] Based on the color and depth data of the virtual model, the color and depth data of the first hollowed-out portion, the color and depth data of the second hollowed-out portion, the color data of the first outline portion, and the color data of the second outline portion, the virtual model with a hollowed-out ink wash outline effect is displayed.
[0016] Secondly, this disclosure also provides a display device for a game, the game including a virtual model, the device comprising:
[0017] A rendering module is used to render the virtual model in response to a rendering command for the virtual model, and obtain the color data of the virtual model;
[0018] The first vertex expansion module is used to perform the first vertex expansion on the virtual model to obtain the first model;
[0019] The first generation module is used to generate color data for the first hollow portion located between the virtual model and the outline portion based on the first model;
[0020] The second vertex expansion module is used to expand the virtual model a second time to obtain a second model; the expansion distance of the second vertex expansion is greater than the expansion distance of the first vertex expansion.
[0021] The second generation module is used to generate color data of the second hollow portion located between the outline portion and the first hollow portion based on the second model;
[0022] The third vertex expansion module is used to perform a third vertex expansion on the virtual model to obtain a third model; at least some vertices of the virtual model have an expansion distance greater than that of the second vertex expansion.
[0023] The third generation module is used to generate color data of the first stroke portion in the stroke portion based on the third model;
[0024] The fourth vertex expansion module is used to perform a fourth vertex expansion on the virtual model to obtain a fourth model; the expansion distance of the fourth vertex expansion is greater than the expansion distance of the third vertex expansion.
[0025] The fourth generation module is used to generate color data of the second stroke portion, which is located on the side of the first stroke portion away from the virtual model, based on the fourth model;
[0026] The display module is used to display the virtual model with a hollowed-out ink wash outline effect based on the color data and depth data of the virtual model, the color data and depth data of the first hollowed-out part, the color data and depth data of the second hollowed-out part, the color data of the first outline part, and the color data of the second outline part.
[0027] Thirdly, this disclosure also provides an electronic device, including: a processor, a memory, and computer program instructions stored in the memory and executable on the processor;
[0028] When the processor executes the computer program instructions, it implements the display method in the game as described in the first aspect above.
[0029] Fourthly, this disclosure also provides a computer-readable storage medium storing computer program instructions, which, when executed by a processor, are used to implement the display method in the game as described in the first aspect above.
[0030] The exemplary embodiments disclosed herein have the following beneficial effects:
[0031] In an exemplary embodiment of this disclosure, a model can be rendered in response to a rendering command to obtain the model's color data; the model can be expanded outwards for the first time to obtain a first model; color data of a first hollowed-out portion can be generated based on the first model; the model can be expanded outwards for the second time to obtain a second model; color data of a second hollowed-out portion can be generated based on the second model; the model can be expanded outwards for the third time to obtain a third model; color data of a first outline portion can be generated based on the third model; the model can be expanded outwards for the fourth time to obtain a fourth model; color data of a second outline portion can be generated based on the fourth model; and a model with a hollowed-out ink wash outline effect can be displayed based on the model's color depth data, the color depth data of the first hollowed-out portion, the color depth data of the second hollowed-out portion, the color data of the first outline portion, and the color data of the second outline portion. In this disclosure, by generating a first hollowed-out portion, a certain distance is left between the outline and the model, thus achieving a hollowed-out outline effect and enhancing the spatial sense of the outline; by generating a second hollowed-out portion, the side of the outline facing the model has a dry brushstroke effect in the style of ink painting; the outline is achieved by generating the first outline portion; and the outline has a dry brushstroke effect in the style of ink painting on the side of the outline facing away from the model by generating the second outline portion. Attached Figure Description
[0032] Figure 1 This is a flowchart illustrating a display method in a game according to one embodiment of this disclosure;
[0033] Figure 2This is a schematic diagram of a hollowed-out outline effect provided in one embodiment of the present disclosure;
[0034] Figure 3 This is a schematic diagram of a hollowed-out outline effect provided in one embodiment of the present disclosure;
[0035] Figure 4 This is a block diagram of a display device in a game provided in one embodiment of the present disclosure;
[0036] Figure 5 This is a schematic diagram of the logical structure of an electronic device for implementing displays in a game, provided in one embodiment of this disclosure. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. Based on the embodiments of this disclosure, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this disclosure.
[0038] The terms “a,” “an,” “the,” and “the” are used in this specification to indicate the presence of one or more elements / components / etc.; the terms “including” and “having” are used to indicate an open-ended inclusion and to mean that there may be other elements / components / etc. in addition to the listed elements / components / etc.; the terms “first” and “second” are used only as markings and are not a limitation on the number of objects.
[0039] It should be understood that in the embodiments of this disclosure, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "Containing A, B, and / or C" means containing any one, two, or three of A, B, and C.
[0040] It should be understood that in the embodiments of this disclosure, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined based on A. Determining B based on A does not mean that B is determined solely based on A; B can also be determined based on A and / or other information.
[0041] In one embodiment of this disclosure, the display method in the game can run on a local terminal device or a server. When the display method in the game runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0042] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separated. The storage and execution of the game's display methods are completed on the cloud gaming server. The client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, or PDA; however, the information processing is performed by the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.
[0043] In an alternative implementation, taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the player through a graphical user interface (GUI), i.e., conventionally by downloading, installing, and running the game program via an electronic device. The local terminal device can provide the GUI to the player in various ways, such as rendering it on the terminal's display screen or providing it to the player via holographic projection. For example, the local terminal device may include a display screen for displaying the GUI, which includes game screens, and a processor for running the game, generating the GUI, and controlling the display of the GUI on the display screen.
[0044] In one possible implementation, this disclosure provides a display method in a game, which provides a graphical user interface through a terminal device, wherein the terminal device may be the aforementioned local terminal device or a client device in the aforementioned cloud interactive system.
[0045] The execution entity of this method can be a terminal device or a server. The terminal device can be a desktop computer, laptop computer, tablet computer, mobile phone, or other electronic device; this disclosure does not specifically limit it. The server is used to provide background services for the client of the application in the terminal device. For example, the server can be the background server of the aforementioned application. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms; this disclosure does not specifically limit it.
[0046] Before describing the embodiments of this disclosure in detail, the relevant technical terms will be introduced first.
[0047] 1. Multi-pass rendering
[0048] Multi-pass rendering refers to the process of dividing the rendering task into multiple stages (passes) during the rendering of geometric graphics (such as vector graphics and 3D models). Each stage handles different tasks, and the results of these stages are finally combined to generate the final image to be displayed. Each pass goes through the underlying graphics rendering process, including vertex calculation, rasterization, and shading, to obtain a frame of data.
[0049] This disclosure allows for the generation of a virtual model with a hollowed-out ink wash outline effect through multiple passes of rendering, as will be described in detail in the embodiments of this disclosure.
[0050] 2. Frame buffer
[0051] The frame buffer is used to store and present image data to be displayed. Each storage unit in the frame buffer corresponds to a pixel on the screen, and the entire frame buffer corresponds to one frame of image. The frame buffer includes a color buffer and a depth buffer (also called a Z-buffer). The color buffer stores the color information of the pixels, and the depth buffer stores the depth information of the pixels, that is, the distance between the pixels and the virtual camera in the view space.
[0052] During the rendering process, the color buffer first receives the rendering results of the graphic colors, and then determines the color value of each pixel on the screen based on factors such as occlusion.
[0053] During rendering, depth testing can be used to determine pixel visibility, preventing the rendering of occluded pixels and improving rendering efficiency. Depth testing involves comparing the depth value of the pixel corresponding to the current graphic on the screen with the depth value cached in the current depth buffer for that pixel to determine the occlusion relationship between the current graphic and previously rendered graphics. If the depth value of the current graphic is less than the cached depth value, it means the current graphic is occluding a previously rendered graphic. In this case, the color value cached for that pixel in the color buffer is overwritten by the color value of the current graphic, and the depth value in the depth buffer is overwritten by the color value of the current graphic. Otherwise, the color and depth values corresponding to that pixel in the current graphic are discarded, while the cached color and depth values remain unchanged.
[0054] 3. Transparency Testing
[0055] Transparency testing, also known as transparency analysis, determines which pixels' latest rendering data should be retained and which should be discarded by comparing the transparency of the pixel's latest rendering data with a threshold. If the transparency of a pixel's latest rendering data is less than the threshold, the pixel's latest rendering data is discarded without affecting the cached data for that pixel in the frame buffer; otherwise, the pixel's latest rendering data is retained, overwriting the cached data for that pixel in the frame buffer, thus updating the data in the frame buffer.
[0056] 4. Transparent Mixing
[0057] Transparency blending, also known as transparency blending, refers to blending the color of a graphic with the background color according to the transparency of the graphic, thereby achieving a semi-transparent effect.
[0058] 5. Front-side rejection and back-side rejection
[0059] In graphics rendering, each polygon (such as a triangle) has two faces: a front face and a back face. Face culling allows developers to choose to render only the face of the graphic that faces the viewer (the front face) and discard the face that faces away from the viewer (the back face). Backface culling allows developers to choose to render only the face that faces away from the viewer (the back face) and discard the face that faces the viewer (the front face). Face culling and backface culling can remove the front or back face of a graphic during the graphics rendering process. The culled face does not need to be rendered; only the retained face is rendered, thereby optimizing rendering performance and reducing unnecessary computation.
[0060] 6. Rasterization
[0061] Rasterization is a computer graphics technique used to convert geometric shapes (such as vector graphics and 3D models) into raster images composed of pixels. The rasterization process occurs after vertex calculations performed by the vertex shader (such as the vertex expansion process described in this disclosure) and before pixel shading performed by the pixel shader, thus converting geometry into pixels.
[0062] Figure 1 This disclosure illustrates a display method in a game, including virtual models, as shown in one embodiment of the present disclosure. Figure 1 As shown, the method includes the following steps S101 to S110.
[0063] Step S101: In response to the rendering command for the virtual model, render the virtual model and obtain the color data of the virtual model.
[0064] Before proceeding with this step, we will first describe the preparatory work that can be performed in an exemplary embodiment.
[0065] One approach is to increase the number of faces in the virtual model to reduce the segmentation of the outline and make it smoother. This is because the outline scheme based on the expansion of model vertices will enhance the segmentation of polygons, so increasing the number of faces in the virtual model can prevent the outline from being visually segmented.
[0066] Another aspect is the preparation of vertex normals for the virtual model. Two sets of vertex normals can be stored for the virtual model. One set contains unprocessed vertex normals. In this set, if a vertex is shared by multiple faces belonging to different smoothing groups, then that vertex has a corresponding vertex normal on each face. In the other set, if a vertex has multiple vertex normals, these multiple normals are averaged to obtain the corresponding smoothing normal. In this set, a vertex has only one corresponding smoothing normal. For ease of description and distinction, the first set of vertex normals will be simply referred to as vertex normals, and the second set as smoothing normals.
[0067] Another step is preparing the data required for vertex expansion. To achieve a hollowed-out ink wash stroke effect, a first preset expansion distance and a second preset expansion distance can be set. The first preset expansion distance represents the vertex expansion distance related to generating the hollowed-out part, and the second preset expansion distance represents the vertex expansion distance related to generating the stroke part.
[0068] To reduce the number of textures required for rendering, the first and second preset expansion distances can be stored in the color channels (e.g., any two color channels) of the vertices of the virtual model. For example, the first preset expansion distance can be stored in the r-channel of the virtual model's vertices, and the second preset expansion distance can be stored in the g-channel; or, the first preset expansion distance can be stored in the g-channel, and the second preset expansion distance can be stored in the b-channel; or, the first preset expansion distance can be stored in the g-channel, and the second preset expansion distance can be stored in the r-channel.
[0069] Optionally, in order to make both the hollowed-out part and the outline part have certain thickness variations, the first preset outward expansion distance and the second preset outward expansion distance corresponding to the vertex can be stored in the color channel of the vertex of the virtual model, so that different vertices have different hollowed-out widths and different outline widths.
[0070] Optionally, the virtual model can be copied into two copies. A color brush can be used to paint the first color channel (e.g., r channel) of the vertices of one virtual model, and the color value painted on the first color channel of the vertex is the first preset outward distance of that vertex. A color brush can also be used to paint the second color channel (e.g., g channel) of the vertices of the other virtual model, and the color value painted on the second color channel of the vertex is the second preset outward distance of that vertex. Then, the vertex colors of the two virtual models can be merged to obtain the vertex colors of the virtual model.
[0071] The following describes the steps.
[0072] In exemplary embodiments, the virtual model may include one or more of the following: character model, object model, building model, and this disclosure does not specifically limit the type of model.
[0073] In this step, in response to rendering instructions for the virtual model, basic physical rendering of the virtual model can be performed first through the first pass.
[0074] In an exemplary embodiment, the virtual model can be rendered in this step by: configuring the transparency of the virtual model to be opaque; performing backface culling on the virtual model; and rendering the front of the virtual model based on the current lighting information and the pre-configured base color map to obtain the color data of the virtual model.
[0075] In the above embodiment, only the front of the virtual model is rendered in the first pass. The virtual model is opaque, and its color needs to take into account the lighting effect on top of the base color map. The color calculation considering lighting can be performed based on the light source direction, the viewing direction, and the model normal direction (here, the first set of vertex normals mentioned above is used). For example, in diffuse reflection calculation, if the model normal direction of a pixel is closer to the light source direction, then the pixel will be brighter; conversely, it will be darker. In specular reflection calculation, the brightness of the specular pixels is calculated based on the model normal direction, the light source direction, and the viewing direction. In shadow calculation, by comparing the model normal direction of a pixel with the light source direction, it can be determined whether the pixel is in shadow.
[0076] In the first pass, the color data of the virtual model is written to the color buffer and the depth data is written to the depth buffer through depth testing. The first pass allows rendering of the virtual model's appearance under lighting conditions.
[0077] Step S102: Perform the first vertex expansion on the virtual model to obtain the first model.
[0078] Step S103: Generate color data for the first hollowed-out portion located between the virtual model and the outline portion based on the first model.
[0079] In this disclosure, reference is made to Figure 2 It is necessary to generate an outline portion 02 (sometimes referred to as an outline in the text) for the virtual model 01, and generate a hollow portion 03 between the virtual model 01 and the outline portion 02. The outline portion 02 includes at least a first outline portion 021 and a second outline portion 022. The second outline portion 022 can be further away from the virtual model than the first outline portion 021. The hollow portion 03 includes at least a first hollow portion 031 and a second hollow portion 032. The second hollow portion 032 can be further away from the virtual model than the first hollow portion 031.
[0080] Steps S102 and S103 constitute the second pass, which is used to render the first hollowed-out portion. In the second pass, the color components of the virtual model's vertex colors in the first color channel are first read, i.e., the first preset expansion distance corresponding to each vertex is read. Then, based on this first preset expansion distance, the virtual model undergoes a first vertex expansion. Vertex expansion involves moving the vertices of the virtual model along the smooth normal direction corresponding to each vertex. The expansion distance of a vertex during the first vertex expansion can be determined based on the first preset expansion distance. For example, the expansion distance of a vertex during the first vertex expansion can be equal to the product of the first preset expansion distance and a first preset parameter. Performing the first vertex expansion on the virtual model yields the first model. The above process can be implemented using a vertex shader.
[0081] After obtaining the first model through the first vertex expansion, the transparency of the first model can be configured to be completely transparent, and the color of the first model can be configured to a preset color, such as black. The above process can be implemented using a pixel shader. For example, taking black as the preset color, the output of the pixel shader for each vertex of the first model can be rgba = (0,0,0,0).
[0082] Then, the color of the first model can be transparently blended based on its transparency to obtain the color data of the first cutout portion. That is, the color of the first model and the current background color are transparently blended using the transparency of the first model as a weight, where the current background color is the cached color data in the current color buffer. Specifically, for a pixel on the screen corresponding to the first model, the latest color of that pixel = a * the color data of the first model at that pixel + (1-a) * the cached color data of that pixel in the current color buffer, where a is the transparency of the first model at that pixel.
[0083] In the second pass, the color data of the first cutout portion can be written to the color buffer through a depth test, and the depth data of the first cutout portion (i.e., the depth of the first model) can be written to the depth buffer. Through the second pass, the first cutout portion between the virtual model and the stroke portion can be rendered. In this way, some distance is left between the stroke portion and the virtual model, so that the stroke portion does not stick to the virtual model and avoids the feeling of crowding between the virtual model and the stroke portion.
[0084] Step S104: Perform a second vertex expansion on the virtual model to obtain a second model; the expansion distance of the second vertex expansion is greater than the expansion distance of the first vertex expansion.
[0085] Step S105: Generate color data for the second cutout portion located between the outline portion and the first cutout portion based on the second model.
[0086] Steps S104 and S105 constitute the third pass, which is used to render the second hollowed-out portion. In the third pass, the virtual model is first expanded outwards for the second time to obtain the second model, and then the color data of the second hollowed-out portion is generated based on the second model.
[0087] The second vertex expansion of the virtual model can refer to the viewing process of the first vertex expansion. The difference between the second and first vertex expansions is that the expansion distance of all vertices in the virtual model during the second expansion is greater than the expansion distance during the first expansion. In an optional embodiment, the expansion distance of a vertex during the second expansion can be equal to the product of a first preset expansion distance and a second preset parameter, where the second preset parameter can be greater than the first preset parameter, thus ensuring that the expansion distance of the vertex during the second expansion is greater than the expansion distance during the first expansion. This process can be implemented using a vertex shader.
[0088] After obtaining the second model through the second vertex expansion, the transparency of the second model can be configured to be completely transparent, and the color of the second model can be configured to a preset color, such as black. The above process can be implemented using a pixel shader. For example, taking black as the preset color, the output of the pixel shader for each vertex of the second model can be rgba = (0,0,0,0).
[0089] Subsequently, a transparency test can be performed on the color of the second model based on the pre-configured noise map to obtain the color data of the second hollowed-out portion. During the transparency test, considering that all pixels corresponding to the second model have the same transparency (completely transparent), comparing them with a preset threshold would lead to two extreme results: either all pixels corresponding to the second model are discarded, or all are retained. Therefore, in the third pass of the transparency test, the pre-configured noise map, which has the same resolution as the screen, can be sampled. The sampling result for a certain pixel (i.e., the grayscale value of that pixel) is compared with the preset threshold, thereby randomly discarding some pixels. This allows the subsequently generated outline portion to be visible through the discarded pixels of the second model, giving the outline portion a dry ink brushstroke effect on the side near the hollowed-out portion. Optionally, the pre-configured noise map can be a 2D noise map, such as a Burmester noise map; this disclosure does not specifically limit it.
[0090] In the third pass, the color data of the second cutout section can be written to the color buffer through a depth test, and the depth data of the second cutout section (i.e., the depth of the second model) can be written to the depth buffer. Through the third pass, the second cutout section between the virtual model and the outline section can be rendered.
[0091] Step S106: Perform a third vertex expansion on the virtual model to obtain a third model; at least some vertices of the virtual model have an expansion distance greater than that of the second vertex expansion during the third vertex expansion.
[0092] Step S107: Generate color data for the first stroke portion in the stroke portion based on the third model.
[0093] Steps S106 and S107 constitute the fourth pass, which is used to render the first outline portion. In the fourth pass, the virtual model is first expanded outwards for the third time to obtain the third model, and then the color data of the first outline portion is generated based on the third model.
[0094] The third vertex expansion of the virtual model can refer to the viewing process of the first vertex expansion. The differences between the third vertex expansion and previous vertex expansions (including the first and second expansions) include: at least some vertices of the virtual model have an expansion distance greater in the third expansion than in the second expansion; and in the third expansion, the color component of the vertex color in the second color channel is read, i.e., the second preset expansion distance for each vertex is read, and then the third vertex expansion can be performed based on this second preset expansion distance. In an optional embodiment, the expansion distance of a vertex in the third expansion can be equal to the product of the second preset expansion distance and a third preset parameter.
[0095] After obtaining the third model through the third vertex expansion, the transparency of the third model can be configured to be opaque; the front face of the third model is culled; the back face of the third model is colored according to the pre-configured target color map to obtain the color data of the first outline part.
[0096] In an optional embodiment, the target color map can be the basic color map mentioned above, or it can be other color maps, such as solid color maps, gradient color maps, etc.
[0097] In the fourth pass, when rendering the first outline portion, the front face of the third model can be culled, and only the back face of the third model can be rendered.
[0098] In the fourth pass, the color data of the first stroke portion can be written to the color buffer through depth testing, while the depth data of the first stroke portion (i.e., the depth of the third model) is not written to the depth buffer. In other words, no depth is written for the first stroke portion, whereas depth is written in the first three passes. Through the fourth pass, the first stroke portion closest to the virtual model can be rendered. The fourth pass, combined with the third pass, can make the side of the stroke portion near the hollowed-out part show the effect of dry ink brushstrokes.
[0099] When you reach the fourth pass, something like this will happen. Figure 3 The stroke effect shown is possible because the depth has already been written in the previous pass. Figure 3 The hollowed-out ink wash outline effect shown can present an outline effect that is sometimes present and sometimes absent, and sometimes thick and sometimes thin, depending on the first and second preset expansion distances of the model vertices.
[0100] Step S108: Perform a fourth vertex expansion on the virtual model to obtain a fourth model; the expansion distance of the fourth vertex expansion is greater than the expansion distance of the third vertex expansion.
[0101] Step S109: Generate color data for the second stroke portion, which is located on the side of the first stroke portion that is far from the virtual model, based on the fourth model.
[0102] Steps S108 and S109 constitute the fifth pass, which is used to render the second outline portion. In the fifth pass, the virtual model is first expanded to its fourth vertex to obtain the fourth model, and then the color data of the second outline portion is generated based on the fourth model.
[0103] The fourth vertex expansion of the virtual model can refer to the viewing process of the third vertex expansion of the virtual model. The difference between the fourth and third vertex expansions is that the expansion distance of all vertices in the virtual model during the fourth expansion is greater than the expansion distance during the third expansion. In an optional embodiment, the expansion distance of a vertex during the fourth expansion can be equal to the product of the second preset expansion distance corresponding to that vertex and a fourth preset parameter.
[0104] After obtaining the fourth model through the fourth vertex expansion, the transparency of the fourth model can be configured to be opaque; the front face of the fourth model can be culled; and the back face of the fourth model can be colored according to the pre-configured target color map to obtain the color of the fourth model.
[0105] In an optional embodiment, the target color map can be the basic color map mentioned above, or it can be other color maps, such as solid color maps, gradient color maps, etc.
[0106] Subsequently, a transparency test can be performed on the color of the fourth model based on the pre-configured noise map to obtain the color data of the second outline portion. During the transparency test, considering that all pixels corresponding to the fourth model have the same transparency (i.e., are opaque), comparing them with a preset threshold would lead to two extreme results: either all pixels corresponding to the fourth model are discarded, or all are retained. Therefore, during the transparency test in the fifth pass, the pre-configured noise map, which has the same resolution as the screen, can be sampled. The sampling result for a certain pixel (i.e., the grayscale value of that pixel) is compared with the preset threshold, thereby randomly discarding some pixels. This allows the subsequently generated outline portion to be visible through the pixels discarded from the fourth model, giving the outline portion a dry ink brushstroke effect on one side of the cutout portion. Optionally, the pre-configured noise map can be a 2D noise map, such as a Burmester noise map; this disclosure does not specifically limit it.
[0107] In the fifth pass, the color data of the second stroke portion can be written to the color buffer through a depth test, while the depth data of the second stroke portion (i.e., the depth of the fourth model) is not written to the depth buffer; that is, no depth is written for the second stroke portion. Through the fifth pass, the second stroke portion, which represents the dry brushstroke effect of ink wash on the outer edge of the stroke, can be rendered.
[0108] Step S110: Based on the color and depth data of the virtual model, the color and depth data of the first hollow part, the color and depth data of the second hollow part, the color data of the first outline part, and the color data of the second outline part, display the virtual model with the hollow ink outline effect.
[0109] The depth data of the virtual model, the first cutout section, and the second cutout section can be written to the depth buffer in the first to third passes, respectively. Depth testing reveals the occlusion relationship between these three elements. In the color buffer, only the color data of the pixel closest to the virtual camera is retained. The color data of the first and second outline sections are also written to the color buffer in the fourth and fifth passes, respectively. Therefore, the color data in the current color buffer (including the rendering results of the first to fifth passes) can be displayed in the graphical user interface, thus presenting a virtual model with a cutout ink wash outline effect.
[0110] In an optional embodiment, refer to Figure 2The outline portion 02 may also include a third outline portion 023, which may be further away from the virtual model than the second outline portion 022. In this embodiment, the third outline portion 023 may also be rendered through a sixth pass.
[0111] In the sixth pass, the virtual model can be expanded to the fifth vertex to obtain the fifth model. The expansion distance of the fifth vertex expansion is greater than that of the third vertex expansion. Optionally, the expansion distance of the fifth vertex expansion can be greater than that of the fourth vertex expansion. Then, the color data of the third stroke part is generated based on the fifth model.
[0112] The fifth vertex expansion of the virtual model can be referenced to the viewing process of the third vertex expansion. The difference between the fifth and third vertex expansions is that the expansion distance of all vertices in the virtual model during the fifth expansion is greater than the expansion distance during the third expansion. In an optional embodiment, the expansion distance of a vertex during the fifth expansion can be equal to the product of the second preset expansion distance and the fifth preset parameter corresponding to that vertex.
[0113] After obtaining the fifth model through the fifth vertex expansion, the transparency of the fifth model can be determined based on the pre-configured noise map; the front face of the fifth model is culled; and the back face of the fifth model is colored according to the pre-configured target color map to obtain the color of the fifth model.
[0114] In this embodiment, sampling can be performed on a pre-configured noise map based on the pixels corresponding to the fifth model. This pre-configured noise map has the same resolution as the screen, and the sampling result for a certain pixel (i.e., the grayscale value of that pixel) is determined as the transparency of the fifth model at that pixel. Optionally, the pre-configured noise map can be a 2D noise map, such as a Burmester noise map, and this disclosure does not specifically limit it.
[0115] In an optional embodiment, the target color map can be the basic color map mentioned above, or it can be other color maps, such as solid color maps, gradient color maps, etc.
[0116] Next, the color of the fifth model can be transparently blended based on its transparency to obtain the color data of the third stroke portion. That is, the color of the fifth model and the current background color are transparently blended using the transparency of the fifth model as a weight, where the current background color is the cached color data in the current color buffer. Specifically, for a pixel on the screen corresponding to the fifth model, the latest color of that pixel = b * the color data of the fifth model at that pixel + (1-b) * the cached color data of that pixel in the current color buffer, where b is the transparency of the fifth model at that pixel.
[0117] In the sixth pass, the color data of the third stroke portion can be written to the color buffer through a depth test, while the depth data of the third stroke portion (i.e., the depth of the fifth model) is not written to the depth buffer. In other words, no depth is written for the third stroke portion. Through the sixth pass, the third stroke portion, which represents the wet brushstroke effect of ink on the outer edge of the stroke, can be rendered.
[0118] In the above embodiment, in step S110, after the sixth pass, a virtual model with a hollowed-out ink stroke effect and a wet brush stroke effect can be displayed based on the color data and depth data of the virtual model, the color data and depth data of the first hollowed-out part, the color data and depth data of the second hollowed-out part, the color data of the first outline part, the color data of the second outline part, and the color data of the third outline part.
[0119] In the above embodiment, the depth data of the virtual model, the first cutout portion, and the second cutout portion can be written into the depth buffer in the first to third passes, respectively. The occlusion relationship between these three portions is demonstrated through depth testing. In the color buffer, only the color data of the portion closest to the virtual camera is retained for each pixel. The color data of the first, second, and third outline portions are also written into the color buffer in the fourth to sixth passes, respectively. Therefore, the color data in the current color buffer (including the rendering results of the first to sixth passes) can be displayed in the graphical user interface, thus presenting a virtual model with a cutout ink wash outline effect and a wet brushstroke effect in the outline portion.
[0120] In an optional embodiment, after the sixth pass, the ink wash effect of the outlined portion can be further enhanced. Two exemplary implementations for enhancing the ink wash effect are provided below.
[0121] In one embodiment of this disclosure, a first image is generated based on the color and depth data of the virtual model, the color and depth data of the first hollowed-out portion, the color and depth data of the second hollowed-out portion, the color data of the first outline portion, the color data of the second outline portion, and the color data of the third outline portion; a rendering target for representing the outer contour of the outline portion is generated based on the depth data of the third outline portion; noise is superimposed on the rendering target to obtain a second image; the first image is blurred to obtain a third image; the first image and the third image are mixed based on the second image to obtain mixed color data; and a virtual model with a hollowed-out ink wash outline effect and the outline portion having a wet brushstroke effect and an ink wash effect is displayed based on the mixed color data.
[0122] In this embodiment, after the sixth pass, the color data in the color buffer can form an image, namely the first image. A render target representing the contour of the third stroke portion can be generated based on the depth data of the third stroke portion, which is also a mask map representing the third stroke portion. Then, noise is superimposed on the render target, that is, the render target is superimposed on a pre-configured noise map (optionally, the pre-configured noise map can be a 2D noise map, such as a Burmester noise map). The first image can be blurred to obtain the third image; optionally, the blurring process can include Gaussian blurring; optionally, the blurring process can be performed multiple times, such as 2 times or 3 times. Then, the second image can be used as a weight to mix the first image and the third image to obtain mixed color data. Specifically, for a certain pixel on the screen, the mixed color data of the pixel = c * the color data of the pixel in the first image + (1-c) * the color data of the pixel in the third image, where c is the color data of the pixel in the second image.
[0123] In this way, the clear first image and the blurred third image can be mixed based on the outline image of the superimposed noise to obtain an enhanced ink wash effect.
[0124] In one embodiment of this disclosure, an enhanced ink wash effect can be achieved through an additional pass, specifically by generating a fourth stroke portion in the stroke section using a seventh pass. This fourth stroke portion can be further away from the virtual model than the third stroke portion. In this embodiment, a sixth vertex expansion can be performed on the virtual model to obtain a sixth model. The expansion distance of the sixth vertex expansion is greater than that of the third vertex expansion. Optionally, the expansion distance of the sixth vertex expansion can be greater than that of the fourth vertex expansion, and also, optionally, it can be greater than that of the fifth vertex expansion. Then, color data for the fourth stroke portion is generated based on the sixth model. The fourth stroke portion has a Fresnel transparency effect, thereby achieving a semi-transparent ink wash effect through the Fresnel transparency effect of the fourth stroke portion.
[0125] The sixth vertex expansion of the virtual model can be referenced to the viewing process of the third vertex expansion of the virtual model. The difference between the sixth and third vertex expansions is that the expansion distance of all vertices in the virtual model during the sixth expansion is greater than the expansion distance during the third expansion. In an optional embodiment, the expansion distance of a vertex during the sixth expansion can be equal to the product of the second preset expansion distance corresponding to that vertex and a sixth preset parameter.
[0126] After obtaining the sixth model through the sixth vertex expansion, the Fresnel effect transparency of the sixth model can be determined, and the transparency data of the fourth outline can be obtained; the front face of the sixth model is culled; the back face of the sixth model is colored according to the pre-configured target color map, and the color data of the fourth outline can be obtained.
[0127] In this embodiment, the Fresnel effect transparency of the sixth model can be determined by the following formula, which is the transparency of the sixth model at the corresponding pixel. The transparency of the sixth model at the corresponding pixel is determined by the following formula, which can show the Fresnel transparency effect.
[0128] Frenel_alpha=saturate(powN(saturate(-dot(V,normalize(smooth)))))-noise.r)
[0129] Here, Frenel_alpha represents the transparency of the sixth model at pixel X; the saturate() function represents the portion of the function value within the parentheses of the saturate() function that is truncated to [0,1], i.e., if the function value within the parentheses of the saturate() function is less than 0, the saturate() function returns 0; if the function value within the parentheses of the saturate() function is greater than 1, the saturate() function returns 1; if the function value within the parentheses of the saturate() function is within [0,1], the saturate() function returns the function value within the parentheses of the saturate() function itself; powN represents the Nth power operation, where N can be a positive integer greater than 2, such as 2, 3, 4, 5, etc.; dot represents the dot product operation; V represents the viewing direction of the sixth model at pixel X; normalize represents the normalization operation; smooth represents the smoothing normal direction of the vertex of the sixth model at pixel X; and noise.r represents the grayscale value of the pre-configured noise map at pixel X.
[0130] In an optional embodiment, the target color map can be the basic color map mentioned above, or it can be other color maps, such as solid color maps, gradient color maps, etc.
[0131] In the above embodiment, in step S110, after the seventh pass, a virtual model with a hollowed-out ink outline effect and a wet brushstroke effect and an ink wash effect can be displayed based on the color data and depth data of the virtual model, the color data and depth data of the first hollowed-out part, the color data and depth data of the second hollowed-out part, the color data of the first outline part, the color data of the second outline part, the color data of the third outline part, and the color data of the fourth outline part.
[0132] In the above embodiment, the depth data of the virtual model, the first cutout portion, and the second cutout portion can be written into the depth buffer in the first to third passes, respectively. The occlusion relationship between these three portions is demonstrated through depth testing. In the color buffer, only the color data of the portion closest to the virtual camera is retained for each pixel. The color data of the first, second, third, and fourth outline portions are also written into the color buffer in the fourth to seventh passes, respectively. Therefore, the color data in the current color buffer (including the rendering results of the first to seventh passes) can be displayed in the graphical user interface, thus presenting a virtual model with a cutout ink wash outline effect and wet brushstroke and ink wash blur effects in the graphical user interface.
[0133] Optionally, one of the two embodiments for enhancing the ink wash effect can be selected based on the performance of the electronic device. The second embodiment is more performance-efficient than the first embodiment. For example, the first embodiment can be used in high-performance electronic devices (i.e., high-spec devices), while the second embodiment can be used in low-performance electronic devices (i.e., high-spec devices). Alternatively, the second embodiment can be used in both high-performance and low-performance electronic devices. This disclosure is not intended to limit the scope of the invention.
[0134] In an optional embodiment, the display method in the game may further include the following steps: determining the total illumination color corresponding to the target outline position in the outlined portion based on the current illumination information; converting the total illumination color into illumination intensity; mapping the illumination intensity to a preset illumination intensity range to obtain the target illumination intensity corresponding to the target outline position; and adjusting the color corresponding to the target outline position based on the target illumination intensity.
[0135] In one embodiment of this method, the presence of a point light source is first checked. If present, the contribution of the point light source to the target stroke position is calculated. Then, the contribution of the point light source to the target stroke position is added to the contribution of the direct light source to obtain the total illumination color corresponding to the target stroke position. Next, a dot product operation is performed on the total illumination color and a pre-configured weight vector. This weight vector is a coefficient used to convert RGB colors to luminance; for example, the weight vector can be (0.2126, 0.7152, 0.0722). The dot product operation converts the total illumination color to illumination intensity, thus obtaining the illumination intensity corresponding to the target stroke position. The illumination intensity corresponding to the target stroke position is then limited to a certain range (i.e., a preset illumination intensity range) to obtain the target illumination intensity corresponding to the target stroke position. Finally, the target illumination intensity corresponding to the target stroke position is multiplied by the color corresponding to the target stroke position to obtain the color of the target stroke position adapted to the illumination.
[0136] In this embodiment, the color brightness of the outline can be adjusted according to the current illumination, so that the color brightness of the outline changes with the light intensity, that is, the color brightness of the outline increases with the increase of light intensity and decreases with the decrease of light intensity.
[0137] The colors of the virtual model and its surrounding environment are adapted to lighting. In darker environments, if the brightness of the outline color remains unchanged (i.e., the outline color is not adapted to lighting), the outline will appear to glow (for example, a yellow outline will appear to glow in a darker environment), resulting in poor display of the outline in darker environments. In addition, if lighting calculations are performed for each pass of rendering the outline, there will be additional performance overhead. Therefore, in this embodiment, the brightness of the outline color is limited according to the light intensity of point light sources and direct light sources, and finally multiplied by the rendered outline color, which can achieve low-overhead outline lighting adaptation and improve the display effect of the outline in darker environments.
[0138] In an optional embodiment, in the first pass, the front of the virtual model can be rendered based on the current lighting information and a pre-configured base color map to obtain the color data of the virtual model:
[0139] Periodically offset the UVs of the virtual model;
[0140] The pre-configured base color map is sampled based on the UVs of the offset virtual model;
[0141] The color data obtained by sampling is processed based on the current illumination information to obtain the processed color data;
[0142] The processed color data is mapped onto the front of the virtual model to obtain the color data of the virtual model.
[0143] In this embodiment, by periodically offsetting the UVs of the virtual model and then sampling the base color map, a flowmap loop effect can be achieved for the texture of the virtual model. Thus, a flowing ink texture is created through the flowmap loop animation, adding a sense of dynamism to the ink painting effect of the virtual model.
[0144] In an optional embodiment, the display method in the game may further include the following steps:
[0145] Emit sheet-like particles at the target location in the virtual model;
[0146] UV flow effects are configured for sheet-like particles;
[0147] Rendering and displaying sheet-like particles with UV flow effects.
[0148] In this embodiment, planar particles (such as square particles, rectangular particles, etc.) can be emitted at target locations on the virtual model (e.g., the hem of a character's skirt, the location of decorative tassels, etc.). Each time the texture of the planar particles is sampled, the UV coordinates of the planar particles are offset to a certain extent, thereby achieving a UV flow effect for the planar particles. In this embodiment, the flowing planar effect further enhances the ink wash effect of the virtual model.
[0149] In the exemplary embodiments of this disclosure, a certain distance is left between the outline and the model by generating a first hollow portion, thereby achieving a hollow outline effect and enhancing the spatial sense of the outline; a second hollow portion is generated so that the side of the outline facing the model has a dry brushstroke effect in the style of ink painting; the first outline portion is generated to achieve the outline; the second outline portion is generated so that the side of the outline facing away from the model has a dry brushstroke effect in the style of ink painting; the third outline portion is generated so that the side of the outline facing away from the model has a wet brushstroke effect in the style of ink painting; and the fourth outline portion is generated so that the outline has an ink painting blurring effect.
[0150] Corresponding to the display method in the game provided in the embodiments of this disclosure, the embodiments of this disclosure also provide a display device in the game, wherein the game includes virtual models. For example... Figure 4 As shown, the device 700 includes:
[0151] Rendering module 701 is used to render the virtual model in response to a rendering command for the virtual model, and obtain the color data of the virtual model;
[0152] The first vertex expansion module 702 is used to perform a first vertex expansion on the virtual model to obtain a first model;
[0153] The first generation module 703 is used to generate color data of the first hollow portion located between the virtual model and the outline portion based on the first model;
[0154] The second vertex expansion module 704 is used to perform a second vertex expansion on the virtual model to obtain a second model; the expansion distance of the second vertex expansion is greater than the expansion distance of the first vertex expansion.
[0155] The second generation module 705 is used to generate color data of the second hollow portion located between the outline portion and the first hollow portion based on the second model;
[0156] The third vertex expansion module 706 is used to perform a third vertex expansion on the virtual model to obtain a third model; at least some vertices of the virtual model have an expansion distance greater than that of the second vertex expansion.
[0157] The third generation module 707 is used to generate color data of the first stroke portion in the stroke portion based on the third model;
[0158] The fourth vertex expansion module 708 is used to perform a fourth vertex expansion on the virtual model to obtain a fourth model; the expansion distance of the fourth vertex expansion is greater than the expansion distance of the third vertex expansion.
[0159] The fourth generation module 709 is used to generate color data of the second stroke portion, which is located on the side of the first stroke portion away from the virtual model, based on the fourth model;
[0160] Display module 710 is used to display the virtual model with a hollowed-out ink wash outline effect based on the color data and depth data of the virtual model, the color data and depth data of the first hollowed-out portion, the color data and depth data of the second hollowed-out portion, the color data of the first outline portion, and the color data of the second outline portion.
[0161] In an optional embodiment, displaying the virtual model with a hollowed-out ink wash outline effect based on the color and depth data of the virtual model, the color and depth data of the first hollowed-out portion, the color and depth data of the second hollowed-out portion, the color data of the first outline portion, and the color data of the second outline portion includes:
[0162] The virtual model is expanded a fifth time to obtain a fifth model; the expansion distance of the fifth expansion is greater than the expansion distance of the third expansion.
[0163] Based on the fifth model, generate color data for the third stroke portion, which is located on the side of the second stroke portion that is far away from the virtual model;
[0164] Based on the color and depth data of the virtual model, the color and depth data of the first hollowed-out portion, the color and depth data of the second hollowed-out portion, the color data of the first outline portion, the color data of the second outline portion, and the color data of the third outline portion, the virtual model with a hollowed-out ink wash outline effect and the outline portion having a wet brush stroke effect is displayed.
[0165] In an optional embodiment, displaying the virtual model with a hollowed-out ink wash outline effect and the outline having a wet brushstroke effect based on the color and depth data of the virtual model, the color and depth data of the first hollowed-out portion, the color and depth data of the second hollowed-out portion, the color data of the first outline portion, the color data of the second outline portion, and the color data of the third outline portion includes:
[0166] A first image is generated based on the color and depth data of the virtual model, the color and depth data of the first hollowed-out portion, the color and depth data of the second hollowed-out portion, the color data of the first outline portion, the color data of the second outline portion, and the color data of the third outline portion.
[0167] A rendering target for characterizing the contour of the third stroke portion is generated based on the depth data of the third stroke portion;
[0168] Noise is superimposed on the rendered target to obtain a second image;
[0169] The first image is blurred to obtain the third image;
[0170] The first image and the third image are blended based on the second image to obtain the blended color data;
[0171] Based on the mixed color data, the virtual model is displayed with a hollowed-out ink wash outline effect, and the outline part has a wet brush stroke effect and an ink wash effect.
[0172] In an optional embodiment, displaying the virtual model with a hollowed-out ink wash outline effect and the outline having a wet brushstroke effect based on the color and depth data of the virtual model, the color and depth data of the first hollowed-out portion, the color and depth data of the second hollowed-out portion, the color data of the first outline portion, the color data of the second outline portion, and the color data of the third outline portion includes:
[0173] The virtual model is expanded a sixth time to obtain a sixth model; the expansion distance of the sixth expansion is greater than the expansion distance of the third expansion.
[0174] The color data of the fourth stroke portion, located on the side of the third stroke portion away from the virtual model, is generated based on the sixth model; the fourth stroke portion has a Fresnel transparency effect.
[0175] Based on the color and depth data of the virtual model, the color and depth data of the first hollowed-out portion, the color and depth data of the second hollowed-out portion, the color data of the first outline portion, the color data of the second outline portion, the color data of the third outline portion, and the color data of the fourth outline portion, the virtual model with a hollowed-out ink wash outline effect and the outline portion having a wet brush stroke effect and an ink wash effect is displayed.
[0176] In an optional embodiment, rendering the virtual model to obtain its color data includes:
[0177] Configure the transparency of the virtual model to be opaque;
[0178] The virtual model is subjected to backface culling;
[0179] The front of the virtual model is rendered based on the current lighting information and the pre-configured base color map to obtain the color data of the virtual model.
[0180] In an optional embodiment, the step of rendering the front of the virtual model based on the current lighting information and a pre-configured base color map to obtain the color data of the virtual model includes:
[0181] The UVs of the virtual model are periodically shifted;
[0182] The pre-configured base color map is sampled based on the UVs of the offset virtual model;
[0183] The color data obtained by sampling is processed based on the current illumination information to obtain the processed color data;
[0184] The processed color data is mapped onto the front of the virtual model to obtain the color data of the virtual model.
[0185] In an optional embodiment, the device is further configured to:
[0186] Flask-shaped particles are emitted at the target location in the virtual model;
[0187] A UV flow effect is configured for the sheet-like particles;
[0188] The sheet-like particles with UV flow effects are rendered and displayed.
[0189] In an optional embodiment, color data for the first hollowed-out portion is generated based on the first model, including:
[0190] Configure the transparency of the first model to be completely transparent;
[0191] Configure the color of the first model to a preset color;
[0192] Based on the transparency of the first model, the color of the first model is transparently mixed to obtain the color data of the first hollowed-out part.
[0193] In an optional embodiment, color data for the second hollowed-out portion is generated based on the second model, including:
[0194] Configure the transparency of the second model to be completely transparent;
[0195] Configure the color of the second model to a preset color;
[0196] The color of the second model is tested for transparency based on a pre-configured noise map to obtain the color data of the second hollowed-out portion.
[0197] In an optional embodiment, generating color data for the first outline portion based on the third model includes:
[0198] Configure the transparency of the third model to be opaque;
[0199] The third model is then positively rejected;
[0200] The back of the third model is colored according to the pre-configured target color map to obtain the color data of the first outline portion.
[0201] In an optional embodiment, generating color data for the second outline portion based on the fourth model includes:
[0202] Configure the transparency of the fourth model to be opaque;
[0203] The fourth model is then subject to positive rejection;
[0204] The back of the fourth model is colored according to the pre-configured target color map to obtain the color of the fourth model;
[0205] The color of the fourth model is tested for transparency based on a pre-configured noise map to obtain the color data of the second outline portion.
[0206] In an optional embodiment, generating the color data of the third outline portion based on the fifth model includes:
[0207] The transparency of the fifth model is determined based on a pre-configured noise map;
[0208] The fifth model is then positively rejected;
[0209] The back of the fifth model is colored according to the pre-configured target color map to obtain the color of the fifth model;
[0210] The color of the fifth model is transparently blended based on its transparency to obtain the color data of the third outline portion.
[0211] In an optional embodiment, generating the color data for the fourth outline portion based on the sixth model includes:
[0212] Determine the transparency of the Fresnel effect in the sixth model;
[0213] The sixth model is then eliminated by positive selection;
[0214] The back of the sixth model is colored according to the pre-configured target color map to obtain the color data of the fourth outline portion.
[0215] In an optional embodiment, the device is further configured to:
[0216] Based on the current lighting information, determine the total lighting color corresponding to the target outline position in the outlined portion;
[0217] Convert the total illumination color into illumination intensity;
[0218] The illumination intensity is mapped to a preset illumination intensity range to obtain the target illumination intensity corresponding to the target outline position;
[0219] Adjust the color corresponding to the target outline position based on the target illumination intensity.
[0220] In an exemplary embodiment of this disclosure, a model can be rendered in response to a rendering command to obtain the model's color data; the model can be expanded outwards for the first time to obtain a first model; color data of a first hollowed-out portion can be generated based on the first model; the model can be expanded outwards for the second time to obtain a second model; color data of a second hollowed-out portion can be generated based on the second model; the model can be expanded outwards for the third time to obtain a third model; color data of a first outline portion can be generated based on the third model; the model can be expanded outwards for the fourth time to obtain a fourth model; color data of a second outline portion can be generated based on the fourth model; and a model with a hollowed-out ink wash outline effect can be displayed based on the model's color depth data, the color depth data of the first hollowed-out portion, the color depth data of the second hollowed-out portion, the color data of the first outline portion, and the color data of the second outline portion. In this disclosure, by generating a first hollowed-out portion, a certain distance is left between the outline and the model, thus achieving a hollowed-out outline effect and enhancing the spatial sense of the outline; by generating a second hollowed-out portion, the side of the outline facing the model has a dry brushstroke effect in the style of ink painting; the outline is achieved by generating the first outline portion; and the outline has a dry brushstroke effect in the style of ink painting on the side of the outline facing away from the model by generating the second outline portion.
[0221] The following describes an electronic device provided by an embodiment of this disclosure. Please refer to [link / reference]. Figure 5 , Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. The electronic device 800 may be equipped with a display device from a game as described in this embodiment, used to implement the functions of this embodiment. Specifically, the electronic device 800 includes: a receiver 801, a transmitter 802, a processor 803, and a memory 804 (wherein the electronic device 800 may have one or more processors 803). Figure 5 (Taking a processor as an example), the processor 803 may include an application processor 8031 and a communication processor 8032. In some embodiments of this disclosure, the receiver 801, transmitter 802, processor 803, and memory 804 may be connected via a bus or other means.
[0222] Memory 804 may include read-only memory and random access memory, and provides instructions and data to processor 803. A portion of memory 804 may also include non-volatile random access memory (NVRAM). Memory 804 stores processor and operation instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0223] The processor 803 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together through a bus system, which may include not only the data bus but also power buses, control buses, and status signal buses. However, for clarity, all buses in the diagram are referred to as the bus system.
[0224] The methods disclosed in the above embodiments of this disclosure can be applied to or implemented by processor 803. Processor 803 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the hardware of processor 803 or by instructions in software form. Processor 803 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and may further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. Processor 803 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 804, and processor 803 reads the information from memory 804 and, in conjunction with its hardware, completes the steps of the above method.
[0225] Receiver 801 can be used to receive input digital or character information, and to generate signal inputs related to the settings and function control of the execution device. Transmitter 802 can be used to output digital or character information through the first interface; transmitter 802 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; transmitter 802 may also include a display device such as a display screen.
[0226] In this embodiment of the disclosure, the application processor 8031 in the processor 803 is used to execute the display method in the game in this embodiment of the disclosure. It should be noted that the specific way in which the application processor 8031 executes each step is based on the same concept as the various method embodiments in this disclosure, and the resulting technical effects are the same as those in the various method embodiments in this disclosure. For details, please refer to the description in the method embodiments shown above in this disclosure, which will not be repeated here.
[0227] This disclosure also provides a chip for executing instructions, which is used to implement the display method in the game described above.
[0228] This disclosure also provides a computer-readable storage medium storing computer instructions that, when executed on a processor, cause the processor to perform the display method in the game described above.
[0229] This disclosure also provides a computer program product, including a computer program, which, when executed by a processor, is used to perform the display method in the game described above.
[0230] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to general-purpose or special-purpose servers.
[0231] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
[0232] While this disclosure is presented above with reference to preferred embodiments, it is not intended to limit this disclosure. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope defined in the claims of this disclosure.
Claims
1. A display method in a game, characterized by, The game includes a virtual model, and the method comprises: rendering the virtual model in response to rendering instructions for the virtual model, to obtain color data of the virtual model; firstly expanding vertices of the virtual model to obtain a first model; generating color data of a first hollowed-out part between the virtual model and a hatching part based on the first model; secondly expanding vertices of the virtual model to obtain a second model; the expansion distance of the second expansion is greater than that of the first expansion; generating color data of a second hollowed-out part between the hatching part and the first hollowed-out part based on the second model; thirdly expanding vertices of the virtual model to obtain a third model; at least part of the vertices of the virtual model has an expansion distance in the third expansion that is greater than that in the second expansion; generating color data of a first hatching part in the hatching part based on the third model; fourthly expanding vertices of the virtual model to obtain a fourth model; the expansion distance of the fourth expansion is greater than that of the third expansion; generating color data of a second hatching part in the hatching part that is away from the virtual model relative to the first hatching part based on the fourth model; displaying the virtual model with a hollow ink hatching effect according to the color data and depth data of the virtual model, the color data and depth data of the first hollowed-out part, the color data and depth data of the second hollowed-out part, the color data of the first hatching part, and the color data of the second hatching part.
2. The method of claim 1, wherein, The displaying of the virtual model with a hollow ink hatching effect according to the color data and depth data of the virtual model, the color data and depth data of the first hollowed-out part, the color data and depth data of the second hollowed-out part, the color data of the first hatching part, and the color data of the second hatching part comprises: fifthly expanding vertices of the virtual model to obtain a fifth model; the expansion distance of the fifth expansion is greater than that of the third expansion; generating color data of a third hatching part in the hatching part that is away from the virtual model relative to the second hatching part based on the fifth model; displaying the virtual model with a hollow ink hatching effect and the hatching part having a wet brush touch effect according to the color data and depth data of the virtual model, the color data and depth data of the first hollowed-out part, the color data and depth data of the second hollowed-out part, the color data of the first hatching part, the color data of the second hatching part, and the color data of the third hatching part.
3. The method of claim 2, wherein, The displaying the virtual model with the hollow ink line drawing effect and the wet brush stroke effect of the line drawing part according to the color data and the depth data of the virtual model, the color data and the depth data of the first hollow part, the color data and the depth data of the second hollow part, the color data of the first line drawing part, the color data of the second line drawing part, and the color data of the third line drawing part comprises: generating a first image according to the color data and the depth data of the virtual model, the color data and the depth data of the first hollow part, the color data and the depth data of the second hollow part, the color data of the first line drawing part, the color data of the second line drawing part, and the color data of the third line drawing part; generating a rendering target for representing the contour of the third line drawing part according to the depth data of the third line drawing part; superimposing noise on the rendering target to obtain a second image; performing blur processing on the first image to obtain a third image; mixing the first image and the third image based on the second image to obtain mixed color data; displaying the virtual model with the hollow ink line drawing effect and the wet brush stroke effect and the ink gradation effect of the line drawing part according to the mixed color data.
4. The method of claim 2, wherein, The displaying the virtual model with the hollow ink line drawing effect and the wet brush stroke effect of the line drawing part according to the color data and the depth data of the virtual model, the color data and the depth data of the first hollow part, the color data and the depth data of the second hollow part, the color data of the first line drawing part, the color data of the second line drawing part, and the color data of the third line drawing part comprises: performing sixth vertex expansion on the virtual model to obtain a sixth model; the expansion distance of the sixth vertex expansion is greater than the expansion distance of the third vertex expansion; generating color data of a fourth line drawing part of the line drawing part located on the side of the third line drawing part away from the virtual model based on the sixth model; the fourth line drawing part is a Fresnel transparent effect; The displaying the virtual model with the hollow ink line drawing effect and the wet brush stroke effect of the line drawing part according to the color data and the depth data of the virtual model, the color data and the depth data of the first hollow part, the color data and the depth data of the second hollow part, the color data of the first line drawing part, the color data of the second line drawing part, and the color data of the third line drawing part comprises:
5. The method of claim 1, wherein, The rendering the virtual model to obtain the color data of the virtual model comprises: configuring the transparency of the virtual model to be opaque; performing back-face culling on the virtual model; rendering the front surface of the virtual model according to the current lighting information and a preconfigured base color map to obtain the color data of the virtual model.
6. The method of claim 5, wherein, The rendering the virtual model according to the current lighting information and the preconfigured base color map to obtain the color data of the virtual model comprises: periodically shifting the UV of the virtual model; Sampling a preconfigured base color map according to UV of the offset virtual model; Processing the sampled color data according to current lighting information to obtain processed color data; Mapping the processed color data to a front surface of the virtual model to obtain color data of the virtual model.
7. The method of claim 1, wherein, The method further comprises: Emitting a sheet particle at a target position of the virtual model; Configuring a UV flow effect for the sheet particle; Rendering and displaying the sheet particle configured with the UV flow effect.
8. The method of claim 1, wherein, Generating color data of the first hollowed-out part based on the first model, comprising: Configuring the first model to be completely transparent; Configuring the first model to be a preset color; Transparency blending the color of the first model based on the transparency of the first model to obtain the color data of the first hollowed-out part.
9. The method of claim 1, wherein, Generating color data of the second hollowed-out part based on the second model, comprising: Configuring the second model to be completely transparent; Configuring the second model to be a preset color; Transparency testing the color of the second model based on a preconfigured noise map to obtain the color data of the second hollowed-out part.
10. The method of claim 1, wherein, Generating color data of the first outline part based on the third model, comprising: Configuring the third model to be opaque; Front surface culling the third model; Coloring the back surface of the third model according to a preconfigured target color map to obtain the color data of the first outline part.
11. The method of claim 1, wherein, Generating color data of the second outline part based on the fourth model, comprising: Configuring the fourth model to be opaque; Front surface culling the fourth model; Coloring the back surface of the fourth model according to a preconfigured target color map to obtain the color of the fourth model; Transparency testing the color of the fourth model based on a preconfigured noise map to obtain the color data of the second outline part.
12. The method of claim 2, wherein, Generating color data of the third outline part based on the fifth model, comprising: Determining the transparency of the fifth model according to a preconfigured noise map; Front surface culling the fifth model; Coloring the back surface of the fifth model according to a preconfigured target color map to obtain the color of the fifth model; Transparency blending the color of the fifth model based on the transparency of the fifth model to obtain the color data of the third outline part.
13. The method of claim 4, wherein, Generating color data of the fourth outline part based on the sixth model, comprising: Determining the Fresnel effect transparency of the sixth model; Front surface culling the sixth model; Coloring the back surface of the sixth model according to a preconfigured target color map to obtain the color data of the fourth outline part.
14. The method of claim 1, wherein, The method further comprises: Determining a total lighting color corresponding to a target outline position in the outline part according to current lighting information; Converting the total lighting color into a lighting intensity; Mapping the lighting intensity to a preset lighting intensity range to obtain a target lighting intensity corresponding to the target outline position; Adjust the color corresponding to the target stroke position according to a target light intensity corresponding to the target stroke position.
15. A display device in a game, characterized by The game includes a virtual model, and the device includes: a rendering module, configured to render the virtual model according to a rendering instruction for the virtual model, to obtain color data of the virtual model; a first vertex expansion module, configured to perform first vertex expansion on the virtual model, to obtain a first model; a first generation module, configured to generate color data of a first hollowed-out part between the virtual model and a stroke part based on the first model; a second vertex expansion module, configured to perform second vertex expansion on the virtual model, to obtain a second model; the expansion distance of the second vertex expansion is greater than the expansion distance of the first vertex expansion; a second generation module, configured to generate color data of a second hollowed-out part between the stroke part and the first hollowed-out part based on the second model; a third vertex expansion module, configured to perform third vertex expansion on the virtual model, to obtain a third model; at least part of the vertices of the virtual model have an expansion distance in the third vertex expansion that is greater than an expansion distance in the second vertex expansion; a third generation module, configured to generate color data of a first stroke part in the stroke part based on the third model; a fourth vertex expansion module, configured to perform fourth vertex expansion on the virtual model, to obtain a fourth model; the expansion distance of the fourth vertex expansion is greater than the expansion distance of the third vertex expansion; a fourth generation module, configured to generate color data of a second stroke part in the stroke part, which is located on a side of the first stroke part away from the virtual model, based on the fourth model; a display module, configured to display the virtual model with a hollow ink stroke effect according to the color data and depth data of the virtual model, the color data and depth data of the first hollowed-out part, the color data and depth data of the second hollowed-out part, the color data of the first stroke part, and the color data of the second stroke part.
16. An electronic device, comprising: comprise: a processor, a memory, and computer program instructions stored on the memory and executable on the processor; the processor executes the computer program instructions to implement the display method in the game according to any one of claims 1 to 14.
17. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer program instructions, and the computer program instructions are executed by the processor to implement the display method in the game according to any one of claims 1 to 14.
Citation Information
Patent Citations
Model rendering method and device
CN112070873A
Model rendering method and device and electronic equipment
CN116051716A