Picture generation method, storage medium, electronic device and computer program product

By creating target textures in a virtual scene and performing offset sampling, the outline area mask is determined, and a target scene image with outline effects is generated. This solves the problem of insufficient accuracy and applicability of virtual model outline effects, achieving higher outline accuracy and wider applicability.

CN119027561APending Publication Date: 2024-11-26NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411067643.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

Existing technologies for virtual model outlining effects suffer from poor accuracy and limited applicability, especially in the case of semi-transparent and patch models, where depth post-processing outlining and multi-channel normal outlining schemes have limitations.

Method used

By using the current frame of the virtual scene and the model information of the model to be outlined, a target texture is created, and offset sampling processing is performed in multiple offset directions to determine the outline area mask. The outline area mask and the current frame are then used to generate the target scene image.

Benefits of technology

It improves the accuracy and applicability of model outlining, reduces outlining errors, and expands the scope of application of outlining schemes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119027561A_ABST
    Figure CN119027561A_ABST
Patent Text Reader

Abstract

The invention discloses a picture generation method, a storage medium, an electronic device and a computer program product, and relates to the technical field of computers. The method comprises the steps that a target map is created based on a current picture frame of a virtual scene and model information of a to-be-stroked model in the virtual scene, and the target map is used for representing a corresponding display area of the to-be-stroked model in the current picture frame; performing offset sampling processing on the target map according to the plurality of offset directions, and determining a stroking area mask corresponding to the to-be-stroked model; and generating a target scene picture by using the stroked region mask and the current picture frame. The technical problems that according to a model stroking scheme provided by the related technology, stroking errors are prone to occurring, the adaptability to the model is poor, and the scheme limitation is high are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a screen generation method, a storage medium, an electronic device, and a computer program product. Background Art

[0002] In a virtual scene, when a virtual model is selected, it may be necessary to display the stroke effect of the virtual model. In this regard, the relevant technology usually uses a third-party rendering engine to perform deep post-processing stroke or multi-pass normal expansion stroke on the virtual model. The deep post-processing stroke solution needs to obtain the scene depth of the virtual scene, which is prone to stroke errors when there are semi-transparent models in the virtual scene; the multi-pass normal expansion stroke solution has high requirements for the virtual model itself, such as it cannot be applied to patch models, and has strong limitations.

[0003] Therefore, how to improve the accuracy and scene applicability of the virtual model's edge drawing effect has become one of the important technical issues in the relevant technical field. Currently, no effective solution has been proposed for the above-mentioned problems.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] At least some embodiments of the present application provide a screen generation method, storage medium, electronic device and computer program product to at least solve the technical problems that the model stroke scheme provided by the related art is prone to stroke errors, has poor adaptability to the model, and has strong limitations on the scheme.

[0006] According to one embodiment of the present application, a screen generation method is provided, including: creating a target map based on a current screen frame of a virtual scene and model information of a model to be stroked in the virtual scene, wherein the target map is used to represent a display area corresponding to the model to be stroked in the current screen frame; performing offset sampling processing on the target map according to multiple offset directions to determine a stroke area mask corresponding to the model to be stroked; and generating a target scene screen using the stroke area mask and the current screen frame.

[0007] According to one embodiment of the present application, a screen generation device is also provided, including: a creation module, used to create a target map based on the current screen frame of the virtual scene and the model information of the model to be stroked in the virtual scene, wherein the target map is used to characterize the display area corresponding to the model to be stroked in the current screen frame; a determination module, used to perform offset sampling processing on the target map according to multiple offset directions, and determine the stroke area mask corresponding to the model to be stroked; a generation module, used to generate a target scene screen using the stroke area mask and the current screen frame.

[0008] According to one embodiment of the present application, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute any one of the above-mentioned screen generation methods when executed by a processor.

[0009] According to one embodiment of the present application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute any one of the above-mentioned screen generation methods.

[0010] According to one embodiment of the present application, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, any one of the above-mentioned screen generation methods is implemented.

[0011] In at least some embodiments of the present application, a target map is created based on the current picture frame of the virtual scene and the model information of the model to be stroked in the virtual scene, wherein the target map is used to characterize the display area corresponding to the model to be stroked in the current picture frame; the target map is subjected to offset sampling processing according to multiple offset directions to determine the stroke area mask corresponding to the model to be stroked; and the target scene image is generated using the stroke area mask and the current picture frame. The present application achieves the purpose of generating a target scene image containing a stroke effect according to the stroke area mask of the model to be stroked by creating a target map corresponding to the model to be stroked and performing sampling corresponding to multiple offset directions, thereby achieving the technical effect of improving the accuracy of model strokes and improving the versatility of the stroke scheme for the model, thereby solving the technical problems that the model stroke scheme provided by the related art is prone to stroke errors, poor adaptability to the model, and strong limitations of the scheme. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0013] Figure 1 It is a hardware structure block diagram of a mobile terminal according to a screen generation method of one embodiment of the present application;

[0014] Figure 2 is a flow chart of a screen generation method according to one embodiment of the present application;

[0015] Figure 3 is a schematic diagram of a current picture frame of an optional virtual scene according to one embodiment of the present application;

[0016] Figure 4 is a schematic diagram of an optional target map according to one embodiment of the present application;

[0017] Figure 5 is a schematic diagram of an optional target scene screen according to one embodiment of the present application;

[0018] Figure 6 is a schematic diagram of an optional stroke effect setting window according to one embodiment of the present application;

[0019] Figure 7 is a schematic diagram of another optional target map according to one embodiment of the present application;

[0020] Figure 8 is a structural block diagram of a picture generating device according to one embodiment of the present application;

[0021] Fig. 9 is a schematic diagram of an electronic device according to one embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0024] It should be noted that, in the specification of the present application, the word "for example" is used to mean "used as an example, illustration or description". Any embodiment described as "for example" in the present application is not necessarily interpreted as being more preferred or more advantageous than other embodiments. In order to enable any technician in the field to implement and use the present application, the following description is given. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present application can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid unnecessary details that make the description of the present application obscure. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in the present application.

[0025] In the process of describing the embodiments of the present application, some nouns or terms that appear are subject to the following explanations.

[0026] Render Texture (RT) map: The real-time rendering content in the virtual scene is rendered onto a specific texture map. In the embodiment of the present application, the rendering content in the RT map may be the current picture frame.

[0027] Screen coordinates (ScreenUV): refers to the two-dimensional coordinate information based on the device screen (for example, mobile phone display, computer display, etc.), where U can represent the horizontal coordinate and V can represent the vertical coordinate, and U and V are perpendicular to each other.

[0028] Linear Interpolation (Lerp) function: used to make a smooth transition between two values. The calculation result of the Lerp function can be expressed as Lerp(A, B, Alpha), where the value of Alpha is used to assign the interpolation ratio between the values ​​A and B. For example, when Alpha is 1, the output value of the Lerp function is B; when Alpha is 0, the output value of the Lerp function is A; when Alpha is 0.5, the output value of the Lerp function is the sum of A×0.5 and B×0.5. In computer graphics and game development, the Lerp function can be used to achieve animation effects, smooth movement, and color gradients.

[0029] Shader: used to render virtual scenes in real time to calculate and generate different picture effects corresponding to the virtual scenes. The Shader can be used for image post-processing and supports user customization. The shader used in this application can be recorded as Surf shader, which includes surf files and hlsl files, and implements shader functions through node connections.

[0030] Texel size (TexelSize): Determined by the number of pixels in the screen. For example, a screen contains [1920, 1080] pixels, and the texel size is used to represent the size of a pixel in this screen, that is, [1 / 1920, 1 / 1080].

[0031] Step function: used to create a stair-step effect in a material. The Step function accepts two parameters: the first is the input value, and the second is the threshold. When the input value is greater than the threshold, the step function returns 1; when the input value is less than or equal to the threshold, the step function returns 0. By adjusting the threshold value, you can control the position and width of the steps to achieve different effects, such as creating hard-edged shadows or edge detection effects. In the Material Editor, you can use the step function in conjunction with other functions to achieve more complex effects.

[0032] Smoothstep function: A function used to smoothly transition between two specific values ​​and return an interpolation result between 0 and 1. SmoothStep receives three parameters: the minimum boundary (Min) defines the lower boundary of the interpolation. For input values ​​less than or equal to Min, the output value of the SmoothStep function is 0 (black); the maximum boundary (Max) defines the upper boundary of the interpolation. For values ​​greater than or equal to Max, the output value of the SmoothStep function is 1 (white); the value (Alpha) defines the source of the interpolation. For example, Alpha can be determined by a gradient map or a grayscale texture map. In the field of rendering, the Smoothstep function is often used to create smooth transition effects in rendered graphics, such as interpolating color, brightness, or transparency in a shader program. By using the Smoothstep function, jagged edges or discontinuous transition effects can be avoided during the rendering process, making the final rendering result smoother and more natural.

[0033] In a possible implementation of the present application, with respect to the depth post-processing stroking scheme or the multi-pass normal expansion stroking scheme commonly used in the scene involving the generation of stroking effects of virtual machine models in the field of computer technology, after practice and careful research, the inventor still found that there are technical problems such as easy stroking errors, high requirements on the model, and strong limitations of the scheme. Based on this, an embodiment of the present application proposes a method for generating a scene screen with a stroking effect of a virtual model, which uses a current screen frame of the virtual scene and model information of the model to be stroked in the virtual scene to create a target map, performs offset sampling processing on the target map according to multiple offset directions, determines the stroke area mask corresponding to the model to be stroked, and uses the stroke area mask and the current screen frame to generate the target scene screen. The technical concept achieves the technical effect of improving the accuracy of model stroking and improving the versatility of the stroking scheme for the model, thereby solving the technical problems that the model stroking scheme provided by the relevant technology is prone to stroking errors, poor adaptability to the model, and strong limitations of the scheme.

[0034] The above method embodiments involved in this application can be executed in a terminal device (for example, a mobile terminal, a computer terminal or a similar computing device). Taking running on a mobile terminal as an example, the mobile terminal can be a smart phone, a tablet computer, a PDA, a mobile Internet device, a game console and other terminal devices.

[0035] Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal according to a method for generating a screen in one embodiment of the present application. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1(only one is shown in the figure) processor 102, memory 104, transmission device 106, input / output device 108 and display device 110. Taking the screen generation method applied to an electronic game scene through the mobile terminal as an example, the processor 102 calls and runs the computer program stored in the memory 104 to execute the screen generation method, and the generated target scene screen is transmitted to the input / output device 108 and / or the display device 110 through the transmission device 106, and then the target scene screen is provided to the player.

[0036] Still like Figure 1 As shown, the processor 102 may include but is not limited to: a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microcontroller unit (MCU), a programmable logic device (Field Programmable Gate Array, FPGA), a neural network processor (Neural-Network Processing Unit, NPU), a tensor processor (Tensor Processing Unit, TPU), an artificial intelligence (Artificial Intelligence, AI) type processor and other processing devices.

[0037] Those skilled in the art will understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0038] In some optional embodiments mainly based on game scenarios, the above-mentioned terminal device can also provide a human-computer interaction interface with a touch-sensitive surface, which can sense finger contact and / or gestures to perform human-computer interaction with a graphical user interface (Graphical User Interface, GUI). The human-computer interaction function may include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interface, playing digital videos, playing digital music and / or web browsing, etc. The executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in a computer program product or readable storage medium executable by one or more processors.

[0039] The above method embodiments involved in this application can also be executed in a server. Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms. Taking the application of the screen generation method to the electronic game scene through the electronic game server as an example, the electronic game server can generate the target scene screen in the electronic game scene based on the screen generation method, and provide the target scene screen to the player (for example, it can be rendered and displayed on the display screen of the player's terminal, or provided to the player through holographic projection, etc.).

[0040] According to one embodiment of the present application, an embodiment of a screen generation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0041] In this embodiment, a screen generation method running on the above mobile terminal is provided. Figure 2 is a flow chart of a screen generation method according to one embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0042] Step S21, creating a target map based on the current picture frame of the virtual scene and the model information of the model to be stroked in the virtual scene, where the target map is used to represent the display area corresponding to the model to be stroked in the current picture frame;

[0043] Step S22, performing offset sampling processing on the target map according to multiple offset directions to determine a stroke area mask corresponding to the model to be stroked;

[0044] Step S23, generating a target scene image by using the stroked area mask and the current image frame.

[0045] The above virtual scene can be a virtual two-dimensional scene or a virtual three-dimensional scene of an electronic game. The game types of the above electronic games can be: action (for example: first-person or third-person shooting games, two-dimensional or three-dimensional fighting games, war action games and sports action games, etc.), adventure (for example: exploration games, collection games, puzzle games, etc.), simulation (for example: simulation sandbox games, simulation development games, strategy simulation games, city construction simulation games, business simulation games, etc.), role-playing games and leisure games (for example: chess and card table games, casual competitive games, music rhythm games, dress-up development games, etc.), etc.

[0046] The virtual scene may include multiple virtual models, for example, virtual character models (such as player-controlled characters, friendly characters, enemy characters, etc.), virtual object models, virtual special effects models, etc. The model to be stroked may be part or all of the multiple virtual models in the virtual scene. The model information of the model to be stroked may be used to determine the model position, model shape, model camp, etc. of the model to be stroked. The model to be stroked is displayed in the current frame of the virtual scene.

[0047] Furthermore, by using the current picture frame of the virtual scene and the model information of the model to be stroked, the display area corresponding to the model to be stroked in the current picture frame can be determined, based on which a target map corresponding to the current picture frame is created so that the target map can represent the display area.

[0048] The above-mentioned multiple offset directions can be multiple offset directions preset in a two-dimensional plane, for example, the multiple offset directions include four directions of up, down, left, and right, and for another example, the multiple offset directions include eight directions of up, down, left, right, upper left, upper right, lower left, and lower right. Based on this, the target map is offset according to the multiple offset directions to obtain multiple offset maps, each of which is used to characterize the display area of ​​the model to be stroked after the offset; each offset map is sampled to obtain multiple groups of sampling results; and the multiple groups of sampling results are used to determine the stroke area mask corresponding to the model to be stroked. The above-mentioned stroke area mask is used to determine the stroke area corresponding to the display model to be stroked.

[0049] Furthermore, the target scene picture is generated by utilizing the above-mentioned stroke area mask and the current picture frame. Specifically, a stroke effect corresponding to the model to be stroked is generated within the stroke area mask, and the stroke effect may be a solid color stroke effect, a gradient stroke effect, etc.; and then the stroke effect is superimposed on the current picture frame to generate the target scene picture, wherein the model to be stroked is displayed in the current picture frame, and the model to be stroked and the stroke effect of the model to be stroked are displayed in the target scene picture.

[0050] It is easy to notice that the display area of ​​the model to be stroked and the stroke area mask are determined based on the current frame of the virtual scene. Therefore, the above method steps provided in the embodiment of the present application can generate a scene screen containing the model stroke effect in real time and accurately. In addition, since the above method steps provided in the embodiment of the present application do not rely on the normal information of the model itself or the depth information of the virtual scene when generating the scene screen, the model quality requirements for the model to be stroked itself when determining the stroke mask area are relatively low, the degree of limitation is small, and it can be applied to more application scenarios and more virtual models.

[0051] Specifically, the above-mentioned screen generation method may also include other method steps, which can be referred to the further introduction of the embodiments of the present application below, and will not be described in detail here.

[0052] In an embodiment of the present application, a target map is created based on the current picture frame of the virtual scene and the model information of the model to be stroked in the virtual scene, wherein the target map is used to characterize the display area corresponding to the model to be stroked in the current picture frame; the target map is subjected to offset sampling processing according to multiple offset directions to determine the stroke area mask corresponding to the model to be stroked; and the target scene picture is generated using the stroke area mask and the current picture frame. The present application achieves the purpose of generating a target scene picture including a stroke effect according to the stroke area mask of the model to be stroked by creating a target map corresponding to the model to be stroked and performing sampling corresponding to multiple offset directions, thereby achieving the technical effect of improving the accuracy of model strokes and improving the versatility of the stroke scheme for the model, thereby solving the technical problems that the model stroke scheme provided by the related technology is prone to stroke errors, poor adaptability to the model, and strong limitations of the scheme.

[0053] The above method of the embodiment of the present application is further introduced below.

[0054] Optionally, the above screen generation method may further include the following execution steps:

[0055] Step S241, obtaining dynamic selection information corresponding to multiple candidate models in the virtual scene;

[0056] Step S242: determining a model to be stroked from a plurality of candidate models according to the dynamic selection information.

[0057] In the application scenario, the user can select multiple candidate models in the virtual scene, based on which the above dynamic selection information is used to characterize the candidate model currently selected by the user. According to the application scenario requirements, in the process of making the stroke effect for the candidate model currently selected by the user, the dynamic selection information is obtained in real time, and the model to be stroked is determined according to the dynamic selection information.

[0058] Furthermore, since the model to be stroked is determined in real time, the target map created based on the model to be stroked is also updated in real time, that is, the target map is also dynamically determined according to the parameter transmission of the virtual scene, which makes the embodiment of the present application more applicable to application scenarios.

[0059] Through the above-mentioned execution steps, in the embodiment of the present application, the model to be stroked is dynamically determined according to the real-time operation of the player, and the model to be stroked can be selected more in real time and accurately, so as to generate a stroke effect for the model to be stroked, and further generate a scene screen including the stroke effect.

[0060] Optionally, in step S21, creating a target map based on the current picture frame of the virtual scene and the model information of the model to be stroked in the virtual scene may include the following execution steps:

[0061] Step S211, determining the display area according to the current picture frame and model information;

[0062] Step S212, creating a target map based on the current picture frame and the display area.

[0063] In the application scenario, the display area of ​​the model to be stroked in the current frame is determined according to the model information of the model to be stroked, and a target map is created according to the current frame and the display area. The target map may be a rendering texture (RT) map.

[0064] Through the above-mentioned execution steps, the embodiment of the present application creates a rendering texture map based on the current picture frame of the virtual scene acquired in real time and the model information of the model to be stroked selected in real time, so that the picture generation method can provide real-time feedback on the dynamic changes of the scene picture and the currently selected model to be stroked in the application scene, and can be applicable to complex scenes containing a large number of dynamic elements or that require frequent changes.

[0065] Optionally, the model information includes model position data and model outline data; in step S211, determining the display area according to the current picture frame and the model information may include the following execution steps:

[0066] Step S213, determining the display area from the current picture frame according to the model position data and the model outline data.

[0067] The model position data is used to determine the display position of the model to be stroked in the virtual scene, and the model contour data is used to determine the model outer contour of the model to be stroked (that is, the projection contour of the virtual model on the current picture frame). According to the model position data and the model contour data, the display area corresponding to the model to be stroked in the current picture frame can be determined, that is, which pixels in the current picture frame belong to the above display area.

[0068] Through the above-mentioned execution steps, the embodiment of the present application can automatically determine the above-mentioned display area by obtaining the model position data and model contour data of the model to be stroked, so as to subsequently determine the stroke area mask, so that the picture generation method can follow the dynamically changing current picture frame and the model to be stroked to timely generate the target scene picture.

[0069] Optionally, the model information also includes character camp data corresponding to the model to be stroked; in step S212, creating a target map based on the current picture frame and the display area may include the following execution steps:

[0070] Step S214, creating a rendering texture map including multiple color channels based on the current picture frame;

[0071] Step S215, using the character camp data, determining a target color channel corresponding to the model to be stroked from multiple color channels;

[0072] Step S216, in the target color channel of the rendered texture map, the pixel values ​​corresponding to the display area are set to the first value, the pixel values ​​corresponding to other areas of the target map except the display area are set to the second value, and the pixel values ​​corresponding to other color channels in the multiple color channels except the target color channel are set to the second value, to obtain the target map.

[0073] The above-mentioned character camp data can be used to determine the camp to which the virtual character corresponding to the model to be stroked belongs, and the camp corresponds to the display attributes such as the stroke color and stroke style of the model to be stroked. For example, the above-mentioned character camp data can determine whether the virtual character corresponding to the model to be stroked belongs to the friendly camp or the enemy camp of the current player. If the virtual character corresponding to the model to be stroked belongs to the friendly camp, the stroke color of the model to be stroked is determined to be green, and the RGB value is expressed as (0,255,0); if the virtual character corresponding to the model to be stroked belongs to the enemy camp, the stroke color of the model to be stroked is determined to be red, and the RGB value is expressed as (255,0,0).

[0074] Based on the current frame of the virtual scene, an RT map is created, which contains three color channels, which are respectively recorded as R channel, G channel and B channel. Furthermore, the target color channel corresponding to the model to be stroked is determined from multiple color channels using the character camp data. For example, if the virtual character corresponding to the model to be stroked belongs to the friendly camp, the selected target color channel is the G channel; if the virtual character corresponding to the model to be stroked belongs to the enemy camp, the selected target color channel is the R channel.

[0075] Furthermore, in the target color channel of the RT map, the pixel values ​​of multiple pixels in the display area corresponding to the model to be stroked are set to a first value, for example, the first value is 1, and the pixel values ​​of other pixels in the RT map except the multiple pixels in the display area in the target color channel are set to a second value, for example, the second value is 0.

[0076] Based on this, when the model to be stroked includes virtual models corresponding to the enemy camp and the friendly camp: in the G channel of the RT map, the pixel values ​​of multiple pixels in the display area corresponding to the virtual model of the friendly camp are 1, and the pixel values ​​of other pixels except the multiple pixels in the display area are 0; in the R channel of the RT map, the pixel values ​​of multiple pixels in the display area corresponding to the virtual model of the enemy camp are 1, and the pixel values ​​of other pixels except the multiple pixels in the display area are 0. At this time, for the entire RT map, the RGB color value of the display area corresponding to the virtual model of the friendly camp is (0,1,0), so it appears green; and the RGB color value of the display area corresponding to the virtual model of the enemy camp is (1,0,0), so it appears red; and the color value of the pixels outside the display area of ​​the virtual model of the enemy camp or the friendly camp in the RT map is (0,0,0), so it appears black.

[0077] Through the above-mentioned execution steps, the embodiment of the present application can use the pixel values ​​of multiple color channels of the target map to characterize the display area of ​​the model to be stroked in the current picture frame, thereby facilitating the subsequent determination of the stroke area mask of the model to be stroked based on the display area. Therefore, the picture generation method provided by the embodiment of the present application can be applicable to more application scenarios and virtual models, with fewer limitations.

[0078] Optionally, in step S22, performing offset sampling processing on the target map according to multiple offset directions to determine a stroke area mask corresponding to the model to be stroked may include the following execution steps:

[0079] Step S221, sampling the target color channel of the target map using the screen space coordinates corresponding to the virtual scene to obtain a first sampling result;

[0080] Step S222, performing offset calculation on the first sampling result according to multiple offset directions to obtain multiple groups of second sampling results, wherein the multiple groups of second sampling results are used to represent offset pixel information corresponding to the multiple offset directions in the target color channel;

[0081] Step S223, performing difference mapping calculation based on the first sampling result and the multiple groups of second sampling results to obtain a stroke area mask.

[0082] In the application scenario, a post-processing process is created in the engineering pipeline file (pipeline.xml) corresponding to the virtual scene, and a first shader and a second shader are created in the post-processing process. The first shader is used to generate a stroke area mask corresponding to the model to be stroked, and the second shader is used to generate a stroke visual effect based on the stroke area mask.

[0083] In the first shader, the screen space coordinates (UV coordinates) of the virtual scene are used to sample the RT map (ie, the target map) to obtain a first sampling result, which includes R value data corresponding to the R channel of the RT map and G value data corresponding to the G channel.

[0084] Further, the above-mentioned multiple offset direction presets include: when up, down, left, and right, the first sampling result is offset calculated according to the preset offset length to obtain multiple groups of second sampling results. For example, according to the offset length, the R value data in the first sampling result is offset upward to obtain R1 value data, the R value data in the first sampling result is offset downward to obtain R2 value data, the R value data in the first sampling result is offset to the left to obtain R3 value data, and the R value data in the first sampling result is offset to the right to obtain R4 value data. Similarly, according to the offset length, the G value data in the first sampling result is offset upward to obtain G1 value data, the G value data in the first sampling result is offset downward to obtain G2 value data, the G value data in the first sampling result is offset to the left to obtain G3 value data, and the G value data in the first sampling result is offset to the right to obtain G4 value data. That is, when the first sampling result includes R value data and G value data, the plurality of groups of second sampling data include: R1 value data and G1 value data (first group), R2 value data and G2 value data (second group), R3 value data and G3 value data (third group), R4 value data and G4 value data (fourth group). Further, difference mapping calculation is performed based on the first sampling result and the plurality of groups of second sampling results to obtain a stroke area mask.

[0085] Through the above execution steps, the embodiment of the present application obtains five groups of sampling results (including one group of first sampling results and four groups of second sampling results) through five samplings, and determines the stroke area mask based on the five groups of sampling results to support the subsequent generation of the stroke effect of the model to be stroked based on the stroke area mask. In other words, the generation of the stroke effect in the embodiment of the present application does not rely on the model discovery information and the scene depth information, has low requirements on the quality of the model itself, has few limitations, and has strong applicability to models and scenes.

[0086] Optionally, in step S223, performing difference mapping calculation based on the first sampling result and the plurality of groups of second sampling results to obtain a stroke area mask may include the following execution steps:

[0087] Step S2231, performing difference calculations on the first sampling result and the multiple groups of second sampling results respectively to obtain multiple groups of first calculation results;

[0088] Step S2232, performing step mapping calculation on the sum of multiple groups of first calculation results to obtain a second calculation result;

[0089] Step S2233: determine the stroke area mask according to the second calculation result.

[0090] Still taking the above application scenario as an example, in the first shader, difference calculations are performed on the first sampling result and the multiple groups of second sampling results respectively to obtain multiple groups of first calculation results.

[0091] For example, the R value data is respectively calculated as a difference with the R1 value data, the R2 value data, the R3 value data, and the R4 value data, and the absolute value of the obtained difference is taken to obtain four difference results, which are respectively expressed as: |R1-R|, |R2-R|, |R3-R|, |R4-R|. Further, after adding the four difference results, the step mapping (Step) function is used to calculate the sum of the four difference results to obtain a second calculation result. According to the second calculation result, when the sum of the four difference values ​​corresponding to a certain pixel is greater than a preset threshold (such as 0.001), the pixel is determined to belong to the first stroke mask area corresponding to the enemy camp.

[0092] For another example, the G value data is respectively subtracted from the G1 value data, the G2 value data, the G3 value data, and the G4 value data, and the absolute value of the obtained difference is taken to obtain four difference results, which are respectively expressed as: |G1-G|, |G2-G|, |G3-G|, |G4-G|. Further, after adding the four difference results, the step mapping (Step) function is used to calculate the sum of the four difference results to obtain a second calculation result. According to the second calculation result, when the sum of the four difference values ​​corresponding to a certain pixel is greater than a preset threshold (such as 0.001), the pixel is determined to belong to the second stroke mask area corresponding to the friendly camp.

[0093] Through the above-mentioned execution steps, the embodiment of the present application determines the stroke mask area corresponding to the current picture frame in real time by sampling the RT map, and can also distinguish the stroke mask areas corresponding to the models to be stroked in the enemy camp and the friendly camp, thereby being able to more accurately generate a stroke effect for the models to be stroked.

[0094] Optionally, the above screen generation method may further include the following execution steps:

[0095] Step S251, determining a first color value according to the character camp corresponding to the model to be outlined;

[0096] Step S252, performing multiplication calculation on the stroke area mask and the first color value to obtain a second color value;

[0097] Step S253, performing linear interpolation calculation based on the stroked area mask, the target periodic fluctuation value, the second color value and the preset transparency lower limit value, and updating the stroked area mask, wherein the target periodic fluctuation value is a dynamic value that fluctuates between the preset transparency lower limit value and the preset transparency upper limit value according to a preset period.

[0098] In the application scenario, different preset color values ​​can be defined for different character camps. Furthermore, after determining the character camp of the model to be stroked, the preset color value corresponding to the model to be stroked can be determined as the first color value. After multiplying the stroke area mask by the first color value, a second color value is obtained, and the second color value can be used to characterize the camp stroke color corresponding to the character camp. For example, the first stroke mask area corresponding to the enemy camp is multiplied by the first color value corresponding to the enemy camp to obtain the enemy stroke color mask (that is, the second color value); the second stroke mask area corresponding to the friendly camp is multiplied by the first color value corresponding to the friendly camp to obtain the friendly stroke color mask (that is, the second color value).

[0099] Furthermore, the target periodic fluctuation value may be a transparency fluctuation parameter predefined in the first shader, and the transparency fluctuation parameter fluctuates between a preset lower transparency limit value (e.g., 0) and a preset upper transparency limit value (e.g., 1) according to a preset period. The first stroke mask area corresponding to the enemy camp and the second stroke mask area corresponding to the friendly camp are added and then multiplied by the target periodic fluctuation value to obtain a multiplication result, which is used as the alpha input of the linear interpolation (Lerp) function; the sum of the enemy stroke color mask and the friendly stroke color mask is used as the B input of the Lerp function, and 0 is used as the A input of the Lerp function; based on this, the linear interpolation result Lerp (A, B, alpha) can be used as the latest stroke area mask. The stroke area mask is also transmitted to the second shader for processing as the output of the first shader.

[0100] Through the above-mentioned execution steps, the embodiment of the present application achieves the periodic change effect of the stroked area mask by defining the target periodic fluctuation value and the linear interpolation calculation process. During the periodic change process, the transparency of the stroked area mask fluctuates between the upper transparency limit and the lower transparency limit. It is easy to understand that this periodic change effect can simulate the "breathing" effect of the stroke. Therefore, the embodiment of the present application can not only accurately and in real time determine the stroked area mask of the model to be stroked, but also enhance the expressiveness of the scene picture and improve the user experience through the transparency "breathing" effect of the stroked area mask.

[0101] Optionally, the above screen generation method may further include the following execution steps:

[0102] Step S261, performing offset blur processing on the stroked area mask based on multiple offset directions, and updating the stroked area mask;

[0103] Step S262, using a preset smoothing algorithm, performing stroke smoothing processing on the stroke area mask, and updating the stroke area mask;

[0104] Step S263, using the brightness compensation parameters corresponding to the model to be stroked, perform brightness compensation processing on the stroked area mask to update the stroked area mask, wherein the brightness compensation parameters are determined by the model information.

[0105] In the application scenario, the stroked area mask obtained by the first shader may have aliasing problems. Therefore, in the second shader, based on the multiple offset directions preset in the first shader, the stroked area mask is subjected to offset blur processing, and the stroked area mask is updated. Specifically, a custom shading function is created in the second shader to implement the offset blur function. In the custom shading function, based on the sampler state parameter (SamplerState) corresponding to the RT map, the screen space coordinates corresponding to the CT map, the preset offset blur strength parameter, and the texel size (TexelSize) corresponding to the CT map, the stroked area mask is subjected to offset blur processing, and the stroked area mask is updated.

[0106] Furthermore, the second shader may also use a preset smoothing algorithm (such as a smoothstep algorithm) to perform stroke smoothing on the stroked area mask and update the stroked area mask. In the smoothstep algorithm, the smoothing effect of the stroked area mask may be adjusted by adjusting a smoothing coefficient (such as 0.1, 0.5, etc.).

[0107] Furthermore, in the application scenario, when different character camps use different stroke colors, there may be visual differences in brightness. For example, in the rendering engine, the scene image of the virtual scene will be affected by the engine's bloom effect after the post-processing process. At this time, if the stroke color of the virtual model corresponding to the enemy camp is red, and the stroke color of the virtual model corresponding to the friendly camp is green, the red bloom effect will be weaker than the green bloom effect, which results in the visual effect that the stroke effect of the virtual model corresponding to the friendly camp is thicker and more obvious than the stroke effect of the virtual model corresponding to the enemy camp. In this regard, in order to compensate for the above-mentioned visual difference in brightness, a brightness compensation parameter (such as +1.5) is set in the second shader, and the R channel of the stroke area mask is brightness compensated, that is, the pixel brightness value in the R channel of the stroke area mask is added by 1.5 and then multiplied by the first color value corresponding to the enemy camp to obtain a new second color value, thereby updating the stroke area mask.

[0108] It should be noted that in the embodiment of the present application, it can be considered that the model to be stroked corresponding to the enemy camp and the model to be stroked corresponding to the friendly camp do not interfere with each other. The stroking effect of the model to be stroked corresponding to the enemy camp is within the first stroke area mask corresponding to the enemy camp, and the stroking effect of the model to be stroked corresponding to the friendly camp is within the second stroke area mask corresponding to the friendly camp. After calculating the first stroke area mask and the second stroke area mask, adding the two can obtain the overall stroke area mask corresponding to the current picture frame.

[0109] Through the above-mentioned execution steps, after determining the stroke area mask, the embodiment of the present application can also perform visual performance adjustments on the stroke area mask, such as the above-mentioned offset blur adjustment, smoothing adjustment and brightness compensation adjustment. Therefore, the embodiment of the present application can obtain a scene image with stronger visual expression.

[0110] Optionally, in step S23, using the stroked area mask and the current picture frame to generate the target scene picture may include the following execution steps:

[0111] Step S231 , performing linear interpolation processing on the stroke area mask, the current picture frame and the preset stroke color value to generate a target scene picture.

[0112] In the application scenario, the stroke area mask is used as the alpha input of the linear interpolation (Lerp) function, the preset stroke color value is used as the B input of the Lerp function, and the current frame of the virtual scene is used as the A input of the Lerp function, and then the target scene screen of the virtual scene can be obtained by linear interpolation. The target scene screen at least displays the model to be stroked and the stroke effect corresponding to the model to be stroked, and the stroke effect has the stroke color and stroke style set in the shader (such as the "breathing" effect), and the target scene screen can also distinguish and display the stroke colors of the models to be stroked in the enemy camp and the friendly camp, with strong visual expression and strong real-time generation of the scene screen.

[0113] The following uses an exemplary application scenario as an example to illustrate the above method steps of the embodiment of the present application.

[0114] In an exemplary application scenario, a schematic diagram of a current frame of a virtual scene is as follows: Figure 3 According to the user's dynamic selection data, the model to be stroked is determined from the virtual scene, such as Figure 3 As shown, a selected model to be stroked is displayed in the current frame of the virtual scene in this example.

[0115] Further, the rendering texture map (ie, the target map) created based on the current frame of the virtual scene is as follows: Figure 4 As shown. According to the model information of the model to be stroked, determine the display area of ​​the model to be stroked in the rendering texture map. Perform offset sampling processing on the rendering problem map according to multiple offset directions to determine the stroke area mask corresponding to the model to be stroked, as shown Figure 4 The oblique line shaded area shown represents the mask area corresponding to the stroke area mask determined after the offset sampling process. That is, the stroke effect of the model to be stroked can be generated in the determined stroke area mask.

[0116] Furthermore, a target scene picture of a virtual scene is as follows: Figure 5 The target scene image is obtained by performing linear interpolation calculation using the stroke area mask and the current image frame, and the stroke effect of the model to be stroked is displayed in the target scene image.

[0117] Further, in an exemplary application scenario, a schematic diagram of a stroke effect setting window is as follows: Figure 6 As shown. Users can set the transparency parameters of the breathing effect through the stroke effect setting window, for example, Figure 6The breathing effect transparency parameter 1.0 shown in the setting indicates that the transparency value corresponding to the stroke effect of the model to be stroked fluctuates between 0 and 1.0. Users can also set the background color of the target map through the stroke effect setting window, so as to observe the visual performance adjustment within the stroke area mask during the stroke effect production process. Users can also set the stroke brightness parameter through the stroke effect setting window to adjust the stroke brightness. The higher the stroke brightness, the more prominent the display of the model to be stroked in the target scene screen, making it easier for users to notice the model to be stroked.

[0118] In addition, users can also Figure 6 The stroke effect setting window shown sets the friendly stroke color and the enemy stroke color. For example, in this example, the RGB value of the friendly stroke color is set to (0, 255, 0), and the RGB value of the enemy stroke color is set to (255, 0, 0).

[0119] In addition, in an exemplary application scenario, another schematic diagram of a texture rendering map (ie, a target map) is as follows: Figure 7 As shown. The current frame of the virtual scene can display multiple models to be stroked that are selected by the user at the same time. These models to be stroked can also belong to the enemy camp and our camp. At this time, the created texture rendering map can be used to simultaneously represent the display area corresponding to these multiple models to be stroked. Figure 7 As shown, enemy characters are displayed in red ( Figure 7 Grayscale processing has been performed, not shown), friendly characters are displayed in green ( Figure 7 Grayscale processing has been performed (not shown). Based on this, through the above description of the embodiments of the present application, the stroke effect can be generated for these multiple models to be stroked at the same time, and the transparency periodic fluctuation of the stroke effect can be realized, or the stroke color and stroke style of the stroke effect can be adjusted. The stroke effect can also be distinguished and designed for the models to be stroked in multiple different camps.

[0120] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a disk, an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0121] In this embodiment, a screen generation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0122] Figure 8 is a structural block diagram of a picture generating device according to one embodiment of the present application, such as Figure 8 As shown, the device comprises:

[0123] A creation module 801 is used to create a target map based on the current picture frame of the virtual scene and the model information of the model to be stroked in the virtual scene, wherein the target map is used to represent the display area corresponding to the model to be stroked in the current picture frame;

[0124] A determination module 802 is used to perform offset sampling processing on the target map according to multiple offset directions to determine a stroke area mask corresponding to the model to be stroked;

[0125] The generating module 803 is used to generate a target scene image by using the stroked area mask and the current image frame.

[0126] Optionally, in addition to all the above modules, the above-mentioned picture generation device also includes a selection module (not shown in the figure), which is used to obtain dynamic selection information corresponding to multiple candidate models in the virtual scene, and determine the model to be stroked from multiple candidate models according to the dynamic selection information.

[0127] Optionally, the creation module 801 is further used to: determine a display area according to the current picture frame and model information; and create a target map based on the current picture frame and the display area.

[0128] Optionally, the model information includes model position data and model outline data; the above creation module 801 is also used to: determine the display area from the current picture frame according to the model position data and the model outline data.

[0129] Optionally, the model information also includes character camp data corresponding to the model to be stroked; the above-mentioned creation module 801 is also used to: create a rendering texture map containing multiple color channels based on the current picture frame; use the character camp data to determine the target color channel corresponding to the model to be stroked from the multiple color channels; in the target color channel of the rendering texture map, set the pixel value corresponding to the display area to the first value, set the pixel value corresponding to other areas in the target map except the display area to the second value, and set the pixel value corresponding to other color channels in the multiple color channels except the target color channel to the second value, so as to obtain the target map.

[0130] Optionally, the above-mentioned determination module 802 is also used to: use the screen space coordinates corresponding to the virtual scene to sample the target color channel of the target map to obtain a first sampling result; perform offset calculation on the first sampling result according to multiple offset directions to obtain multiple groups of second sampling results, wherein the multiple groups of second sampling results are used to characterize the offset pixel information corresponding to multiple offset directions in the target color channel; perform difference mapping calculation based on the first sampling result and the multiple groups of second sampling results to obtain a stroke area mask.

[0131] Optionally, the above-mentioned determination module 802 is also used to: perform difference calculation on the first sampling result and multiple groups of second sampling results respectively to obtain multiple groups of first calculation results; perform step mapping calculation on the sum of the multiple groups of first calculation results to obtain a second calculation result; and determine the stroke area mask according to the second calculation result.

[0132] Optionally, in addition to all the above-mentioned modules, the above-mentioned picture generating device also includes an update module (not shown in the figure), the update module is used to determine the first color value according to the character camp corresponding to the model to be stroked, multiply the stroked area mask and the first color value to obtain the second color value, and perform linear interpolation calculation based on the stroked area mask, the target periodic fluctuation value, the second color value and the preset transparency lower limit value to update the stroked area mask, wherein the target periodic fluctuation value is a dynamic value that fluctuates between a preset transparency lower limit value and a preset transparency upper limit value according to a preset period.

[0133] Optionally, the above-mentioned update module is also used to: perform offset blur processing on the stroked area mask based on multiple offset directions, and update the stroked area mask; use a preset smoothing algorithm to perform stroke smoothing processing on the stroked area mask, and update the stroked area mask; use the brightness compensation parameters corresponding to the model to be stroked to perform brightness compensation processing on the stroked area mask, and update the stroked area mask, wherein the brightness compensation parameters are determined by the model information.

[0134] Optionally, the generating module 803 is further configured to perform linear interpolation processing on the stroke area mask, the current picture frame and the preset stroke color value to generate the target scene picture.

[0135] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0136] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0137] Optionally, in this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0138] Optionally, in this embodiment, the computer-readable storage medium may be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the mobile terminals in a mobile terminal group.

[0139] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0140] S1, creating a target map based on a current picture frame of a virtual scene and model information of a model to be stroked in the virtual scene, wherein the target map is used to represent a display area corresponding to the model to be stroked in the current picture frame;

[0141] S2, performing offset sampling processing on the target map according to multiple offset directions to determine a stroke area mask corresponding to the model to be stroked;

[0142] S3, generating a target scene image using the stroked area mask and the current image frame.

[0143] Optionally, the computer-readable storage medium is further configured to store program codes for executing the following steps: obtaining dynamic selection information corresponding to a plurality of candidate models in the virtual scene; and determining a model to be stroked from the plurality of candidate models according to the dynamic selection information.

[0144] Optionally, the computer-readable storage medium is further configured to store program codes for executing the following steps: determining a display area according to a current picture frame and model information; and creating a target map based on the current picture frame and the display area.

[0145] Optionally, the computer-readable storage medium is further configured to store program codes for executing the following steps: the model information includes model position data and model contour data; and a display area is determined from a current picture frame according to the model position data and the model contour data.

[0146] Optionally, the computer-readable storage medium is further configured to store program code for executing the following steps: the model information also includes character camp data corresponding to the model to be stroked; based on the current picture frame, a rendering texture map containing multiple color channels is created; using the character camp data, a target color channel corresponding to the model to be stroked is determined from multiple color channels; in the target color channel of the rendering texture map, the pixel value corresponding to the display area is set to a first value, the pixel value corresponding to other areas in the target map except the display area is set to a second value, and the pixel value corresponding to other color channels in the multiple color channels except the target color channel is set to a second value, so as to obtain a target map.

[0147] Optionally, the computer-readable storage medium is also configured to store program codes for executing the following steps: sampling the target color channel of the target map using the screen space coordinates corresponding to the virtual scene to obtain a first sampling result; performing offset calculations on the first sampling result according to multiple offset directions to obtain multiple groups of second sampling results, wherein the multiple groups of second sampling results are used to characterize the offset pixel information corresponding to multiple offset directions in the target color channel; performing difference mapping calculations based on the first sampling result and the multiple groups of second sampling results to obtain a stroke area mask.

[0148] Optionally, the computer-readable storage medium is also configured to store program codes for executing the following steps: performing difference calculations on the first sampling result and multiple groups of second sampling results respectively to obtain multiple groups of first calculation results; performing step mapping calculations on the sum of the multiple groups of first calculation results to obtain a second calculation result; and determining a stroke area mask based on the second calculation result.

[0149] Optionally, the computer-readable storage medium is also configured to store program codes for executing the following steps: determining a first color value according to a character camp corresponding to the model to be stroked; multiplying the stroked area mask and the first color value to obtain a second color value; performing linear interpolation calculations based on the stroked area mask, the target periodic fluctuation value, the second color value, and a preset transparency lower limit value, and updating the stroked area mask, wherein the target periodic fluctuation value is a dynamic value that fluctuates between a preset transparency lower limit value and a preset transparency upper limit value according to a preset period.

[0150] Optionally, the computer-readable storage medium is also configured to store program codes for executing the following steps: performing offset blur processing on the stroked area mask based on multiple offset directions, and updating the stroked area mask; performing stroke smoothing processing on the stroked area mask using a preset smoothing algorithm, and updating the stroked area mask; performing brightness compensation processing on the stroked area mask using brightness compensation parameters corresponding to the model to be stroked, and updating the stroked area mask, wherein the brightness compensation parameters are determined by the model information.

[0151] Optionally, the computer-readable storage medium is further configured to store program codes for executing the following steps: performing linear interpolation processing on the stroke area mask, the current picture frame and the preset stroke color value to generate a target scene picture.

[0152] In the computer-readable storage medium of the above-mentioned embodiment, a technical solution for implementing a method for generating a picture is provided. Based on the current picture frame of the virtual scene and the model information of the model to be stroked in the virtual scene, a target map is created, wherein the target map is used to characterize the display area corresponding to the model to be stroked in the current picture frame; the target map is subjected to offset sampling processing according to multiple offset directions to determine the stroke area mask corresponding to the model to be stroked; and the target scene picture is generated using the stroke area mask and the current picture frame. The present application achieves the purpose of generating a target scene picture containing a stroke effect according to the stroke area mask of the model to be stroked by creating a target map corresponding to the model to be stroked and performing sampling corresponding to multiple offset directions, thereby achieving the technical effect of improving the accuracy of model stroking and improving the versatility of the stroking scheme for the model, thereby solving the technical problems that the model stroking scheme provided by the related technology is prone to stroking errors, poor adaptability to the model, and strong limitations of the scheme.

[0153] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0154] In an exemplary embodiment of the present application, a program product capable of implementing the above method of the present embodiment is stored on a computer-readable storage medium. In some possible implementations, various aspects of the embodiments of the present application can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present application described in the above "Exemplary Method" section of the present embodiment.

[0155] According to the program product for implementing the above method in the embodiment of the present application, it can adopt a portable compact disk read-only memory and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the embodiment of the present application is not limited thereto. In the embodiment of the present application, the computer-readable storage medium can be any tangible medium containing or storing a program, and the program can be used by or in combination with an instruction execution system, an apparatus or a device.

[0156] The program product may be in any combination of one or more computer-readable media. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of computer-readable storage media (non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0157] It should be noted that the program code contained in the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0158] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0159] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0160] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0161] S1, creating a target map based on a current picture frame of a virtual scene and model information of a model to be stroked in the virtual scene, wherein the target map is used to represent a display area corresponding to the model to be stroked in the current picture frame;

[0162] S2, performing offset sampling processing on the target map according to multiple offset directions to determine a stroke area mask corresponding to the model to be stroked;

[0163] S3, generating a target scene image using the stroked area mask and the current image frame.

[0164] Optionally, the processor may also be configured to execute the following steps through a computer program: obtaining dynamic selection information corresponding to a plurality of candidate models in the virtual scene; and determining a model to be stroked from the plurality of candidate models according to the dynamic selection information.

[0165] Optionally, the processor may also be configured to perform the following steps through a computer program: determining a display area according to a current picture frame and model information; and creating a target map based on the current picture frame and the display area.

[0166] Optionally, the processor may also be configured to perform the following steps through a computer program: the model information includes model position data and model outline data; and the display area is determined from the current picture frame according to the model position data and the model outline data.

[0167] Optionally, the processor may also be configured to perform the following steps through a computer program: the model information also includes character camp data corresponding to the model to be stroked; based on the current picture frame, a rendering texture map comprising multiple color channels is created; using the character camp data, a target color channel corresponding to the model to be stroked is determined from multiple color channels; in the target color channel of the rendering texture map, the pixel values ​​corresponding to the display area are set to a first value, the pixel values ​​corresponding to other areas in the target map except the display area are set to a second value, and the pixel values ​​corresponding to other color channels in the multiple color channels except the target color channel are set to a second value, so as to obtain a target map.

[0168] Optionally, the processor can also be configured to perform the following steps through a computer program: using the screen space coordinates corresponding to the virtual scene, sampling the target color channel of the target map to obtain a first sampling result; performing an offset calculation on the first sampling result according to multiple offset directions to obtain multiple groups of second sampling results, wherein the multiple groups of second sampling results are used to characterize the offset pixel information corresponding to multiple offset directions in the target color channel; performing a difference mapping calculation based on the first sampling result and the multiple groups of second sampling results to obtain a stroke area mask.

[0169] Optionally, the processor can also be configured to execute the following steps through a computer program: performing difference calculations on the first sampling result and multiple groups of second sampling results respectively to obtain multiple groups of first calculation results; performing step mapping calculations on the sum of the multiple groups of first calculation results to obtain a second calculation result; and determining a stroke area mask based on the second calculation result.

[0170] Optionally, the processor may also be configured to execute the following steps through a computer program: determining a first color value according to a character camp corresponding to the model to be stroked; multiplying the stroked area mask and the first color value to obtain a second color value; performing linear interpolation calculations based on the stroked area mask, a target periodic fluctuation value, the second color value, and a preset lower transparency limit value, and updating the stroked area mask, wherein the target periodic fluctuation value is a dynamic value that fluctuates between a preset lower transparency limit value and a preset upper transparency limit value according to a preset period.

[0171] Optionally, the processor may also be configured to execute the following steps through a computer program: based on multiple offset directions, performing offset blur processing on the stroked area mask, and updating the stroked area mask; using a preset smoothing algorithm, performing stroke smoothing processing on the stroked area mask, and updating the stroked area mask; using brightness compensation parameters corresponding to the model to be stroked, performing brightness compensation processing on the stroked area mask, and updating the stroked area mask, wherein the brightness compensation parameters are determined by the model information.

[0172] Optionally, the processor may also be configured to execute the following steps through a computer program: performing linear interpolation processing on the stroke area mask, the current picture frame and the preset stroke color value to generate a target scene picture.

[0173] In the electronic device of the above-mentioned embodiment, a technical solution for realizing a method for generating a picture is provided. A target map is created based on the current picture frame of the virtual scene and the model information of the model to be stroked in the virtual scene, wherein the target map is used to characterize the display area corresponding to the model to be stroked in the current picture frame; the target map is subjected to offset sampling processing according to multiple offset directions to determine the stroke area mask corresponding to the model to be stroked; and the target scene picture is generated using the stroke area mask and the current picture frame. The present application achieves the purpose of generating a target scene picture containing a stroke effect according to the stroke area mask of the model to be stroked by creating a target map corresponding to the model to be stroked and performing sampling corresponding to multiple offset directions, thereby achieving the technical effect of improving the accuracy of model stroking and improving the versatility of the stroking scheme for the model, thereby solving the technical problems that the model stroking scheme provided by the related technology is prone to stroking errors, has poor adaptability to the model, and has strong limitations in the scheme.

[0174] Fig. 9 is a schematic diagram of an electronic device according to one embodiment of the present application. Fig. 9 As shown, the electronic device 900 is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0175] like Fig. 9As shown, the electronic device 900 is in the form of a general computing device. The components of the electronic device 900 may include but are not limited to: at least one processor 910, at least one memory 920, a bus 930 connecting different system components (including the memory 920 and the processor 910), and a display 940.

[0176] The memory 920 stores program codes, which can be executed by the processor 910, so that the processor 910 executes the steps described in the method part of the embodiment of the present application according to various exemplary implementations of the present application.

[0177] The memory 920 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 9201 and / or a cache memory unit 9202, and may further include a read-only memory unit (ROM) 9203, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.

[0178] In some examples, the memory 920 may also include a program / utility 9204 having a set (at least one) of program modules 9205, such program modules 9205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or a combination thereof may include the implementation of a network environment. The memory 920 may further include a memory remotely disposed relative to the processor 910, and these remote memories may be connected to the electronic device 900 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0179] Bus 930 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a local bus of processor 910, or a bus using any of a variety of bus architectures.

[0180] The display 940 may be, for example, a touch screen liquid crystal display (LCD), which may enable a user to interact with a user interface of the electronic device 900 .

[0181] Optionally, the electronic device 900 may also communicate with one or more external devices 1000 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 900, and / or any device that enables the electronic device 900 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 950. Furthermore, the electronic device 900 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 960. Fig. 9 As shown, the network adapter 960 communicates with other modules of the electronic device 900 via the bus 930. It should be understood that although Fig. 9 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) systems, tape drives, and data backup storage systems.

[0182] The electronic device 900 may further include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply and / or a camera.

[0183] It can be understood by those skilled in the art that Fig. 9 The structure shown is for illustration only and does not limit the structure of the above electronic device. Fig. 9 More or fewer components as shown, or with Fig. 9 The memory 920 may be used to store computer programs and corresponding data, such as the computer programs and corresponding data corresponding to the screen generation method in the embodiment of the present application. The processor 910 executes various functional applications and data processing by running the computer programs stored in the memory 920, that is, implementing the above-mentioned screen generation method.

[0184] According to an embodiment of the present application, a computer program product is also provided. Optionally, in this embodiment, the computer program product can provide a screen generation service based on the screen generation method provided in the above embodiments.

[0185] Optionally, in this embodiment, the computer program product may be a set of instructions and codes pre-written according to the screen generation method. The computer program product may run on various computer platforms, including personal computers, servers, mobile devices, etc.

[0186] Optionally, in this embodiment, the instructions and codes corresponding to the computer program product are used to implement the following method steps: based on the current picture frame of the virtual scene and the model information of the model to be stroked in the virtual scene, create a target map, the target map is used to characterize the display area corresponding to the model to be stroked in the current picture frame; offset sampling processing is performed on the target map according to multiple offset directions to determine the stroke area mask corresponding to the model to be stroked; and the target scene picture is generated using the stroke area mask and the current picture frame.

[0187] Through the above-mentioned computer program product, it is possible to provide picture generation services in application scenarios involving the generation of stroke effects for virtual machine models in the field of computer technology. By creating a target map corresponding to the model to be stroked and performing sampling corresponding to multiple offset directions, the purpose of generating a target scene picture containing a stroke effect based on the stroke area mask of the model to be stroked is achieved, thereby achieving the technical effect of improving the accuracy of model strokes and improving the versatility of the stroke scheme for the model, and further solving the technical problems that the model stroke scheme provided by the relevant technology is prone to stroke errors, poor adaptability to the model, and strong limitations of the scheme.

[0188] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0189] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0190] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0191] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0192] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0193] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly or all or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0194] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for generating a picture, It is characterized in that include: Creating a target map based on a current picture frame of a virtual scene and model information of a model to be stroked in the virtual scene, wherein the target map is used to represent a display area corresponding to the model to be stroked in the current picture frame; Performing offset sampling processing on the target map according to multiple offset directions to determine a stroke area mask corresponding to the model to be stroked; The target scene frame is generated by using the stroked area mask and the current frame.

2. The screen generation method according to claim 1, It is characterized in that The screen generation method further includes: Acquire dynamic selection information corresponding to a plurality of candidate models in the virtual scene; According to the dynamic selection information, the model to be stroked is determined from the multiple candidate models.

3. The screen generation method according to claim 1, It is characterized in that Based on the current picture frame of the virtual scene and the model information of the model to be stroked in the virtual scene, creating the target map includes: Determining the display area according to the current picture frame and the model information; The target map is created based on the current picture frame and the display area.

4. The screen generation method according to claim 3, It is characterized in that The model information includes model position data and model outline data; determining the display area according to the current picture frame and the model information includes: The display area is determined from the current picture frame according to the model position data and the model outline data.

5. The screen generation method according to claim 3, It is characterized in that The model information also includes character camp data corresponding to the model to be outlined; Based on the current picture frame and the display area, creating the target map includes: Based on the current picture frame, creating a rendering texture map including multiple color channels; Using the character camp data, determining a target color channel corresponding to the model to be stroked from the multiple color channels; In the target color channel of the rendering texture map, the pixel value corresponding to the display area is set to a first value to obtain the target map.

6. The screen generation method according to claim 1, It is characterized in that Performing offset sampling processing on the target map according to the multiple offset directions to determine the stroke area mask corresponding to the to-be-stroked model comprises: Using the screen space coordinates corresponding to the virtual scene, sampling the target color channel of the target map to obtain a first sampling result; Performing an offset calculation on the first sampling result according to the multiple offset directions to obtain multiple groups of second sampling results, wherein the multiple groups of second sampling results are used to represent the offset pixel information corresponding to the multiple offset directions in the target color channel; A difference mapping calculation is performed based on the first sampling result and the multiple groups of second sampling results to obtain the stroke area mask.

7. The screen generation method according to claim 6, It is characterized in that Performing difference mapping calculation based on the first sampling result and the plurality of groups of second sampling results to obtain the stroke area mask includes: Performing difference calculations on the first sampling result and the multiple groups of second sampling results respectively to obtain multiple groups of first calculation results; Performing step mapping calculation on the sum of the multiple groups of first calculation results to obtain a second calculation result; The stroke area mask is determined according to the second calculation result.

8. The screen generation method according to claim 1, It is characterized in that The screen generation method further includes: Determining a first color value according to a character camp corresponding to the model to be stroked; Performing multiplication calculation on the stroke area mask and the first color value to obtain a second color value; The stroked area mask is updated by performing linear interpolation calculation based on the stroked area mask, the target periodic fluctuation value, the second color value and the preset lower transparency limit value, wherein the target periodic fluctuation value is a dynamic value that fluctuates between the preset lower transparency limit value and the preset upper transparency limit value according to a preset period.

9. The screen generation method according to claim 1, It is characterized in that The screen generation method further includes at least one of the following: Based on the multiple offset directions, performing offset blur processing on the stroked area mask, and updating the stroked area mask; Using a preset smoothing algorithm, performing stroke smoothing processing on the stroke area mask, and updating the stroke area mask; The brightness compensation processing is performed on the stroked area mask by using the brightness compensation parameters corresponding to the model to be stroked, and the stroked area mask is updated, wherein the brightness compensation parameters are determined by the model information.

10. The screen generation method according to any one of claims 1 to 9, It is characterized in that Using the stroke area mask and the current picture frame to generate the target scene picture includes: Linear interpolation processing is performed on the stroke area mask, the current picture frame and the preset stroke color value to generate the target scene picture.

11. A screen generating device, It is characterized in that include: A creation module, used to create a target map based on a current picture frame of a virtual scene and model information of a model to be stroked in the virtual scene, wherein the target map is used to represent a display area corresponding to the model to be stroked in the current picture frame; A determination module, configured to perform an offset sampling process on the target map according to a plurality of offset directions, and determine a stroke area mask corresponding to the model to be stroked; A generating module is used to generate a target scene picture by using the stroke area mask and the current picture frame.

12. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the screen generation method according to any one of claims 1 to 10 when executed by a processor.

13. An electronic device comprising a memory and a processor, It is characterized in that The memory stores a computer program, and the processor is configured to run the computer program to execute the screen generating method according to any one of claims 1 to 10.

14. A computer program product, It is characterized in that The invention comprises a computer program, which implements the screen generation method according to any one of claims 1 to 10 when being executed by a processor.

Citation Information

Cited By

  • Object stroking method, device and equipment and storage medium

    CN120765675A

  • A method, apparatus, device and storage medium for object sketching

    CN120765675B