Dynamic cartoon rendering method and device, electronic equipment and readable storage medium
By converting the three-dimensional model into two-dimensional comic resources and using layered depth maps, the problems of complex dynamic comic production process and lack of effects in the existing technology are solved, and simplified art production and rich dynamic comic effects are achieved, which are suitable for games The dynamic comics of the plot.
Patent Information
- Application Number
- CN202411111641.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-26
AI Technical Summary
In the existing technology, when making game plot dynamic comics, the hand-drawn comic grid method requires a lot of picture resources and is difficult to edit. The live2D method relies on manpower and the three-dimensional model method is difficult to express the flat comic art style and add stylized effects, resulting in complicated production processes and The results are scarce.
By obtaining the three-dimensional model in the game, converting it into two-dimensional comic picture resources for layered rendering, using layered depth maps to add dynamic effects, and responding to editing operations to achieve dynamic floating rendering, simplifying the art production process and rendering performance consumption, and achieving rich Dynamic comic effect.
With the simplification of art production process and rendering performance consumption, rich dynamic comic effects are achieved and intuitive and fast editing is supported, suitable for performance in various comic styles.
Smart Images

Figure CN119027552A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rendering technology, and in particular to a dynamic comic rendering method, a dynamic comic rendering device, a corresponding electronic device, and a corresponding computer-readable storage medium. Background Art
[0002] In order to enrich the way of expressing the game plot, comics can be used to express the plot of stylized games. In order to meet the personalized design of comic styles, the game usually adopts plot dynamic comics. The production methods of plot dynamic comics in games can include hand-drawn comic grid method, live2D method and three-dimensional model method.
[0003] However, the hand-drawn comics method requires a large number of image resources and takes a long time to produce, and it is not easy to flexibly edit and modify the completed resources; the live2D method relies on adding comic animations based on hand-drawn comics, and requires skinning and skeleton production for each different image, which requires a lot of manpower and is difficult to apply to situations with a large number of comics; comics produced by the 3D model method have a strong sense of 3D, and it is difficult to express the flat comic art style, and it is difficult to add various stylized comic art effects. That is, the production process is relatively complicated. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a dynamic comic rendering method, a dynamic comic rendering device, a corresponding electronic device and a corresponding computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
[0005] An embodiment of the present invention discloses a method for rendering a dynamic comic, the method comprising:
[0006] Obtaining a three-dimensional model in the game, and obtaining comic picture resources based on the three-dimensional model;
[0007] Performing layered rendering of the comic effect on the comic picture resource to obtain a rendered comic resource;
[0008] Obtaining a layered depth map of the comic picture resource, and adding a dynamic effect to the rendered comic resource through the layered depth map to obtain an initial dynamic comic;
[0009] In response to an editing operation on a target position in the initial dynamic comic, the target position in the initial dynamic comic is dynamically rendered to obtain a target dynamic comic.
[0010] The embodiment of the present invention further discloses a dynamic comic rendering device, the device comprising:
[0011] A comic resource acquisition module, used to acquire a three-dimensional model in the game and obtain comic picture resources based on the three-dimensional model;
[0012] A comic effect rendering module, used for performing layered rendering of comic effects on the comic picture resources to obtain rendered comic resources;
[0013] A dynamic effect rendering module, used to obtain a layered depth map of the comic picture resource, and add a dynamic effect to the rendered comic resource through the layered depth map to obtain an initial dynamic comic;
[0014] The dynamic effect editing module is used to respond to the editing operation of the target position in the initial dynamic comic, and dynamically flutter the target position in the initial dynamic comic to obtain a target dynamic comic.
[0015] An embodiment of the present invention further discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, any one of the dynamic comic rendering methods is implemented.
[0016] The embodiment of the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, any one of the dynamic comic rendering methods is implemented.
[0017] The embodiments of the present invention include the following advantages:
[0018] In an embodiment of the present invention, a two-dimensional comic picture resource is obtained based on a three-dimensional model, and comic effects are layered rendered on the comic picture resource, and dynamic effects are added to the comic resource after the comic effects are layered rendered through a layered depth map to obtain an initial dynamic comic. By converting three-dimensional content into two-dimensional visual materials, various comic effects are layered rendered, and the character layer is split with the help of a layered depth map to achieve the addition of dynamic comic effects, thereby achieving rich dynamic comic effects in the game engine while streamlining the art production process and comic rendering performance consumption. Furthermore, in response to the preset floating tool's editing operation on the target position in the initial dynamic comic with dynamic effects added, the target position in the initial dynamic comic is dynamically floated and rendered to obtain a target dynamic comic, so as to achieve intuitive and fast editing of the floating effect in the engine. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a flowchart of a step of an embodiment of a dynamic comic rendering method of the present invention;
[0020] Figure 2 is a schematic diagram of building a model shooting environment provided by an embodiment of the present invention;
[0021] FIG. 3A to FIG. 3B is a schematic diagram of a character layered rendering provided by an embodiment of the present invention;
[0022] Figure 4 is a schematic diagram of a layered depth map provided by an embodiment of the present invention;
[0023] Figure 5 is a schematic diagram of a layered mask image provided by an embodiment of the present invention;
[0024] Figure 6 is a schematic diagram of the effect of comic line arrangement processing provided by an embodiment of the present invention;
[0025] Figure 7 is a schematic diagram of the effect of comic stroke processing provided by an embodiment of the present invention;
[0026] Figure 8 is a disturbance noise graph provided by an embodiment of the present invention;
[0027] Fig. 9 is a schematic diagram of the effect of comic texture overlay processing provided by an embodiment of the present invention;
[0028] Fig.10 is a schematic diagram of editing the floating rendering effect provided by an embodiment of the present invention;
[0029] Fig.11 It is a structural block diagram of an embodiment of a dynamic comic rendering device of the present invention. DETAILED DESCRIPTION
[0030] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0031] The relevant production methods of plot dynamic comics in the game may include hand-drawn comic frame method, live2D method and three-dimensional model method, etc. As an example, the hand-drawn comic frame method is mainly produced by hand-drawn comic frame picture resources, and the desired comic expression can be flexibly realized through art means, but this method requires a large number of picture resources and takes a long time to produce, and it is not easy to flexibly edit and modify the completed resources; as another example, the live2D method mainly uses two-dimensional bone binding and other methods to make the picture produce dynamic effects, so as to realize two-dimensional animation with fewer art resources, but this method relies on adding comic dynamic effects on the basis of hand-drawn comics, and it is necessary to skin and skeleton each different picture, which requires a lot of manpower to produce, and it is difficult to apply to the situation of a large number of comics; as another example, the three-dimensional model method is mainly to realize the production of comic resources by taking screenshots or real-time playback of three-dimensional models, which is convenient for editing and modifying resources, and can reduce the manpower of art production, but the comics produced by this method have a strong three-dimensional sense, it is difficult to express the flat comic art style, and it is difficult to add various stylized comic art effects.
[0032] From the above, it can be seen that for the related production methods of plot animation comics in games, the production process is relatively complicated and the performance effect is relatively poor.
[0033] The embodiment of the present invention proposes a plot comic rendering production scheme with a simple production process and rich expression effects, which realizes rich dynamic comic effects in the game engine while streamlining the art production process and comic rendering performance consumption. Specifically, by converting three-dimensional content into two-dimensional visual materials, layered rendering of various comic effects is performed, and at the same time, the character layer is split by means of a layered depth map to realize the addition of dynamic comic effects, and then, while streamlining the art production process and comic rendering performance consumption, rich dynamic comic effects are realized in the game engine by layered rendering of comic pictures. Further, in response to the editing operation of the preset floating tool on the target position in the initial dynamic comic with the dynamic effect added, the target position in the initial dynamic comic is dynamically floated and rendered to obtain the target dynamic comic, so as to realize the intuitive and fast editing of the floating effect in the engine. Specifically, by combining the preset floating tool and the layered depth map, the floating effect of the target position can be quickly added and edited without binding the comic picture with skin.
[0034] Reference Figure 1 , shows a flowchart of a method for rendering a dynamic comic according to an embodiment of the present invention, which may specifically include the following steps:
[0035] Step 101, obtaining a three-dimensional model in the game, and obtaining a comic picture resource based on the three-dimensional model;
[0036] In the embodiment of the present invention, three-dimensional content can be converted into two-dimensional visual materials to perform layered rendering of various comic effects.
[0037] Specifically, the three-dimensional model may be converted into a two-dimensional image resource to produce a comic image resource, which may be specifically expressed as photographing the three-dimensional model to obtain a two-dimensional rendering image.
[0038] In practical applications, in order to facilitate layered rendering of comic effects, when a three-dimensional model is photographed to obtain a two-dimensional rendered image, multiple layers of rendered images can be acquired, that is, the comic picture resources obtained based on the three-dimensional model can contain multiple layers of rendered images.
[0039] Among them, the rendering images of different layers can be determined based on different materials or different model parts in the three-dimensional model, different textures and materials are applied to different parts of the model, each layer can contain one or more textures, a three-dimensional model can be divided into multiple parts, each part can be assigned different materials, and this is not limited by the embodiments of the present invention.
[0040] Step 102, performing layered rendering of the comic effect on the comic picture resource to obtain a rendered comic resource;
[0041] The layered rendering of comic effects on comic picture resources can be expressed as rendering images of different layers in the comic picture resources, using multiple identical or different comic effects for rendering, and in the rendering process, each layer is rendered separately to enrich the comic effect through layered rendering of images.
[0042] Step 103, obtaining a layered depth map of the comic picture resource, and adding a dynamic effect to the rendered comic resource through the layered depth map to obtain an initial dynamic comic;
[0043] In an embodiment of the present invention, the character layer can be split to add dynamic comic effects. Specifically, the character layer can be split by means of a layered depth map to achieve the addition of dynamic comic effects, and then, by rendering the comic images in layers, rich dynamic comic effects can be achieved in the game engine while streamlining the art production process and comic rendering performance consumption.
[0044] In one embodiment of the present invention, dynamic effects can be added to the rendered comic resources through layered depth maps to obtain initial dynamic comics, so that dynamic effect editing of two-dimensional images (such as comic pictures) can be achieved without relying on complex three-dimensional models and skinning animations.
[0045] Among them, layered depth image (LDI) refers to a technology used for three-dimensional graphics rendering. The image format of layered depth map can contain not only color information but also depth information. The depth value of each pixel can be used to represent the distance of the pixel in three-dimensional space, so as to simulate the three-dimensional effect on the two-dimensional image, and then add depth information to different layers. Without binding the skin, simple image processing techniques such as displacement mapping and distortion filters can be used to simulate dynamic comic effects. For example, the hair layers can be dynamically fluttered according to their depth information and preset animation parameters.
[0046] Step 104, in response to the editing operation of the preset floating tool on the target position in the initial dynamic cartoon, the target position in the initial dynamic cartoon is dynamically floated and rendered to obtain the target dynamic cartoon.
[0047] In the embodiment of the present invention, in response to an editing operation on a target position in an initial dynamic comic with a dynamic effect added, the target position in the initial dynamic comic can be dynamically rendered to obtain a target dynamic comic, so as to achieve intuitive and fast editing of the floating effect in the engine.
[0048] In some embodiments of the present invention, the step 101 of obtaining comic picture resources based on the three-dimensional model includes:
[0049] A model shooting environment is built based on a three-dimensional character model, a comic background model and a preset virtual camera; a preset script is run to control the preset virtual camera to shoot the three-dimensional character model in the model shooting environment to obtain a rendered image, thereby obtaining a comic picture resource.
[0050] The execution of the preset script can automatically convert the three-dimensional model captured in real time based on RT (Render Texture, used to save the current camera rendering image) into a two-dimensional image resource to produce comic image resources, thereby eliminating the process of manually hand-drawing comic frames and quickly capturing and adjusting the RT of the three-dimensional model to generate comic resources.
[0051] In actual applications, in order to realize the production of RT-based 3D cartoon characters into comic frames, it is necessary to shoot RT pictures of the character's 3D model, that is, rendered images. At this time, it is necessary to set the RT shooting scene, add RT post-processing effects, and then shoot to obtain 2D comic picture resources.
[0052] First, you can build the model shooting environment. Figure 2As shown, the RT shooting scene is mainly composed of a character, a background, and a camera. The character can be any existing character model, that is, any 3D character model; the background can be a 2D surface or a 3D model, such as a comic background model; the camera can refer to a virtual camera in the RT shooting scene. For example, a model shooting environment such as a comic background can be built on the basis of an existing 3D character model, and an RT image can be automatically shot for the 3D character model in the model shooting environment by executing a preset script.
[0053] In order to facilitate layered rendering of comic effects, the captured RT image may include multiple layers of rendered images, such as but not limited to hairless character pictures, character hair pictures, character area masks, hairless characters, depth maps with hair, and background layers. This is not limited in the embodiments of the present invention.
[0054] Among them, for the camera settings, exemplarily, it can be expressed as setting the projection parameter to Orthographic, that is, the camera is in orthogonal projection mode; and setting the Clipping Planes parameter, the ClippingPlanes parameter represents the near and far planes of the camera's culling space; and checking the Post Processing parameter, whether the PostProcessing parameter is checked or not mainly indicates whether post-processing is turned on; and, the Output Texture can be set to represent the output texture map of the camera; for the RT settings, exemplarily, the RT attributes added in the Output Texture can be set, and usually it is only necessary to set the size of the RT to the desired size.
[0055] Optionally, you can assign the created RT to the Output Texture parameter in the camera settings and set the RT for the camera so that the image taken by the preset camera can be saved as a picture resource through the RT. That is, when the preset camera takes the RT image, it is equivalent to saving the image taken by the preset camera in the RT.
[0056] In the process of controlling the preset virtual camera to shoot the three-dimensional character model in the model shooting environment, a layered rendering of the character can be obtained.
[0057] Specifically, a texture map can be created, and a preset virtual camera can be controlled in a model shooting environment to shoot a 3D character model, and then the shot image can be saved in the texture map to obtain character layered renderings of different layers. In actual applications, different model parts of the 3D character model can be hidden in the model shooting environment, and a preset virtual camera can be controlled to shoot the hidden local character models to obtain character layered renderings of different layers.
[0058] For example, when shooting a layered rendering of a character, you can create a texture map RT such as Figure 3A and Figure 3B As shown, the rendered image can be shot on the original material of the 3D character model. Figure 3A When shooting, you can hide the hair model; Figure 3B When doing so, you can only break the hair model of the Aishe character, so as to shoot the hidden partial character model, and then obtain a layered rendering of the character.
[0059] In the process of controlling the preset virtual camera to shoot the three-dimensional character model in the model shooting environment, a layered mask image can be captured. The layered mask image can contain multiple layers of image information of the Mask.
[0060] Specifically, the depth information of the three-dimensional character model can be obtained, and the three-dimensional character model can be rendered in grayscale using corresponding pixel values according to the depth information; in the model shooting environment, the preset virtual camera is controlled to shoot the three-dimensional character model after grayscale rendering to obtain a layered depth map; different color materials are set for different layers in the layered depth map to obtain a layered mask image for the three-dimensional character model.
[0061] For example, when shooting a layered mask image, you can modify the custom material, such as expressing the depth information of the model in grayscale and shooting it as RT, and get the following Figure 4 The layered depth map shown in the figure can then be used to set different colored materials for different layers, such as setting a green material for the character's hair, a red material for the skin, and a blue material for the clothes, and then shooting to obtain the following Figure 5 The layered mask image shown.
[0062] In an embodiment of the present invention, based on the captured RT image, such as the character layered rendering image and the layered mask image, the character can be rendered with a layered comic effect, and the comic effect can include at least one of the following: comic line arrangement, comic stroke, and comic texture. Exemplarily, the character can be divided into a character layer, a hair layer, a special effect layer, and a background layer, and comic effects including comic line arrangement, comic stroke, and comic texture can be added to enrich the comic effect by layered rendering of the image.
[0063] In some embodiments of the present invention, when the comic effect is comic line arrangement, the step 102, performing layered rendering of the comic effect on the comic picture resource to obtain the rendered comic resource, includes:
[0064] For each character layered rendering, the line arrangement area is divided based on the grayscale value of the character layered rendering; on the corresponding line arrangement area of the character layered rendering, the line arrangement texture map with the corresponding density is arranged to obtain the comic resource after line arrangement processing.
[0065] Comic line processing, for each character layered rendering, the line area can be obtained by dividing the gray value of its image resource. The calculation method of the gray value Gray can be as follows:
[0066] Gray=0.3R+0.59G+0.11B Formula 1
[0067] In Formula 1, R is the value of the R channel of the image resource, G is the value of the G channel of the image resource, and B is the value of the B channel of the image resource. After the line area is obtained based on the gray value division, the line texture map can be overlaid and rendered.
[0068] In practical applications, the density of the wiring is inversely correlated with the grayscale value, that is, the wiring is usually distributed in the position / area with low grayscale value, and the lower the grayscale value, the thicker the wiring effect. Specifically, the wiring effect of different densities according to the grayscale value distribution can be expressed by repeatedly arranging texture maps, as shown in the following figure. Figure 6 The comic resource after line drawing processing is shown.
[0069] In some embodiments of the present invention, when the comic effect is comic stroke, the step 102 of performing layered rendering of the comic effect on the comic picture resource to obtain the rendered comic resource includes:
[0070] Perform outward stroke processing on the layered mask image to obtain the comic resource after stroke processing.
[0071] In practical applications, comic styles usually use strokes to enhance the outline of characters. In this case, the stroke can be calculated by expanding the character mask and superimposing noise disturbance to make the shape of the stroke flexible and changeable.
[0072] Specifically, the layered mask image can be moved multiple times, for example, in multiple preset directions, to obtain texture coordinates of multiple character masks, and then the texture coordinates of each character mask can be used to collect data in the layered mask image to obtain multiple character masks. By superimposing multiple character masks and subtracting the initial character mask of the layered mask image, the character outer contour mask can be obtained to achieve outward expansion stroke processing.
[0073] In the specific implementation, the outward stroke is achieved by moving the character UV (referring to the coordinate space of the model map, where U is the horizontal axis and V is the vertical axis) multiple times and sampling. Based on the original Mask, the Mask translated in four directions of up, down, left and right can be superimposed through UV, and then the character edge of the original Mask is subtracted.
[0074] For example, the calculation process of Mask's UV can be as follows:
[0075] UV offset =UV RT +offset+Noise Formula 2
[0076] In formula 2, UV offset It can be the UV coordinates of the character mask obtained after enlarging and offsetting. RT You can mask the UV of the character in RT space, offset can be the displacement of the mask in UV coordinates, and Noise can be used as follows Figure 8 The noise values obtained when perturbing the noise map shown.
[0077] Optionally, the UV of the mask offset in four directions can be obtained by combining the offset in the upward, downward, left and right directions according to formula 1, and the original mask RT can be sampled using the UV of the mask offset in four directions to obtain the character mask that is enlarged and offset in four directions. At this time, the following calculation can be performed:
[0078] Mask Outline =Mask Up +Mask Down +Mask Left +Mask Right -Mask formula 3
[0079] That is, we can superimpose according to formula 3 and subtract the original character mask to obtain the pixel value character outline mask Mask Outline , and then get Figure 7 The comic resource after comic stroke processing shown.
[0080] In some embodiments of the present invention, when the comic effect is a comic texture, the step 102 of performing layered rendering of the comic effect on the comic picture resource to obtain the rendered comic resource includes:
[0081] The comic texture is superimposed on each character layered rendering to obtain the comic resource after the comic texture is added.
[0082] Comic textures can enrich the texture of comics. The texture overlay method can be as follows:
[0083]
[0084] Among them, C is the superimposed image, A is the superimposed texture image, and B is the superimposed original image. The superimposed effect can be as follows Fig. 9 shown.
[0085] In practical applications, comic textures need to be overlaid on character layered renderings of different layers. RT images themselves do not have textures, but save the camera's rendering images. The comic texture overlay is an additional effect. It should be noted that the comic textures used by different layers can be the same, and the texture strengths of comic textures added to character layered renderings of different layers are different, that is, when sharing the same comic texture, the texture strengths of different layers can be adjusted separately.
[0086] In some embodiments of the present invention, the layered depth map can be used to indicate the depth information of different layers in the three-dimensional character model. The step 103 of adding dynamic effects to the rendered comic resource through the layered depth map to obtain the initial dynamic comic includes:
[0087] Based on the depth information of different layers in the three-dimensional character model, the target rendering area is determined; dynamic effects are added to the target rendering area to obtain an initial dynamic comic.
[0088] In an embodiment of the present invention, the layered depth map, an image format, may include not only color information but also depth information, wherein the depth value of each pixel may be used to represent the distance of the pixel in three-dimensional space, thereby simulating a three-dimensional effect on a two-dimensional image, and further adding depth information to different layers. Without binding the skin, simple image processing techniques such as displacement mapping, distortion filters, etc. may be used to simulate dynamic comic effects. For example, the hair layers may be dynamically fluttered according to their depth information and preset animation parameters.
[0089] When adding dynamic effects based on depth information of different layers, specifically, the first depth information of the target layer can be obtained, and the second depth information of the current pixel position can be obtained. If the difference between the first depth information and the second depth information is greater than a preset threshold, the current pixel position can be determined to be the target pixel position, and then a target rendering area is formed based on several target pixel positions.
[0090] Take adding a fluttering effect to the hair area of a character as an example. Since the disturbance directly to the hair will cause a gap between the hair and other parts, in this example, the layered depth map obtained by the above shooting can be used to determine the dynamic hair area based on the depth information of the body and hair. The calculation method can be as follows:
[0091] PartHair=step(DepthHair-DepthHuman,0) Formula 4
[0092] In Formula 4, PartHair can be whether the current pixel is in the hair area. If the value is 0, it means that the current pixel position does not belong to the hair area; if the value is 1, it means that the current pixel position belongs to the hair area.
[0093] Taking the example of adding a fluttering effect to the hair area of a character, DepthHair can represent the first depth information of the target layer, such as the hair layer, and DepthHuman can be used to represent the second depth information obtained by sampling the current pixel position. At this time, the first depth information and the second depth information can be subtracted. If the difference is greater than 0, the value of PartHair can return 1; if the difference is less than 0, the value of PartHair can return 0. Based on the value of PartHair, it is determined whether the current pixel position belongs to the hair area, so as to obtain the hair area that is not blocked by the human body, and to perform UV perturbation on the hair area to show the fluttering effect of the hair.
[0094] In some embodiments of the present invention, the step 104, in response to the editing operation of the preset floating tool on the target position in the initial dynamic comic, dynamically floating rendering the target position in the initial dynamic comic to obtain the target dynamic comic, includes:
[0095] In response to the preset number of editing operations of the preset floating tool on the target position in the initial dynamic cartoon, the target position in the initial dynamic cartoon is dynamically floated for the preset number of times to obtain the target dynamic cartoon.
[0096] In the embodiment of the present invention, intuitive and fast editing of the floating effect in the engine can be achieved. Taking the editing of the floating effect of the hair area as an example, it can be done as follows Fig.10 As shown, a hair fluttering editing tool is designed. By clicking and drawing at the corresponding position with a brush, the hair at that position will flutter.
[0097] The preset number of editing operations performed at the target position may be positively correlated with the fluttering intensity of the target position. That is, in order to more conveniently edit the fluttering intensity of hair at different positions, the drawing may be superimposed, and the more times the same position is drawn, the greater the fluttering intensity of the hair, thereby achieving the effect of flexibly controlling the fluttering intensity.
[0098] In an embodiment of the present invention, a two-dimensional comic picture resource is obtained based on a three-dimensional model, and comic effects are layered rendered on the comic picture resource, and dynamic effects are added to the comic resource after the comic effects are layered rendered through a layered depth map to obtain an initial dynamic comic. By converting three-dimensional content into two-dimensional visual materials, various comic effects are layered rendered, and the character layer is split with the help of a layered depth map to achieve the addition of dynamic comic effects, thereby achieving rich dynamic comic effects in the game engine while streamlining the art production process and comic rendering performance consumption. Furthermore, in response to the preset floating tool's editing operation on the target position in the initial dynamic comic with dynamic effects added, the target position in the initial dynamic comic is dynamically floated and rendered to obtain a target dynamic comic, so as to achieve intuitive and fast editing of the floating effect in the engine.
[0099] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0100] Reference Fig.11 , shows a structural block diagram of an embodiment of a dynamic comic rendering device of the present invention, which may specifically include the following modules:
[0101] A comic resource acquisition module 1101 is used to acquire a three-dimensional model in the game and obtain comic picture resources based on the three-dimensional model;
[0102] A comic effect rendering module 1102 is used to perform layered rendering of comic effects on the comic picture resource to obtain a rendered comic resource;
[0103] A dynamic effect rendering module 1103 is used to obtain a layered depth map of the comic picture resource, and add a dynamic effect to the rendered comic resource through the layered depth map to obtain an initial dynamic comic;
[0104] The dynamic effect editing module 1104 is used to respond to the editing operation on the target position in the initial dynamic comic, and perform dynamic floating rendering on the target position in the initial dynamic comic to obtain a target dynamic comic.
[0105] In an embodiment of the present invention, the three-dimensional model includes a three-dimensional character model and a comic background model; the comic resource acquisition module 1101 may include the following submodules:
[0106] The comic picture shooting submodule is used to build a model shooting environment based on the three-dimensional character model, the comic background model and a preset virtual camera; run a preset script to control the preset virtual camera to shoot the three-dimensional character model in the model shooting environment to obtain a rendered image, so as to obtain a comic picture resource.
[0107] In one embodiment of the present invention, the rendered image includes a character layered rendering; the comic picture shooting submodule may include the following units:
[0108] The character layered rendering image shooting unit is used to create a texture map, control the preset virtual camera to shoot the three-dimensional character model in the model shooting environment; save the shot image into the texture map, and obtain the character layered rendering images of different layers.
[0109] In one embodiment of the present invention, the character layered rendering image shooting unit may include the following subunits:
[0110] The character layered rendering image shooting subunit is used to hide different model parts in the three-dimensional character model in the model shooting environment, and control the preset virtual camera to shoot the hidden local character models respectively.
[0111] In one embodiment of the present invention, the rendered image includes a layered mask image; the comic image shooting submodule may include the following units:
[0112] A layered mask image shooting unit is used to obtain depth information of the three-dimensional character model, and grayscale render the three-dimensional character model using corresponding pixel values according to the depth information; in the model shooting environment, control the preset virtual camera to shoot the three-dimensional character model after grayscale rendering to obtain a layered depth map; set different color materials for different layers in the layered depth map to obtain a layered mask image for the three-dimensional character model.
[0113] In an embodiment of the present invention, the comic effect includes at least one of the following: comic line arrangement, comic stroke and comic texture.
[0114] In an embodiment of the present invention, the comic picture resource includes a character layered rendering image, and the comic effect rendering module 1102 may include the following submodules:
[0115] The comic line processing submodule is used to divide the line area for each character layered rendering image based on the grayscale value of the character layered rendering image when the comic effect is comic line arrangement; wherein the density of the line is inversely correlated with the grayscale value; and arrange the line texture map of the corresponding density on the corresponding line area of the character layered rendering image to obtain the comic resource after line arrangement processing.
[0116] In an embodiment of the present invention, the comic picture resource includes a layered mask picture, and the comic effect rendering module 1102 may include the following submodules:
[0117] A comic stroke processing submodule, used for performing an outward expansion stroke processing on the layered mask image when the comic effect is a comic stroke, to obtain a comic resource after the stroke processing;
[0118] The comic stroke processing submodule may include the following units:
[0119] The comic stroke processing unit is used to move the layered mask image multiple times to obtain the texture coordinates of multiple character masks; use the texture coordinates of each character mask to collect in the layered mask image to obtain multiple character masks; superimpose the multiple character masks and subtract the initial character mask of the layered mask image to obtain the character outer contour mask to achieve outward expansion stroke processing.
[0120] In an embodiment of the present invention, the comic picture resource includes a character layered rendering image, and the comic effect rendering module 1102 may include the following submodules:
[0121] The comic texture overlay processing submodule is used to overlay comic textures on each character layered rendering when the comic effect is comic texture, so as to obtain comic resources after the comic textures are added; wherein the comic textures added to the character layered renderings of different layers have different texture intensities.
[0122] In one embodiment of the present invention, the layered depth map is used to indicate the depth information of different layers in the three-dimensional character model; the dynamic effect rendering module 1103 may include the following submodules:
[0123] The dynamic effect rendering submodule is used to determine the target rendering area based on the depth information of different layers in the three-dimensional character model; add dynamic effects to the target rendering area to obtain an initial dynamic comic.
[0124] In one embodiment of the present invention, the dynamic effect rendering submodule may include the following units:
[0125] A dynamic effect rendering unit is used to obtain first depth information of a target layer and second depth information of a current pixel position; if a difference between the first depth information and the second depth information is greater than a preset threshold, the current pixel position is determined to be a target pixel position; and a target rendering area is formed based on a plurality of target pixel positions.
[0126] In one embodiment of the present invention, the dynamic effect editing module 1104 may include the following submodules:
[0127] The dynamic effect editing submodule is used to respond to the preset number of editing operations of the preset fluttering tool on the target position in the initial dynamic comic, and perform dynamic fluttering rendering on the target position in the initial dynamic comic for a preset number of times to obtain the target dynamic comic; wherein the preset number of editing operations performed on the target position is positively correlated with the fluttering intensity of the target position.
[0128] In an embodiment of the present invention, the dynamic comic rendering device provided by the embodiment of the present invention obtains a two-dimensional comic picture resource based on a three-dimensional model, performs layered rendering of comic effects on the comic picture resource, and adds dynamic effects to the comic resource after the layered rendering of comic effects through a layered depth map to obtain an initial dynamic comic, converts three-dimensional content into two-dimensional visual materials, performs layered rendering of various comic effects, and simultaneously splits the character layer with the help of a layered depth map to achieve the addition of dynamic comic effects, thereby achieving rich dynamic comic effects in the game engine while streamlining the art production process and comic rendering performance consumption. Furthermore, in response to the preset floating tool's editing operation on the target position in the initial dynamic comic with dynamic effects added, the target position in the initial dynamic comic is dynamically floating rendered to obtain a target dynamic comic, so as to achieve intuitive and fast editing of floating effects in the engine.
[0129] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0130] An embodiment of the present invention further provides an electronic device, including:
[0131] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, each process of the above-mentioned dynamic comic rendering method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0132] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the above-mentioned dynamic comic rendering method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0133] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0134] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0135] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0136] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0137] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0138] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0139] Finally, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0140] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0141] A dynamic comic rendering method, a dynamic comic rendering device, a corresponding electronic device and a corresponding computer-readable storage medium provided by the present invention are introduced in detail above. Specific examples are used herein to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for rendering a dynamic comic, characterized in that: The method comprises: Obtaining a three-dimensional model in the game, and obtaining comic picture resources based on the three-dimensional model; Performing layered rendering of the comic effect on the comic picture resource to obtain a rendered comic resource; Obtaining a layered depth map of the comic picture resource, and adding a dynamic effect to the rendered comic resource through the layered depth map to obtain an initial dynamic comic; In response to an editing operation on a target position in the initial dynamic comic, the target position in the initial dynamic comic is dynamically rendered to obtain a target dynamic comic.
2. The method according to claim 1, characterized in that The three-dimensional model includes a three-dimensional character model and a comic background model; and obtaining comic picture resources based on the three-dimensional model includes: Building a model shooting environment based on the three-dimensional character model, the comic background model and a preset virtual camera; Run the preset script, control the preset virtual camera in the model shooting environment to shoot the three-dimensional character model, obtain a rendered image, and obtain a comic picture resource.
3. The method according to claim 2, characterized in that The rendered image includes a character layered rendering; The step of controlling the preset virtual camera to shoot the three-dimensional character model in the model shooting environment to obtain a rendered image includes: Creating a texture map, and controlling the preset virtual camera to shoot the three-dimensional character model in the model shooting environment; The captured image is saved into the texture map to obtain layered renderings of characters of different layers.
4. The method according to claim 3, characterized in that The controlling the preset virtual camera to shoot the three-dimensional character model in the model shooting environment includes: In the model shooting environment, different model parts of the three-dimensional character model are hidden respectively, and the preset virtual camera is controlled to shoot the hidden local character models respectively.
5. The method according to claim 2, characterized in that: The rendered image includes a layered mask image; and the step of controlling the preset virtual camera to shoot the three-dimensional character model in the model shooting environment to obtain the rendered image includes: Acquire depth information of the three-dimensional character model, and perform grayscale rendering on the three-dimensional character model using corresponding pixel values according to the depth information; In the model shooting environment, controlling the preset virtual camera to shoot the grayscale rendered three-dimensional character model to obtain a layered depth map; Different color materials are set for different layers in the layered depth map to obtain a layered mask image for the three-dimensional character model.
6. The method according to claim 1, characterized in that The comic effect includes at least one of the following: comic line arrangement, comic stroke and comic texture.
7. The method according to claim 6, characterized in that The comic picture resource includes a layered rendering of a character, and the layered rendering of the comic picture resource with a comic effect to obtain the rendered comic resource includes: When the comic effect is comic line arrangement, for each character layered rendering, the line arrangement area is divided based on the grayscale value of the character layered rendering; wherein the density of the line arrangement is inversely correlated with the grayscale value; On the corresponding line arrangement area of the character layered rendering image, a line arrangement texture map with a corresponding density is arranged to obtain a comic resource after line arrangement processing.
8. The method according to claim 6, characterized in that The comic picture resource includes a layered mask picture, and the layered rendering of the comic picture resource with a comic effect to obtain the rendered comic resource includes: When the comic effect is comic stroke, performing an outward expansion stroke process on the layered mask image to obtain a comic resource after the stroke process; The step of performing an outward expansion and stroking process on the layered mask image includes: The layered mask image is moved multiple times to obtain texture coordinates of multiple character masks; The texture coordinates of each character mask are collected in the layered mask image to obtain multiple character masks; The multiple character masks are superimposed, and the initial character mask of the layered mask image is subtracted to obtain the character outer contour mask to implement the outward expansion stroke processing.
9. The method according to claim 6, characterized in that The comic picture resource includes a layered rendering of a character, and the layered rendering of the comic picture resource with a comic effect to obtain the rendered comic resource includes: When the comic effect is comic texture, the comic texture is superimposed on each character layered rendering to obtain a comic resource after the comic texture is added; wherein the comic texture added to the character layered renderings of different layers has different texture intensities.
10. The method according to claim 1, characterized in that The layered depth map is used to indicate the depth information of different layers in the three-dimensional character model; The step of adding a dynamic effect to the rendered comic resource through the layered depth map to obtain an initial dynamic comic includes: Determining a target rendering area based on depth information of different layers in the three-dimensional character model; A dynamic effect is added to the target rendering area to obtain an initial dynamic cartoon.
11. The method according to claim 10, characterized in that The step of determining a target rendering area based on depth information of different layers in the three-dimensional character model includes: Obtain the first depth information of the target layer, and obtain the second depth information of the current pixel position; If the difference between the first depth information and the second depth information is greater than a preset threshold, determining the current pixel position as a target pixel position; The target rendering area is composed based on several target pixel positions.
12. The method according to claim 1, characterized in that In response to the editing operation on the target position in the initial dynamic cartoon, the target position in the initial dynamic cartoon is dynamically rendered to obtain the target dynamic cartoon, including: In response to a preset number of editing operations of a preset fluttering tool on a target position in the initial dynamic cartoon, the target position in the initial dynamic cartoon is dynamically fluttered for a preset number of times to obtain a target dynamic cartoon; wherein the preset number of editing operations performed on the target position is positively correlated with the fluttering intensity of the target position.
13. A dynamic comic rendering device, characterized in that: The device comprises: A comic resource acquisition module, used to acquire a three-dimensional model in the game and obtain comic picture resources based on the three-dimensional model; A comic effect rendering module, used for performing layered rendering of comic effects on the comic picture resources to obtain rendered comic resources; A dynamic effect rendering module, used to obtain a layered depth map of the comic picture resource, and add a dynamic effect to the rendered comic resource through the layered depth map to obtain an initial dynamic comic; The dynamic effect editing module is used to respond to the editing operation of the target position in the initial dynamic cartoon, and dynamically flutter the target position in the initial dynamic cartoon to obtain a target dynamic cartoon.
14. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the dynamic comic rendering method according to any one of claims 1 to 12 is implemented.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the dynamic comic rendering method according to any one of claims 1 to 12 is implemented.
