Method and device for generating model strokes and electronic equipment
By calculating and controlling the offset position in the three -dimensional model to generate the initial edge special effects, and use the deep template data to remove the internal pixel part, solve the problem of not obvious or inside the existing technology, and achieve high -quality high -quality gangs, and achieve high -quality high -quality Outer contour effect.
Patent Information
- Application Number
- CN202411282136.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-28
AI Technical Summary
In the prior art, when generating high-quality stroke effects for the three-dimensional model without affecting the normal rendering of the three-dimensional model, there is a problem that the stroke may not be obvious or lead to internal misunderstanding.
By determining the first displacement of each vertex of each pre -generated material instance in the three -dimensional model, calculate the position to be moved to the position to be moved, and control the vertex to generate the initial edge special effects. Then, use deep template data to determine the internal pixels, eliminate the special effects of the internal pixels, and obtain the special effects of the outer contour.
Without affecting the normal rendering of the three -dimensional model, the high -quality external contour traces are generated to avoid the internal area of the stroke coverage that should not be drawn, and ensure that the material rendering of the three -dimensional model is normal.
Smart Images

Figure CN119379882A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and computer-readable storage medium for generating a model stroke. Background Art
[0002] The stroke technology is widely used in game development and computer graphics to enhance the visibility and aesthetics of the edges of 3D models. In game scenes, especially in cartoon-style or comic-like scenes, the stroke effect can significantly enhance the visual experience and make the outlines of characters and objects more distinct.
[0003] At present, stroke technology is mainly divided into two categories: outer stroke and inner stroke. Outer stroke is usually achieved by using an additional rendering channel, which means removing the front part of the model, keeping only the back and extending a certain distance along the vertex normal direction. The thickness of the stroke is controlled by the texture or vertex color information. Inner stroke refers to the method of splitting the UV coordinates, using the gaps between UVs as the basis for the stroke, or drawing the inner stroke directly in the texture.
[0004] Although the current inner and outer stroke technologies meet the needs to a certain extent, when the virtual characters in the virtual game occupy a very small proportion of the interface, the fine strokes may become less obvious, resulting in a weakened visual effect. If the stroke width is increased to improve visibility, it may cause internal goofs, that is, the stroke will cover the part that should not be stroked, thus affecting the overall rendering quality.
[0005] Therefore, how to generate high-quality strokes for 3D models without affecting the normal rendering of the 3D models has become a technical problem that needs to be solved urgently. Summary of the invention
[0006] The present application provides a method, device, electronic device and computer-readable storage medium for generating model strokes, which can generate high-quality strokes on the outer edge of a three-dimensional model without affecting the normal rendering of the three-dimensional model. The specific scheme is as follows:
[0007] In a first aspect, an embodiment of the present application provides a method for generating a model stroke, the method comprising:
[0008] Determine at least one pre-generated material instance included in the three-dimensional model for which a stroke is to be generated, and for each material instance, determine first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance;
[0009] Determine first offsets corresponding to respective vertices of the model sub-region;
[0010] Determine, according to the first offset and the first coordinate, first positions to be moved to which correspond to the vertices of the model sub-region respectively;
[0011] Controlling each vertex of the model sub-region to move to the corresponding first position, and generating an initial stroke special effect corresponding to the model sub-region;
[0012] Determining internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model;
[0013] From the initial stroke special effect corresponding to each of the model sub-regions, the special effect portion corresponding to the internal pixels is removed to obtain the outer contour stroke special effect corresponding to the three-dimensional model.
[0014] In a second aspect, an embodiment of the present application provides a device for generating a model stroke, the device comprising:
[0015] A first determining unit is used to determine at least one pre-generated material instance included in the three-dimensional model for which a stroke is to be generated, and for each material instance, determine first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance;
[0016] A second determining unit, used to determine first offsets corresponding to respective vertices of the model sub-region;
[0017] A third determining unit, configured to determine first positions to be moved to which the vertices of the model sub-region correspond respectively according to the first offset and the first coordinate;
[0018] A control unit, used for controlling each vertex of the model sub-region to move to the corresponding first position, and generating an initial stroke special effect corresponding to the model sub-region;
[0019] a fourth determining unit, configured to determine internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model;
[0020] The culling unit is used to remove the special effect part corresponding to the internal pixels from the initial stroke special effect corresponding to each model sub-region, so as to obtain the outer contour stroke special effect corresponding to the three-dimensional model.
[0021] In a third aspect, the present application further provides an electronic device, including:
[0022] Processor; and
[0023] The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method described in the first aspect is executed.
[0024] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing a data processing program, which is executed by a processor to perform the method described in the first aspect.
[0025] Compared with the prior art, this application has the following advantages:
[0026] The method for generating model strokes provided in the present application includes: determining at least one pre-generated material instance included in a three-dimensional model for which a stroke is to be generated, and for each material instance, determining first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance; determining first offsets corresponding to each vertex of the model sub-region; determining first positions to be moved to which each vertex of the model sub-region corresponds according to the first offset and the first coordinate; controlling each vertex of the model sub-region to move to the corresponding first position, and generating an initial stroke special effect corresponding to the model sub-region; determining internal pixels of the three-dimensional model according to depth template data set for the three-dimensional model; and removing the special effect part corresponding to the internal pixels from the initial stroke special effect corresponding to each model sub-region to obtain an outer contour stroke special effect corresponding to the three-dimensional model.
[0027] It can be seen that the method for generating model strokes provided by the present application determines the first offset of each vertex of the model sub-region corresponding to each pre-generated material instance in the three-dimensional model, thereby obtaining the first position to which each vertex of the model sub-region corresponding to each material instance is to be moved. After controlling each vertex of the model sub-region corresponding to each material instance to move to the corresponding first position, an initial stroke special effect can be generated for each model sub-region corresponding to the material instance, and the generated initial stroke special effect contains the special effect part located inside the three-dimensional model. Afterwards, the internal pixels of the three-dimensional model can be determined from all pixels in the screen space through the depth template data of the three-dimensional model, so that the special effect part corresponding to the internal pixels of the three-dimensional model can be accurately removed from the initial stroke special effect corresponding to each model sub-region, so that only the outer contour special effect corresponding to the three-dimensional model is retained. Since the stroke inside the three-dimensional model is removed, the stroke will not cover the internal area that should not be stroked, and the rendering of the material of the three-dimensional model will not be affected by the stroke, ensuring the normal rendering inside the three-dimensional model. It can be seen that the method for generating a model stroke provided in the embodiment of the present application can generate a high-quality stroke for the outer contour of the three-dimensional model without affecting the normal rendering of the three-dimensional model. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a stroke generation system diagram for implementing a method for generating a model stroke provided in an embodiment of the present application;
[0029] Figure 2 is a flow chart of a method for generating a model stroke provided in an embodiment of the present application;
[0030] Figure 3 This is a schematic diagram of an interface of an example of adding a multi-pass model component in the method for generating a model stroke provided in an embodiment of the present application;
[0031] Figure 4 It is a schematic diagram of an interface of an example of a detail panel of a multi-pass model component in the method for generating a model stroke provided in an embodiment of the present application;
[0032] Figure 5 It is an interface diagram of an example of adding a stroke flow speed to each time node in a blueprint node editor in a method for generating a model stroke provided in an embodiment of the present application;
[0033] Figure 6 It is a schematic diagram of an interface of an example of obtaining the first coordinates of each vertex of a model sub-area in a camera coordinate system through a blueprint node editor in a method for generating a model stroke provided in an embodiment of the present application;
[0034] Figure 7 It is a structural block diagram of an example of a device for generating model strokes provided in an embodiment of the present application;
[0035] Figure 8 It is a structural block diagram of an example of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0037] It should be noted that the terms "first", "second", "third", etc. in the claims, description and drawings of the present application are used to distinguish similar objects and are not used to describe a specific order or sequence. The data used in this way are interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having" and their variants are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes 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.
[0038] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.
[0039] It should be understood that in the embodiments of the present application, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0040] Based on the reasons mentioned in the background technology, in order to generate high-quality strokes on the outer edge of a 3D model without affecting the normal rendering of the 3D model, the embodiments of the present application provide a method, device, electronic device, and computer-readable storage medium for generating a model stroke.
[0041] The method for generating model strokes provided in the embodiment of the present application can be executed by an electronic device, which can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, or a laptop computer. The server can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. It is understandable that the present application does not specifically limit the execution subject of the generation method of the model array animation.
[0042] In an optional embodiment, when the method for generating a model stroke is run on a terminal device, the terminal device stores an application program for the method for generating a model stroke. The terminal device interacts with the user through a graphical user interface. The terminal device may provide the graphical user interface to the user in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal device, or the graphical user interface may be presented through holographic projection.
[0043] In an optional embodiment, when the method for generating model strokes runs on a server, the method can be implemented and executed based on a cloud service system. A cloud service system refers to a service method based on cloud computing. A cloud service system includes a server and a client device. The operating body of the application program of the method for generating model strokes and the display screen presentation body are separated, and the storage and operation of the method for generating model strokes are completed on the server. The display screen presentation of the stroke is completed on the client, and the client is mainly used for receiving, sending and presenting animation data. For example, the client can be a display device with a data transmission function close to the user side, such as a mobile terminal, a television, a computer, a handheld computer, a personal digital assistant, a head-mounted display device, etc., but the electronic device for generating animation is a server in the cloud. When playing the game, the user operates the client to send instructions to the server, and the server controls the operation of the method for generating model strokes according to the instructions, encodes and compresses the data such as the stroke display screen, and returns it to the client through the network. Finally, the client decodes and outputs the animation.
[0044] It should be noted that in the embodiment of the present application, the execution subject of the method for generating model strokes can be a terminal device or a server, wherein the terminal device can be a local terminal device or a client device in the aforementioned cloud service system. The embodiment of the present application does not limit the type of the execution subject.
[0045] For example, in combination with the above introduction, Figure 1 A stroke generation system 100 for implementing a method for generating a model stroke provided by an embodiment of the present application is shown, and the stroke generation system 100 may include a terminal 101, a server 102, and a network 103. The terminal 101 held by a user may be connected to different servers 102 via the network 103. The terminal is any device with computing hardware that can support and execute a software application tool for stroke generation.
[0046] The terminal 101 includes a display screen and a processor, wherein the display screen is used to present the generated strokes, and the processor is used to control the display of the strokes on the display screen. The server 102 is used to run the above method for generating model strokes, and perform related operations according to the instructions sent by the terminal 101.
[0047] In addition, when the stroke generation system 100 includes multiple terminals, multiple servers, and multiple networks, different terminals can be connected to each other through different networks and different servers. The network can be a wireless network or a wired network, such as a wireless network such as a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc. In addition, different terminals can also use their own Bluetooth network or hotspot network to connect to other terminals or to servers, etc. In addition, the system 100 may include multiple databases, multiple databases are coupled to different servers, and game-related information can be continuously stored in the database when different users play multi-user games online.
[0048] It should be noted that Figure 1 The stroke generation system schematic diagram shown is only an example. The stroke generation system 100 described in the embodiment of the present application is to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. A person of ordinary skill in the art can know that with the evolution of the game system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0049] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments described below are used to explain the technical solution of the present application and are not intended to be used as a limitation for actual use.
[0050] The following, combined Figure 2 to Figure 6 The method for generating model strokes provided in an embodiment of the present application is described in detail.
[0051] like Figure 2 , which is a flow chart of a method for generating a model stroke provided in an embodiment of the present application, including the following steps S101 to S106.
[0052] Step S101: determining at least one pre-generated material instance included in a three-dimensional model for which a stroke is to be generated, and for each material instance, determining first coordinates corresponding to respective vertices of a model sub-region corresponding to the material instance.
[0053] In the embodiment of the present application, the three-dimensional model to be stroked refers to a three-dimensional model existing in the screen space, and the three-dimensional model may include but is not limited to a virtual character model, a virtual animal model, a virtual mechanical model, etc. The three-dimensional model may be a player character model or a non-player character model (NPC model). The method provided in the present application can generate a stroke effect for any three-dimensional model in the screen space. The present application does not specifically limit the type of the three-dimensional model.
[0054] The method for generating model strokes provided in an embodiment of the present application can be applied to the stroke path (stroke pass) in the rendering pipeline (Rendering Pipeline) of the three-dimensional model. That is, in addition to the conventional rendering pass (drawing path), the rendering pipeline (Rendering Pipeline) of the three-dimensional model can also add a stroke pass, which is used to generate a stroke effect for the edge of the three-dimensional model. The conventional rendering pass is used to generate a realistic appearance of the surface of the three-dimensional model.
[0055] A three-dimensional model may include at least one pre-generated material instance. In the embodiment of the present application, a corresponding stroke material instance may be created for each material instance, and a corresponding stroke may be generated for each material instance in the stroke material instance. For example, if the three-dimensional model is a character model, which includes skin material, clothing material, and hair material, then the model sub-regions corresponding to each material include the skin region, clothing region, and hair region. In this way, a stroke will be generated for the skin region, a stroke will be generated for the clothing region, and a stroke will be generated for the hair region.
[0056] Rendering pipeline and Pass are very important concepts in computer graphics, especially in the field of real-time rendering. Among them, the rendering pipeline refers to a collection of processing steps in a computer graphics system that are used to generate the final image. In modern graphics processors (GPUs), the rendering pipeline is designed as a highly optimized pipeline structure, and each step is responsible for processing a specific task. Pass refers to a complete processing in the rendering process, usually corresponding to one or more stages in the rendering pipeline. Multi-Pass rendering performs multiple rendering operations on the same 3D model.
[0057] A typical rendering pipeline can be divided into the following stages: vertex processing, rasterization, fragment processing, and post-processing. Vertex processing refers to processing vertex data of geometric bodies, including vertex transformation (such as model view transformation, projection transformation, etc.) and lighting calculation; rasterization is to convert geometric bodies in three-dimensional space into pixels on a two-dimensional screen; fragment processing is to perform shading calculations on the pixels obtained by rasterization, including texture mapping, shadow calculations, etc.; post-processing is to perform additional processing on the image after pixel shading, such as blurring, sharpening, tonal adjustment, etc.
[0058] Unreal Engine is a software used to create virtual reality, augmented reality and game content. It is a powerful 3D graphics editing and rendering software. Unreal Engine can be used to create game scenes, models, objects, animations, special effects and other content, and can perform lighting, rendering, animation and other processing. In addition, Unreal Engine also supports the development of virtual reality and augmented reality applications, and can be used to create immersive virtual reality experiences.
[0059] It should be noted that in Unreal Engine, each 3D model can usually only be rendered once. In the embodiment of the present application, the multi-pass rendering of the above 3D model can be achieved by the following feasible methods:
[0060] In an optional implementation, a developer may rewrite the source code of the engine to support multi-pass rendering of a three-dimensional model.
[0061] In another optional implementation, a corresponding functional plug-in may be selected to support multi-pass rendering of a 3D model. For example, a MultiDraw plug-in may be downloaded and installed, which may be obtained from the Unreal Store to implement the multi-pass rendering function of a single model.
[0062] After installing the functional plug-in, you can add a MultiDraw component to the above 3D model. Specifically, you can add a corresponding multi-pass model component according to the type of the above 3D model.
[0063] Optionally, adding a corresponding multi-pass model component according to the type of the above-mentioned three-dimensional model may specifically include: determining the component type according to the type of the three-dimensional model, and adding a multi-pass model component of the corresponding component type for supporting the stroke effect. For example, for a character model, since the character model belongs to a skeletal mesh, it can be determined that the component to be selected is a component for processing the rendering of the skeletal mesh. In this way, the OutlineSkeletal Mesh component can be selected as the added multi-pass model for processing the stroke rendering of the skeletal mesh.
[0064] After adding a multi-pass model component, you can expand the component details panel corresponding to the multi-pass model component in the interface. In the component details panel, you can create a corresponding number of stroke material instances according to the number of materials of the above 3D model. For example, when the number of materials of the 3D model is 3, you can create 3 stroke material instances in the component details panel, and when the number of materials of the 3D model is 5, you can create 5 stroke material instances in the component details panel.
[0065] In specific implementations, the number of material slots can be determined as the number of materials.
[0066] Among them, material slots are a mechanism used in 3D modeling software or game engines to manage and organize model materials. Material slots allow different materials to be assigned to different parts of the model. Each material slot can be associated with a material, and when the model is rendered, these materials will be applied to different parts of the model. For example, a character model's body, clothes, hair and other parts require different materials to show different textures and colors. The character model can have multiple material slots corresponding to them, which are used to assign materials such as the body, clothes, and hair.
[0067] Material is a combination of visual attributes of the model surface, which may include surface color, texture, smoothness, transparency, reflectivity, refractive index, luminosity, etc.; material defines the type of surface used to make up the object.
[0068] The following combination Figure 3 and Figure 4 The method for generating a model stroke provided in an embodiment of the present application is described below for creating a stroke material instance for a model:
[0069] like Figure 3, is a schematic diagram of an interface for adding a multi-pass model component in the method for generating a model stroke provided in an embodiment of the present application. After the MultiDraw plug-in for realizing the multi-pass rendering function of a single model is installed, a component adding panel can be displayed on the interface. In the component adding panel, a MultiDraw component corresponding to the MultiDraw plug-in is newly added, specifically including component 10 "Multi Draw Dynamic Mesh" (rendering multiple dynamic mesh instance components in one rendering call), component 11 "Multi Draw Procedural Mesh" (rendering multiple procedural mesh instance components in one rendering call), component 12 "Multi Draw Skeletal Mesh" (rendering multiple skeletal mesh instance components in one rendering call), component 13 "Multi Draw Static Mesh" (rendering multiple static mesh instance components in one rendering call), component 14 "Outline Draw Dynamic Mesh" (rendering the outline component of the dynamic mesh), component 15 "Outline Draw Procedural Mesh" (rendering the outline component of the procedural mesh), component 16 "OutlineDraw Skeletal Mesh" (rendering the outline component of the skeletal mesh), component 17 "Outline Draw StaticMesh" (render the outline of the static mesh), from which the user can select the required multi-pass model components.
[0070] like Figure 4 As shown, it is an interface diagram of an example of a detail panel of a multi-pass model component in the method for generating a model stroke provided in an embodiment of the present application. In this interface diagram, the skeletal mesh asset has three material slots, that is, it has three materials. The user can create three elements through control 18 and create three stroke material instances.
[0071] After creating a stroke material instance, you can generate the corresponding stroke in the stroke material instance.
[0072] Optionally, the first coordinates corresponding to each vertex of the model sub-region corresponding to the material instance are the coordinates of each vertex of the model sub-region corresponding to the material instance in the world coordinate system.
[0073] Optionally, the first coordinates corresponding to each vertex of the model sub-region corresponding to the material instance are coordinates of each vertex of the model sub-region corresponding to the material instance in a local coordinate system corresponding to the three-dimensional model.
[0074] Optionally, the first coordinates corresponding to each vertex of the model sub-region corresponding to the material instance are the coordinates of each vertex of the model sub-region corresponding to the material instance in the camera coordinate system corresponding to the virtual camera.
[0075] It should be noted that in computer graphics, especially in the fields of 3D modeling and game development, the coordinate system is the basis for describing the position and orientation of objects. Different coordinate systems are used to handle different scene requirements.
[0076] Among them, world space (world coordinates) is the global coordinate system of the entire scene. In this coordinate system, the positions of all objects are defined relative to the absolute origin of the scene. For example, if a virtual scene contains houses, cars, trees, and people, their respective coordinates in world space can be used to determine their relative positions.
[0077] Local space (local coordinates) refers to the coordinate system relative to the object itself. Each object has its own local space, where the origin is usually the center of the object or a specific point. For example, based on the local space of a cube, the positional relationship between each point on the surface of the cube and the center of the cube can be known.
[0078] View space (camera coordinates) is also called camera space or eye space, which refers to the coordinate system relative to the camera. In this space, the positions of all objects are transformed into positions relative to the camera.
[0079] Step S102: determining first offsets corresponding to respective vertices of the model sub-region.
[0080] In the embodiment of the present application, after determining the first coordinates corresponding to each vertex of the model sub-region corresponding to each material, the first offsets corresponding to each vertex of the model sub-region can be determined.
[0081] The first offset may be data carrying the moving direction and the moving distance, or data carrying only the moving distance. The first offset may be a preset offset, or an offset calculated in real time, and this application does not limit this.
[0082] Step S103: determining first positions to be moved to which the vertices of the model sub-regions correspond respectively according to the first offset and the first coordinates.
[0083] Step S104: Control each vertex of the model sub-region to move to the corresponding first position, and generate an initial stroke special effect corresponding to the model sub-region.
[0084] After determining the first offset, the first coordinate can be offset based on the first offset to obtain the first positions to be moved to corresponding to the vertices of the model sub-region. In this way, the vertices of the model sub-region can be controlled to move to the corresponding first positions, thereby generating the initial stroke effect corresponding to the model sub-region.
[0085] It should be noted that after the vertices of the model sub-area are moved, new edges will be generated. When the generated new edges are captured by the rendering system, a "stroke" effect will be produced.
[0086] In this way, a corresponding initial stroke effect is generated for each model sub-area corresponding to each material.
[0087] Step S105: determining internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model.
[0088] In an embodiment of the present application, a unique depth template data can be set for a three-dimensional model in the screen space, and the depth template data is used to distinguish which part is the model area of the three-dimensional model from the screen space, so as to completely cut out the three-dimensional model. It should be noted that in an embodiment of the present application, a three-dimensional model is set with a unique depth template data, and the model area of a unique three-dimensional model can be determined from the screen space through a depth template data. For example, the depth template data of three-dimensional model 1 is 1, the depth template data of three-dimensional model 2 is 2, the depth template data of three-dimensional model 3 is 3, ... the depth template data of three-dimensional model 100 is 100, etc.
[0089] In an optional implementation, step S105 may be implemented by the following steps:
[0090] Acquire depth template data set for the three-dimensional model;
[0091] Determine a difference between preset depth template data corresponding to each pixel in the screen space and depth template data set for the three-dimensional model;
[0092] Pixels with a difference value of 0 are determined as internal pixels of the three-dimensional model.
[0093] Specifically, after the depth template data is set for the three-dimensional model, the depth template data can be filled into each material instance of the three-dimensional model to ensure that each material instance of the three-dimensional model is only effective for the model with the depth template data.
[0094] In the present application, the preset depth template data corresponding to each pixel is consistent with the three-dimensional model corresponding to the pixel.
[0095] Afterwards, the template test can be used to dichotomize the inside and outside of the three-dimensional model according to the depth template data of the three-dimensional model. Specifically, the preset depth template data carried by all pixels can be subtracted from the depth template data of the three-dimensional model in the shader, and only the preset depth template data of the pixels inside the three-dimensional model in the screen space is the depth template data of the three-dimensional model. In this way, only the result of subtracting the depth template data of the three-dimensional model from the preset depth template data of the pixels inside the three-dimensional model is 0, while the result of subtracting the depth template data of the three-dimensional model from the preset depth template data of other pixels outside the three-dimensional model is not 0 (less than 0 or greater than 0). In this way, the model area corresponding to the three-dimensional model can be accurately determined from the screen space.
[0096] Among them, the shader is used to implement image rendering and is an editable program used to replace the fixed rendering pipeline. Among them, the vertex shader is mainly responsible for the calculation of the geometric relationship of vertices, and the pixel shader is mainly responsible for the calculation of the color of the source.
[0097] Exemplarily, the depth template data set for the three-dimensional model 1 is 12, then the preset depth template data of all pixels inside the three-dimensional model 1 is 12. In the shader, the preset depth template data carried by all pixels can be subtracted by 12. At this time, in the screen space, only the preset depth template data of all pixels inside the three-dimensional model 1 minus 12 is 0, and the preset depth template data of other pixels outside the three-dimensional model 1 is either less than 0 or greater than 0 after subtracting 12. In this way, the model area of the three-dimensional model 1 in the screen space can be accurately obtained.
[0098] In the blueprint node editor interface of Unreal Engine, the depth template data of the 3D model can be obtained through the "SceneTexture" node, and the depth template data of the 3D model obtained by the "SceneTexture" node can be subtracted from the preset depth template data of the pixels in the screen space through the "subtract" node to obtain the model area in the 3D model.
[0099] Among them, Blueprint is a visual programming system in Unreal Engine, which provides an intuitive, node-based interface that users can use to create gameplay elements in the Unreal Editor. Blueprint uses node graphs to achieve many purposes unique to each instance of the blueprint (such as target construction, individual functions, and common gameplay events), providing level designers and game developers with a tool to quickly create and iterate game playability in the Unreal Editor.
[0100] In this way, the pixels located within the model area of the three-dimensional model are the internal pixels of the three-dimensional model.
[0101] Step S106: From the initial stroke special effects corresponding to each of the model sub-regions, remove the special effects portion corresponding to the internal pixels to obtain the outer contour stroke special effects corresponding to the three-dimensional model.
[0102] After determining the internal pixels located inside the three-dimensional model, the special effect part corresponding to the internal pixels in the initial stroke special effect corresponding to each model sub-area can be eliminated, thereby obtaining an outer contour stroke special effect that does not contain the internal pixels and only contains pixels on the outer contour of the three-dimensional model.
[0103] Exemplarily, for a character model, the initial stroke special effect generated in the skin area includes pixels 1 to 100, the initial stroke special effect generated in the hair area includes pixels 101 to 200, and the initial stroke special effect generated in the clothes area includes pixels 201 to 300. The internal pixels of the character model determined are pixels 20 to 60, pixels 135 to 140, and pixels 260 to 290. Then, the special effect portion of pixels 20 to 60 can be removed from the initial stroke special effect generated in the skin area, the special effect portion of pixels 135 to 140 can be removed from the initial stroke special effect generated in the skin area, and the special effect portion of pixels 260 to 290 can be removed from the initial stroke special effect generated in the skin area, to obtain a stroke special effect that does not include internal pixels and only includes pixels on the outer contour of the character model.
[0104] The method for generating model strokes provided in the present application includes: determining at least one pre-generated material instance included in a three-dimensional model for which a stroke is to be generated, and for each material instance, determining first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance; determining first offsets corresponding to each vertex of the model sub-region; determining first positions to be moved to which each vertex of the model sub-region corresponds according to the first offset and the first coordinate; controlling each vertex of the model sub-region to move to the corresponding first position, and generating an initial stroke special effect corresponding to the model sub-region; determining internal pixels of the three-dimensional model according to depth template data set for the three-dimensional model; and removing the special effect part corresponding to the internal pixels from the initial stroke special effect corresponding to each model sub-region to obtain an outer contour stroke special effect corresponding to the three-dimensional model.
[0105] It can be seen that the method for generating model strokes provided by the present application determines the first offset of each vertex of the model sub-region corresponding to each pre-generated material instance in the three-dimensional model, thereby obtaining the first position to which each vertex of the model sub-region corresponding to each material instance is to be moved. After controlling each vertex of the model sub-region corresponding to each material instance to move to the corresponding first position, an initial stroke special effect can be generated for each model sub-region corresponding to the material instance, and the generated initial stroke special effect contains the special effect part located inside the three-dimensional model. Afterwards, the internal pixels of the three-dimensional model can be determined from all pixels in the screen space through the depth template data of the three-dimensional model, so that the special effect part corresponding to the internal pixels of the three-dimensional model can be accurately removed from the initial stroke special effect corresponding to each model sub-region, so that only the outer contour special effect corresponding to the three-dimensional model is retained. Since the stroke inside the three-dimensional model is removed, the stroke will not cover the internal area that should not be stroked, and the rendering of the material of the three-dimensional model will not be affected by the stroke, ensuring the normal rendering inside the three-dimensional model. It can be seen that the method for generating a model stroke provided in the embodiment of the present application can generate a high-quality stroke for the outer contour of the three-dimensional model without affecting the normal rendering of the three-dimensional model.
[0106] In an optional implementation, step S102 may be implemented by following steps S1021 and S1022:
[0107] Step S1021: obtaining a preset stroke width parameter;
[0108] Step S1022: determining first offsets corresponding to respective vertices of the model sub-region according to the stroke width parameter.
[0109] In the embodiment of the present application, a stroke width can be set, and the stroke width represents the movement amplitude of each vertex of the model sub-region. The vertices of the model sub-region can be controlled to expand by the stroke width. Specifically, in the embodiment of the present application, the vertices of the model sub-region can be controlled to expand along the normal direction.
[0110] In an optional implementation manner, the above step S1022 can be specifically implemented by the following steps S201 to S204:
[0111] Step S201: The first coordinates are combined with a time factor that adds a stroke flow speed to obtain a fourth coordinate of each vertex in the model sub-region at each time node.
[0112] In an embodiment of the present application, a stroke flow speed may be preset, and the stroke flow speed is used to indicate the dynamic change speed of the stroke effect on the edge of the model, that is, the movement speed parameter of each vertex of the model sub-region in the time dimension.
[0113] In the blueprint node editor interface of the Unreal Engine, the stroke flow speed can be added to each time node output by the "Time" node, thereby obtaining a variable that controls the change of the stroke flow speed over time (that is, the time factor of the stroke flow speed is added), and the movement speed of each vertex in the model sub-area can be controlled. Afterwards, the time node with the stroke flow speed added and the first coordinate can be merged to obtain the fourth coordinate of each vertex of the three-dimensional model at each time node.
[0114] like Figure 5 As shown, it is an interface schematic diagram of an example of adding stroke flow speed to each time node in the blueprint node editor in the method for generating model stroke provided by an embodiment of the present application, including nodes 23, 24 and 25. Among them, the time node output by the "Time" node in node 23 and the stroke flow speed in node 24 are respectively input into the "Multiplied" node (multiplication node) of node 25, so as to control the speed of the time node output by the "Time" node through the stroke flow speed, thereby controlling the movement speed of each vertex of the model sub-area.
[0115] In the attached Figure 5 In the example, the stroke flow speed is 50, which means the time output by the "Time" node is multiplied by 50. It should be noted that the stroke flow speed can also be set to other values, such as 20, 30, 60, etc., which can be set based on actual needs, and this application does not limit this.
[0116] In the embodiment of the present application, by adding a stroke flow speed to a time node, the movement of each vertex in the model sub-area can be effectively controlled, providing a basis for adding a dynamic disturbance effect to the stroke.
[0117] As shown in Table 1, it is an example table of the fourth coordinates of a vertex of a model sub-region at different time nodes in the method for generating a model stroke provided in an embodiment of the present application.
[0118] Table 1.
[0119]
[0120] In the above Table 1, the first coordinate of the vertex a of the model sub-region in the camera coordinate system is (1, 2), and the stroke flow speed added to the time node is 0.5 unit length per second. When the movement direction of vertex a is horizontal, the horizontal coordinate of the vertex will increase by 0.5 unit length with each passing second. In this way, the fourth coordinate of vertex a of the model sub-region at different time nodes can be calculated as follows: when t=0, the fourth coordinate is (1, 2); when t=1, the fourth coordinate is (1.5, 2); when t=2, the fourth coordinate is (2, 2); when t=3, the fourth coordinate is (2.5, 2).
[0121] Step S202: sampling a preset noise map according to the fourth coordinates of each vertex in the model sub-region at each time node to obtain a first noise value of each vertex in the model sub-region at each time node.
[0122] The above-mentioned preset noise map is used to store noise values. In this embodiment, the noise texture in the noise map is a texture effect composed of noise values generated by a preset noise function. That is to say, by generating noise values through a preset noise function and storing them in the form of an image, a noise texture map can be obtained. In practical applications, the noise map can be a grayscale image, an RGB color image, or other multi-channel texture maps, which is not specifically limited in this embodiment.
[0123] A noise function is a function that can generate random and smooth output values. In this embodiment, the preset noise function may include but is not limited to Perlin noise, Simplex noise, Worley noise, Voronoi noise, etc. This application does not limit the type of noise function.
[0124] In a specific implementation, the corresponding noise value can be read from the preset noise map through the fourth coordinate of each vertex of the model sub-region at each time node, and the noise value is the first noise value of each vertex of the model sub-region at each time node. It should be noted that the first noise value at each time node can be used to offset each vertex of the model sub-region at the corresponding time node.
[0125] As shown in Table 2, it is an example table of an example of sampling the preset noise map according to the fourth coordinates of the vertices of the model sub-area at different time nodes in Table 1 to obtain the first noise values of the vertices of the model sub-area at different time nodes.
[0126] Table 2.
[0127]
[0128] In the above Table 2, the fourth coordinates of the vertex a of the model sub-region at different time nodes are as follows: when t=0, the fourth coordinate is (1, 2); when t=1, the fourth coordinate is (1.5, 2); when t=2, the fourth coordinate is (2, 2); when t=3, the fourth coordinate is (2.5, 2). According to the fourth coordinates of the vertex a of the model sub-region at different time nodes, the noise map is sampled at each time node, and the first noise value of the vertex a of the model sub-region at each time node is obtained as follows: when t=0, the corresponding first noise value obtained by sampling the fourth coordinate (1, 2) is 0.35; when t=1, the corresponding first noise value obtained by sampling the fourth coordinate (1.5, 2) is 0.62; when t=2, the corresponding first noise value obtained by sampling the fourth coordinate (2, 2) is 0.18; when t=3, the corresponding first noise value obtained by sampling the fourth coordinate (2.5, 2) is 0.91.
[0129] Step S203: determining second offsets corresponding to respective vertices of the model sub-region according to the stroke width parameter.
[0130] Specifically, the above step S203 can be implemented by the following steps S2031 and S2032:
[0131] Step S2031: determining normalized direction vectors corresponding to each vertex of the model sub-region;
[0132] Step S2032: Determine the product of the normalized direction vector and the stroke width parameter as the second offset of each vertex of the model sub-region.
[0133] It should be noted that the sum of the squares of the components in the normalized direction vector is 1. The corresponding normalized direction vector can be determined by the first coordinates of each vertex of the model sub-region. The calculation formula is as follows:
[0134]
[0135] Among them, (x2, y2) is the first coordinate corresponding to the vertex of the model sub-region, and (x1, y1) is the normalized direction vector corresponding to the vertex. For example, if the first coordinate of vertex a is (3, 4), then the normalized direction vector of vertex a is (0.6, 0.8).
[0136] In this way, the normalized direction vector is multiplied by the stroke width parameter to obtain the second offset of each vertex of the model sub-region expanding along the normal direction. In this way, the second offset of each vertex of the model sub-region at each time node carries a direction vector, which is the normalized direction vector of each vertex of the model sub-region.
[0137] In the Unreal Engine's blueprint node editor, you can use the "VertexNormalWS" node and the "WorldPosition Offset" node to assign a second offset to each vertex in the model sub-area. The "VertexNormalWS" node is used to obtain the normalized direction vector of each vertex in the model sub-area, and the normalized direction vector of each vertex in the model sub-area is multiplied by the stroke width through the "Multiplied" node, and output to the "World Position Offset" node, so that the second offset can be assigned to each vertex in the model sub-area.
[0138] Step S204: determining a first offset of each vertex of the model sub-region at each time node according to the second offset and the first noise value of each vertex of the model sub-region at each time node.
[0139] In an embodiment of the present application, after obtaining the second offset of each vertex of the model sub-area at each time node, the corresponding second offset can be influenced by the first noise value of each vertex of the model sub-area at each time node, that is, the expansion amplitude of each vertex at each time node is influenced, thereby obtaining the first offset of each vertex of the model sub-area at each time node.
[0140] It should be noted that in the embodiment of the present application, by using the time factor of the stroke flow speed added to fuse with the first coordinates of each vertex of the model sub-area, a second coordinate that changes dynamically with time can be obtained, and by sampling the preset noise map through the second coordinate that changes dynamically with time, a first noise value that changes dynamically with time can be obtained, and by influencing the second offset of each vertex of the model sub-area obtained after the stroke width parameter is assigned through the first noise value that changes dynamically with time, a first offset that changes dynamically with time can be obtained. In this way, the stroke special effect generated based on the first offset that changes dynamically with time is a dynamically changing stroke animation, which produces a visual effect of dynamic disturbance, and enhances the player's visual experience and game experience.
[0141] In an optional implementation, the first noise value may also be adjusted, and the step S204 may be implemented by the following steps:
[0142] Get the preset stroke flow amplitude;
[0143] According to the stroke flow amplitude, adjusting the first noise value of each vertex of the model sub-region at each time node to obtain a second noise value of each vertex of the model sub-region at each time node;
[0144] The first offset of each vertex of the model sub-region at each time node is determined according to the second offset and the second noise value of each vertex of the model sub-region at each time node.
[0145] In an embodiment of the present application, a stroke flow amplitude can be set, and the stroke flow amplitude is used to adjust the intensity of the first noise value sampled from the noise map, so as to obtain the second noise value of each vertex of the model sub-area at each time node, and the second noise value is used to control the offset of each vertex of the model sub-area.
[0146] For example, if the stroke flow amplitude is 15, it means that the second noise value is obtained by multiplying the first noise value by 15, and the second noise value is used to control the offset of each vertex of the model sub-area to obtain a stronger disturbance effect.
[0147] It should be noted that, for a vertex in the model sub-area, the fourth coordinates of the vertex at different time nodes are different. Therefore, after sampling the preset noise map, the first noise values of the vertex at different time nodes are also different. Correspondingly, after adjusting the first noise values of the vertex at different time nodes based on the preset stroke flow amplitude, the second noise values of the vertex at different time nodes are also different.
[0148] As shown in Table 3, it is an example table of an example of adjusting the first noise values of the vertices of the model sub-region in Table 2 at different time nodes according to the stroke flow amplitude to obtain the second noise value.
[0149] Table 3.
[0150]
[0151] In the above Table 3, the first noise value of the vertex a of the model sub-region at each time node is as follows: when t=0, the corresponding first noise value obtained by sampling the fourth coordinate (1, 2) is 0.35; when t=1, the corresponding first noise value obtained by sampling the fourth coordinate (1.5, 2) is 0.62; when t=2, the corresponding first noise value obtained by sampling the fourth coordinate (2, 2) is 0.18; when t=3, the corresponding first noise value obtained by sampling the fourth coordinate (2.5, 2) is 0.91. The stroke flow amplitude is 15, so the second noise value of the vertex a of the model sub-region at each time node can be calculated as follows: when t=0, the second noise value is 5.25; when t=1, the second noise value is 9.3; when t=2, the second noise value is 2.7; when t=3, the second noise value is 13.65.
[0152] After obtaining the second offset of each vertex in the model sub-region, the corresponding second offset can be influenced by the second noise value of each vertex in the model sub-region at each time node, that is, the expansion amplitude of each vertex at each time node is influenced, thereby obtaining the first offset of each vertex in the model sub-region at each time node.
[0153] This setting method adjusts the first noise value sampled at each vertex of the model sub-area at each time node to obtain a second noise value, and uses the second noise value to affect the second offset of each vertex of the model sub-area at each time node, thereby more reasonably controlling the expansion amplitude of each vertex of the model sub-area at each time node, thereby improving the quality of model stroke generation.
[0154] In an optional implementation, step S103 may be implemented by following steps 1031:
[0155] According to the first offset of each vertex of the model sub-region at each time node and the first coordinate, the first position to be moved to which each vertex of the model sub-region corresponds to at each time node is determined.
[0156] In an embodiment of the present application, after obtaining the first offset of each vertex of the model sub-area at each time node, the first position to which each vertex of the model sub-area is to be moved at each time node can be calculated based on the first offset and the first coordinates of each vertex of the model sub-area.
[0157] As can be seen from the above introduction, the second offset of each vertex of the model sub-area carries a direction vector, which is the normalized direction vector of the first coordinates of each vertex of the model sub-area. In this way, the calculated first offset also has a direction vector. In this way, based on the direction indicated by the direction vector, the first position to which each vertex of the model sub-area is to be moved at each time node can be calculated.
[0158] In an optional specific implementation example, step S103 may be implemented by the following first step:
[0159] The first step includes: for each vertex in the model sub-area, superimposing the first offset of the vertex at the i+1th time node with the position of the vertex at the i-th time node to obtain the first position to which the vertex is to be moved at the i+1th time node, where i traverses 0 to N-2, and N is the total number of time nodes.
[0160] In this way, the first position to which each vertex of the model sub-region is to be moved at each time node can be calculated.
[0161] It should be noted that the positions of each vertex of the model sub-area at the 0th time node are the first coordinates of each vertex of the model sub-area, and the positions of each vertex of the model sub-area at the 1st, 2nd, 3rd, ...N-1 time nodes are the first positions of each vertex of the model sub-area corresponding to the 1st, 2nd, 3rd, ...N-1 time nodes.
[0162] Specifically, for vertex a in the model sub-area, the position of vertex a at the 0th time node (that is, the first coordinate of vertex a) is superimposed with the first offset of vertex a at the 1st time node to obtain the first position to which vertex a is to be moved at the 1st time node; the position of vertex a at the 1st time node (that is, the first position corresponding to vertex a at the 1st time node) is superimposed with the first offset of vertex a at the 2nd time node to obtain the first position to which vertex a is to be moved at the 2nd time node; the position of vertex a at the 2nd time node (that is, the first position corresponding to vertex a at the 2nd time node) is superimposed with the first offset of vertex a at the 3rd time node to obtain the first position to which vertex a is to be moved at the 3rd time node; the position of vertex a at the 3rd time node (that is, the first position corresponding to vertex a at the 3rd time node) is superimposed with the first offset of vertex a at the 4th time node to obtain the first position to which vertex a is to be moved at the 4th time node...; and so on, until the first position to which vertex a is to be moved at the N-1 time node is obtained.
[0163] For vertex b in the model sub-region, the position of vertex b at the 0th time node (that is, the first coordinate of vertex b) is superimposed with the first offset of vertex b at the 1st time node to obtain the first position to which vertex b is to be moved at the 1st time node; the position of vertex b at the 1st time node (that is, the first position corresponding to vertex b at the 1st time node) is superimposed with the first offset of vertex b at the 2nd time node to obtain the first position to which vertex b is to be moved at the 2nd time node; the position of vertex b at the 2nd time node (that is, the first position corresponding to vertex b at the 2nd time node) is superimposed with the first offset of vertex b at the 3rd time node to obtain the first position to which vertex b is to be moved at the 3rd time node; the position of vertex b at the 3rd time node (that is, the first position corresponding to vertex b at the 3rd time node) is superimposed with the first offset of vertex b at the 4th time node to obtain the first position to which vertex b is to be moved at the 4th time node, and so on, until the first position to which vertex b is to be moved at the N-1th time node is obtained.
[0164] In this way, the first position to which each vertex of the model sub-region is to be moved at each time node can be obtained.
[0165] In an optional implementation, the above step S101 may be implemented in the following manner:
[0166] Obtain the second coordinates of each vertex in the model sub-area corresponding to the material instance in the world coordinate system;
[0167] Determine, according to the second coordinates, the third coordinates of each vertex in a local coordinate system corresponding to the three-dimensional model;
[0168] According to the third coordinate, the first coordinate of each vertex in the camera coordinate system corresponding to the virtual camera is determined.
[0169] In an embodiment of the present application, the model sub-area can be first spatially transformed from the world space to the local space, and then transformed from the local space to the viewing space, so as to obtain the coordinates of each vertex of the model sub-area in the viewing space, which is the first coordinate of each vertex in the model sub-area in the camera coordinate system.
[0170] In an optional implementation, transforming the above-mentioned model sub-area from the world space to the local space and then from the local space to the viewing space can be achieved through a series of matrix transformations, which may specifically include a translation matrix, a rotation matrix and a scaling matrix.
[0171] In an embodiment of the present application, the above-mentioned model sub-area can be transformed from the world space to the local space, and then from the local space to the viewing space, through the blueprint node editor interface of the Unreal Engine. Specifically, the model sub-area can be transformed from the world space to the local space through the "TransformPosition" node, and then the model sub-area can be transformed from the local space to the viewing space through the "TransformPosition" node. Afterwards, the x value and y value are extracted from the coordinates of each vertex of the model sub-area in the camera coordinate system through the "mask" node, and the extracted x value and y value are the first coordinates of each vertex of the model sub-area in the camera coordinate system.
[0172] like Figure 6As shown, it is an interface schematic diagram of an example of obtaining the first coordinates of each vertex of a model sub-area in the camera coordinate system through a blueprint node editor in a method for generating a model stroke provided in an embodiment of the present application, including node 19, node 20, node 21 and node 22. Among them, node 19 receives input data, which is an absolute world position (x1, y1, z1) transmitted from an external event or other node, and transmits the absolute world position (x1, y1, z1) to node 20; after receiving the absolute world position (x1, y1, z1) output by node 19, node 20 converts the absolute world position (x1, y1, z1) into a local position (x2, y2, z2), and transmits the local position (x2, y2, z2) to node 21; after receiving the local position (x2, y2, z2) output by node 19, node 21 Convert the local position (x2, y2, z2) to the viewing space position (x3, y3, z3), and pass the viewing space position (x3, y3, z3) to node 22; specifically, input the coordinate vector in the viewing space position (x3, y3, z3) to the "mask" node, wherein the R channel, G channel, and B channel correspond to x3, y3, and z3 in the viewing space position, respectively, so that the Mask node outputs the values of the R channel and the G channel, that is, outputs x3 and y3 in the viewing space position, thereby obtaining the first coordinates (x3, y3) of each vertex in the model sub-area.
[0173] From the above content, it can be seen that the stroke animation generated for the model sub-region is related to the position change of each vertex of the model sub-region and the time factor added with the stroke flow speed. When the stroke animation is generated with the world space coordinates of each vertex of the model sub-region in the world space, when the 3D model moves, the model sub-region moves accordingly, so that the world space coordinates of each vertex of the model sub-region change, that is, when the 3D model moves, there are two variables, the world space coordinates and the time factor added with the stroke flow speed when sampling the preset noise map; when the 3D model is stationary, the model sub-region also remains stationary, so that the world space coordinates of each vertex of the model sub-region remain unchanged, that is, when the 3D model is stationary, there is only one variable, the time factor added with the stroke flow speed, when sampling the preset noise map.
[0174] In this way, when the stroke animation is generated using the local space coordinates of each vertex of the model sub-area in the local space, when the three-dimensional model moves, the disturbance is enhanced and the stroke flow effect is more obvious. When the three-dimensional model is stationary, the disturbance is weakened and the stroke flow effect becomes slow, resulting in a large difference in the animation change speed of the stroke generated when the three-dimensional model is moving and stationary.
[0175] In an embodiment of the present application, by transforming the world space into the local space, when the three-dimensional model moves, the coordinates of each vertex of the model sub-area in the coordinate system established by the three-dimensional model itself will not change. This can effectively avoid the problem of a large difference in the speed of animation changes of the stroke generated when the three-dimensional model moves and when it is stationary, which is caused by the change of the world space coordinates when the three-dimensional model moves and the unchanged world space coordinates when the three-dimensional model is stationary.
[0176] In addition, when the stroke animation is generated using the local space coordinates of each vertex in the model sub-area in the local space, when the three-dimensional model rotates, the axial direction of the local space will change, so that the local space coordinates of each vertex in the model sub-area change, that is, when the three-dimensional model rotates, when sampling the preset noise map, there are two variables, namely, the local space coordinates and the time factor with the stroke flow speed added; when the three-dimensional model is stationary, the axial direction of the local space will not change, so that the local space coordinates of each vertex in the model sub-area remain unchanged, that is, when the three-dimensional model is stationary, when sampling the preset noise map, there is only one variable, namely, the time factor with the stroke flow speed added.
[0177] In this way, when the stroke animation is generated using the local space coordinates of each vertex of the model sub-area in the local space, when the three-dimensional model rotates, the disturbance is enhanced and the stroke flow effect is more obvious. When the three-dimensional model is stationary, the disturbance is weakened and the stroke flow effect becomes slow, resulting in a large difference in the animation change speed of the stroke generated when the three-dimensional model rotates and when it is stationary.
[0178] In an embodiment of the present application, by transforming the local space into the viewing space, when the three-dimensional model rotates, the coordinates of each vertex of the model sub-area in the coordinate system established by the virtual camera will not change. This can effectively avoid the problem of a large difference in the speed of animation change of the stroke generated when the three-dimensional model rotates and when it is stationary, which is caused by the local space coordinates changing when the three-dimensional model rotates and the local space coordinates remaining unchanged when the three-dimensional model is stationary.
[0179] It can be seen that in the embodiment of the present application, by transforming the world space into the local space and then transforming the local space into the viewing space, a more evenly changing stroke animation can be generated. For the player, the flow effect of the stroke animation will not feel fast or slow, which further enhances the player's visual experience and gaming experience.
[0180] In an optional implementation, the above step S104 can be implemented by the following steps:
[0181] Each vertex of the model sub-region is controlled to move to the corresponding first position at each time node, so as to generate an initial stroke animation corresponding to the model sub-region.
[0182] After obtaining the first position to which each vertex of the model sub-region is to be moved at each time node, each vertex of the model sub-region can be controlled to move to the corresponding first position at each time node, thereby generating an initial stroke animation corresponding to the model sub-region.
[0183] It should be noted that, in the embodiment of the present application, since the first offsets of the vertices of the model sub-area at each time node are different, the first positions to be moved to by the vertices of the obtained model sub-area at each time node are also different. In this way, the amplitudes of movement of each vertex along the normal direction in the initial stroke animation generated corresponding to the model sub-area are also different, so that the generated stroke has a dynamic disturbance effect, and the visual presentation has a feeling of honey flowing in a honey pot, which enhances the artistic visual effect of the stroke, thereby enhancing the player's satisfaction with the game.
[0184] Accordingly, the above step S106 can be implemented by the following steps:
[0185] The animation portion corresponding to the internal pixels is removed from the initial stroke animation corresponding to each of the model sub-regions to obtain the outer contour stroke animation corresponding to the three-dimensional model.
[0186] After the internal pixels located inside the three-dimensional model are determined, the animation portion corresponding to the internal pixels in the initial stroke animation may be removed, thereby obtaining the outer contour stroke animation corresponding to the three-dimensional model.
[0187] It should be noted that the outer contour stroke animation refers to the stroke only existing in the outer contour of the 3D model. Since the stroke inside the 3D model is removed, the stroke will not cover the internal area that should not be stroked, and the rendering of the material of the 3D model will not be affected by the stroke, ensuring the normal rendering of the inside of the 3D model. It can be seen that the method for generating model strokes provided in the embodiment of the present application can generate high-quality strokes with dynamic disturbance effects for the outer contour of the 3D model without affecting the normal rendering of the 3D model.
[0188] In an optional implementation, the present application may also generate a stroke animation with a specified color. The above step of "controlling each vertex of the model sub-area to move to the corresponding first position at each time node to generate an initial stroke animation corresponding to the model sub-area" may be implemented in the following steps:
[0189] Get the stroke color set for the three-dimensional model;
[0190] Each vertex of the model sub-region is controlled to move to the corresponding first position at each time node, and the pixels on the moving path are rendered as the stroke color to generate an initial stroke animation corresponding to the model sub-region.
[0191] Optionally, the stroke colors corresponding to different types of three-dimensional models are different, or the stroke colors corresponding to three-dimensional models of different camps are different.
[0192] In the embodiment of the present application, the stroke color corresponding to the three-dimensional model can be pre-set in the development stage, or the stroke color of the three-dimensional model can be set in real time during the game.
[0193] Optionally, when setting the stroke color of the three-dimensional model in real time during the game, the three-dimensional model in the virtual scene can be divided into a first type of model and a second type of model according to the type of character, and the first type of model is set to a first stroke color, and the second type of model is set to a second stroke color, so as to generate stroke animations with different stroke colors for different types of models. For example, the stroke color for the virtual character controlled by the player is set to yellow, and the stroke color for the NPC is set to blue.
[0194] Optionally, when setting the stroke color of the three-dimensional model in real time during the game, the three-dimensional model in the virtual scene can be divided into a first camp model and a second camp model according to the camp, and the first camp model is set to the third stroke color, and the second type model is set to the fourth stroke color, so as to generate stroke animations with different stroke colors for models of different camps. For example, the stroke color of the virtual character controlled by the player is set to green, and the stroke color of the enemy virtual character is set to red.
[0195] It should be noted that the setting of the stroke color is not limited to the above-mentioned method. In the embodiment of the present application, the stroke color can be set according to actual needs.
[0196] In an embodiment of the present application, the model area of each three-dimensional model in the screen space can be distinguished by setting depth template data for each three-dimensional model, thereby generating a corresponding stroke for each three-dimensional model. When a different stroke color is set for each stroke in the screen space, the effect of generating a stroke of a different stroke color for each three-dimensional model can be achieved.
[0197] By setting the stroke color, you can generate a stroke animation with the stroke color. On the one hand, the stroke animation with the stroke color has better artistic expression, making the visual effect more vivid; on the other hand, when the 3D model occupies a very small proportion on the screen, the stroke animation with the stroke color can provide visual guidance to the player, allowing the player to obtain game information in a timely manner.
[0198] Corresponding to the method for generating model strokes provided in the first embodiment of the present application, the second embodiment of the present application further provides an apparatus for generating model strokes, such as Figure 7 As shown, the device 700 for generating model strokes includes:
[0199] A first determining unit 701 is used to determine at least one pre-generated material instance included in the three-dimensional model for which a stroke is to be generated, and for each material instance, determine first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance;
[0200] A second determining unit 702 is used to determine first offsets corresponding to the vertices of the model sub-region respectively;
[0201] A third determining unit 703 is used to determine first positions to be moved to which the vertices of the model sub-region correspond respectively according to the first offset and the first coordinate;
[0202] A control unit 704 is used to control each vertex of the model sub-region to move to the corresponding first position, and generate an initial stroke effect corresponding to the model sub-region;
[0203] A fourth determining unit 705, configured to determine internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model;
[0204] The elimination unit 706 is used to eliminate the special effect part corresponding to the internal pixels from the initial stroke special effect corresponding to each of the model sub-regions, so as to obtain the outer contour stroke special effect corresponding to the three-dimensional model.
[0205] Optionally, the second determining unit 702 is specifically configured to:
[0206] Get the preset stroke width parameters;
[0207] According to the stroke width parameter, first offsets corresponding to the vertices of the model sub-region are determined.
[0208] Optionally, the second determining unit 702 is specifically configured to:
[0209] The first coordinate is combined with a time factor to which the stroke flow speed is added, to obtain a fourth coordinate of each vertex in the model sub-region at each time node, wherein the stroke flow speed is used to indicate a dynamic change speed of the stroke effect, and the time factor is a variable that controls the change of the stroke flow speed over time;
[0210] According to the fourth coordinates of each vertex in the model sub-region at each time node, a preset noise map is sampled to obtain a first noise value of each vertex in the model sub-region at each time node;
[0211] Determining, according to the stroke width parameter, second offsets corresponding to the vertices of the model sub-region respectively;
[0212] A first offset of each vertex of the model sub-region at each time node is determined according to the second offset and the first noise value of each vertex of the model sub-region at each time node.
[0213] Optionally, the second determining unit 702 is specifically configured to:
[0214] Get the preset stroke flow amplitude;
[0215] According to the stroke flow amplitude, adjusting the first noise value of each vertex of the model sub-region at each time node to obtain a second noise value of each vertex of the model sub-region at each time node;
[0216] The first offset of each vertex of the model sub-region at each time node is determined according to the second offset and the second noise value of each vertex of the model sub-region at each time node.
[0217] Optionally, the second determining unit 702 is specifically configured to:
[0218] Determine the normalized direction vectors corresponding to the vertices of the model sub-regions;
[0219] The product of the normalized direction vector and the stroke width parameter is determined as the second offset corresponding to each vertex of the model sub-region.
[0220] Optionally, the first determining unit 701 is specifically configured to:
[0221] Obtaining second coordinates of each vertex of the three-dimensional model in a world coordinate system;
[0222] Determine, according to the second coordinates, third coordinates of each vertex of the three-dimensional model in a local coordinate system corresponding to the three-dimensional model;
[0223] According to the third coordinate, the first coordinate of each vertex of the three-dimensional model in the camera coordinate system corresponding to the virtual camera is determined.
[0224] Optionally, the second determining unit 702 is specifically configured to:
[0225] According to the first offset of each vertex of the model sub-region at each time node and the first coordinate, the first position to be moved to which each vertex of the model sub-region corresponds to at each time node is determined.
[0226] Optionally, the second determining unit 702 is specifically configured to:
[0227] For each vertex in the model sub-region, the position of the vertex at the i-th time node is superimposed with the first offset of the vertex at the i+1-th time node to obtain the first position to which the vertex is to be moved at the i+1-th time node;
[0228] Among them, i traverses 0 to N-2, and N is the total number of time nodes.
[0229] Optionally, the control unit 704 is specifically configured to:
[0230] Each vertex of the model sub-region is controlled to move to the corresponding first position at each time node, so as to generate an initial stroke animation corresponding to the model sub-region.
[0231] Optionally, the elimination unit 706 is specifically used for:
[0232] The animation portion corresponding to the internal pixels is removed from the initial stroke animation corresponding to each of the model sub-regions to obtain the outer contour stroke animation corresponding to the three-dimensional model.
[0233] Optionally, the fourth determining unit 705 is specifically configured to:
[0234] Acquire depth template data set for the three-dimensional model;
[0235] Determine a difference between preset depth template data corresponding to each pixel in the screen space and depth template data set for the three-dimensional model;
[0236] Pixels with a difference value of 0 are determined as internal pixels of the three-dimensional model.
[0237] Optionally, the control unit 704 is specifically configured to:
[0238] Get the stroke color set for the three-dimensional model;
[0239] Each vertex of the model sub-region is controlled to move to the corresponding first position at each time node, and the pixels on the moving path are rendered as the stroke color to generate an initial stroke animation corresponding to the model sub-region.
[0240] Optionally, the stroke colors corresponding to different types of three-dimensional models are different, or the stroke colors corresponding to three-dimensional models of different camps are different.
[0241] The device for generating model stroke provided in the present application can determine at least one pre-generated material instance included in the three-dimensional model for which the stroke is to be generated, and for each material instance, determine the first coordinates corresponding to each vertex of the model sub-area corresponding to the material instance; determine the first offsets corresponding to each vertex of the model sub-area; determine the first positions to be moved to which each vertex of the model sub-area corresponds according to the first offset and the first coordinates; control each vertex of the model sub-area to move to the corresponding first position, and generate an initial stroke special effect corresponding to the model sub-area; determine the internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model; and from the initial stroke special effect corresponding to each model sub-area, remove the special effect part corresponding to the internal pixels to obtain the outer contour stroke special effect corresponding to the three-dimensional model.
[0242] It can be seen that the device for generating model strokes provided by the present application determines the first offset of each vertex of the model sub-region corresponding to each pre-generated material instance in the three-dimensional model, thereby obtaining the first position to which each vertex of the model sub-region corresponding to each material instance is to be moved. After controlling each vertex of the model sub-region corresponding to each material instance to move to the corresponding first position, an initial stroke special effect can be generated for each model sub-region corresponding to the material instance, and the generated initial stroke special effect contains the special effect part located inside the three-dimensional model. Afterwards, the internal pixels of the three-dimensional model can be determined from all pixels in the screen space through the depth template data of the three-dimensional model, so that the special effect part corresponding to the internal pixels of the three-dimensional model can be accurately removed from the initial stroke special effect corresponding to each model sub-region, so that only the outer contour special effect corresponding to the three-dimensional model is retained. Since the stroke inside the three-dimensional model is removed, the stroke will not cover the internal area that should not be stroked, and the rendering of the material of the three-dimensional model will not be affected by the stroke, ensuring the normal rendering inside the three-dimensional model. It can be seen that the device for generating a model stroke provided in the embodiment of the present application can generate a high-quality stroke for the outer contour of the three-dimensional model without affecting the normal rendering of the three-dimensional model.
[0243] Corresponding to the method for generating model strokes provided in the first embodiment of the present application, the third embodiment of the present application further provides an electronic device for generating model strokes. Figure 8 As shown, the electronic device 800 includes: a processor 801; and a memory 802, which is used to store a program of a method for generating a model stroke. After the device is powered on and the program of the method for generating a model stroke is run by the processor, the following steps are performed:
[0244] Determine at least one pre-generated material instance included in the three-dimensional model for which a stroke is to be generated, and for each material instance, determine first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance;
[0245] Determine first offsets corresponding to respective vertices of the model sub-region;
[0246] Determine, according to the first offset and the first coordinate, first positions to be moved to which correspond to the vertices of the model sub-region respectively;
[0247] Controlling each vertex of the model sub-region to move to the corresponding first position, and generating an initial stroke special effect corresponding to the model sub-region;
[0248] Determining internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model;
[0249] From the initial stroke special effect corresponding to each of the model sub-regions, the special effect portion corresponding to the internal pixels is removed to obtain the outer contour stroke special effect corresponding to the three-dimensional model.
[0250] The electronic device for generating model strokes provided in the present application can determine at least one pre-generated material instance included in the three-dimensional model for which the stroke is to be generated, and for each material instance, determine the first coordinates corresponding to each vertex of the model sub-area corresponding to the material instance; determine the first offsets corresponding to each vertex of the model sub-area; determine the first positions to be moved to which each vertex of the model sub-area corresponds according to the first offset and the first coordinates; control each vertex of the model sub-area to move to the corresponding first position, and generate an initial stroke special effect corresponding to the model sub-area; determine the internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model; and from the initial stroke special effect corresponding to each model sub-area, remove the special effect part corresponding to the internal pixels to obtain the outer contour stroke special effect corresponding to the three-dimensional model.
[0251] It can be seen that the electronic device for generating model strokes provided by the present application determines the first offset of each vertex of the model sub-area corresponding to each pre-generated material instance in the three-dimensional model, thereby obtaining the first position to which each vertex of the model sub-area corresponding to each material instance is to be moved. After controlling each vertex of the model sub-area corresponding to each material instance to move to the corresponding first position, an initial stroke special effect can be generated for each model sub-area corresponding to the material instance, and the generated initial stroke special effect contains the special effect part located inside the three-dimensional model. Afterwards, the internal pixels of the three-dimensional model can be determined from all pixels in the screen space through the depth template data of the three-dimensional model, so that the special effect part corresponding to the internal pixels of the three-dimensional model can be accurately removed from the initial stroke special effect corresponding to each model sub-area, so that only the outer contour special effect corresponding to the three-dimensional model is retained. Since the stroke inside the three-dimensional model is removed, the stroke will not cover the internal area that should not be stroked, and the rendering of the material of the three-dimensional model will not be affected by the stroke, ensuring the normal rendering inside the three-dimensional model. It can be seen that the electronic device for generating model strokes provided in the embodiment of the present application can generate high-quality strokes for the outer contour of the three-dimensional model without affecting the normal rendering of the three-dimensional model.
[0252] Corresponding to the method for generating a model stroke provided in the first embodiment of the present application, the fourth embodiment of the present application provides a computer-readable storage medium storing a program for the method for generating a model stroke, the program being executed by a processor to perform the following steps:
[0253] Determine at least one pre-generated material instance included in the three-dimensional model for which a stroke is to be generated, and for each material instance, determine first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance;
[0254] Determine first offsets corresponding to respective vertices of the model sub-region;
[0255] Determine, according to the first offset and the first coordinate, first positions to be moved to which correspond to the vertices of the model sub-region respectively;
[0256] Controlling each vertex of the model sub-region to move to the corresponding first position, and generating an initial stroke special effect corresponding to the model sub-region;
[0257] Determining internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model;
[0258] From the initial stroke special effect corresponding to each of the model sub-regions, the special effect portion corresponding to the internal pixels is removed to obtain the outer contour stroke special effect corresponding to the three-dimensional model.
[0259] The computer-readable storage medium provided by the present application stores a program for generating a model stroke, including: determining at least one pre-generated material instance included in a three-dimensional model for which a stroke is to be generated, and for each material instance, determining first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance; determining first offsets corresponding to each vertex of the model sub-region; determining first positions to be moved to corresponding to each vertex of the model sub-region according to the first offset and the first coordinate; controlling each vertex of the model sub-region to move to the corresponding first position, and generating an initial stroke special effect corresponding to the model sub-region; determining internal pixels of the three-dimensional model according to depth template data set for the three-dimensional model; and removing the special effect part corresponding to the internal pixels from the initial stroke special effect corresponding to each model sub-region to obtain an outer contour stroke special effect corresponding to the three-dimensional model.
[0260] It can be seen that the computer-readable storage medium provided by the present application stores a program for generating a model stroke method, by determining the first offset of each vertex of the model sub-region corresponding to each pre-generated material instance in the three-dimensional model, thereby obtaining the first position to which each vertex of the model sub-region corresponding to each material instance is to be moved, and after controlling each vertex of the model sub-region corresponding to each material instance to move to the corresponding first position, an initial stroke special effect can be generated for each model sub-region corresponding to the material instance, and the generated initial stroke special effect contains a special effect part located inside the three-dimensional model. Afterwards, the internal pixels of the three-dimensional model can be determined from all pixels in the screen space through the depth template data of the three-dimensional model, so that the special effect part corresponding to the internal pixels of the three-dimensional model can be accurately removed from the initial stroke special effect corresponding to each model sub-region, so that only the outer contour special effect corresponding to the three-dimensional model is retained. Since the stroke inside the three-dimensional model is removed, the stroke will not cover the internal area that should not be stroked, and the rendering of the material of the three-dimensional model will not be affected by the stroke, ensuring the normal rendering inside the three-dimensional model. It can be seen that the computer-readable storage medium storing a program of a method for generating a model stroke provided in an embodiment of the present application can generate a high-quality stroke for the outer contour of the three-dimensional model without affecting the normal rendering of the three-dimensional model.
[0261] It should be noted that for the detailed description of the devices, electronic devices and computer-readable storage media provided in the second, third and fourth embodiments of the present application, reference can be made to the relevant description of the first embodiment of the present application, and no further details will be given here.
[0262] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
[0263] In a typical configuration, a node device in a blockchain includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0264] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0265] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), random access memory (RAM) of other attributes, read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage media or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.
[0266] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can 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 code.
[0267] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
Claims
1. A method for generating a model stroke, characterized in that: The method comprises: Determine at least one pre-generated material instance included in the three-dimensional model for which a stroke is to be generated, and for each material instance, determine first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance; Determine first offsets corresponding to respective vertices of the model sub-region; Determine, according to the first offset and the first coordinate, first positions to be moved to which correspond to the vertices of the model sub-region respectively; Controlling each vertex of the model sub-region to move to the corresponding first position, and generating an initial stroke special effect corresponding to the model sub-region; Determining internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model; From the initial stroke special effect corresponding to each of the model sub-regions, the special effect portion corresponding to the internal pixels is removed to obtain the outer contour stroke special effect corresponding to the three-dimensional model.
2. The method according to claim 1, characterized in that The determining of first offsets corresponding to the vertices of the model sub-regions includes: Get the preset stroke width parameters; According to the stroke width parameter, first offsets corresponding to the vertices of the model sub-region are determined.
3. The method according to claim 2, characterized in that The determining, according to the stroke width parameter, first offsets corresponding to the vertices of the model sub-region respectively includes: The first coordinate is combined with a time factor to which the stroke flow speed is added, to obtain a fourth coordinate of each vertex in the model sub-region at each time node, wherein the stroke flow speed is used to indicate a dynamic change speed of the stroke effect, and the time factor is a variable that controls the change of the stroke flow speed over time; According to the fourth coordinates of each vertex in the model sub-region at each time node, a preset noise map is sampled to obtain a first noise value of each vertex in the model sub-region at each time node; Determining, according to the stroke width parameter, second offsets corresponding to the vertices of the model sub-region respectively; A first offset of each vertex of the model sub-region at each time node is determined according to the second offset and the first noise value of each vertex of the model sub-region at each time node.
4. The method according to claim 3, characterized in that The determining, according to the second offset and the first noise value of each vertex of the model sub-region at each time node, a first offset of each vertex of the model sub-region at each time node comprises: Get the preset stroke flow amplitude; According to the stroke flow amplitude, adjusting the first noise value of each vertex of the model sub-region at each time node to obtain a second noise value of each vertex of the model sub-region at each time node; The first offset of each vertex of the model sub-region at each time node is determined according to the second offset and the second noise value of each vertex of the model sub-region at each time node.
5. The method according to claim 3, characterized in that: The step of determining, according to the stroke width parameter, second offsets corresponding to the vertices of the model sub-region, respectively, includes: Determine the normalized direction vectors corresponding to the vertices of the model sub-regions; The product of the normalized direction vector and the stroke width parameter is determined as the second offset corresponding to each vertex of the model sub-region.
6. The method according to claim 1, characterized in that The determining of first coordinates corresponding to each vertex in the model sub-region corresponding to the material instance includes: Obtain the second coordinates of each vertex in the model sub-area corresponding to the material instance in the world coordinate system; Determine, according to the second coordinates, the third coordinates of each vertex in a local coordinate system corresponding to the three-dimensional model; According to the third coordinate, the first coordinate of each vertex in the camera coordinate system corresponding to the virtual camera is determined.
7. The method according to claim 3, characterized in that The step of determining first positions to be moved to which the vertices of the model sub-regions correspond to each other according to the first offset and the first coordinates includes: According to the first offset of each vertex of the model sub-region at each time node and the first coordinate, the first position to be moved to which each vertex of the model sub-region corresponds to at each time node is determined.
8. The method according to claim 7, characterized in that The determining, according to the first offset of each vertex of the model sub-region at each time node and the first coordinate, the first position to be moved to which each vertex of the model sub-region corresponds at each time node, comprises: For each vertex in the model sub-region, the position of the vertex at the i-th time node is superimposed with the first offset of the vertex at the i+1-th time node to obtain the first position to which the vertex is to be moved at the i+1-th time node; Among them, i traverses 0 to N-2, and N is the total number of time nodes.
9. The method according to claim 3, characterized in that: The step of controlling each vertex of the model sub-region to move to the corresponding first position to generate an initial stroke special effect corresponding to the model sub-region includes: Each vertex of the model sub-region is controlled to move to the corresponding first position at each time node, so as to generate an initial stroke animation corresponding to the model sub-region.
10. The method according to claim 9, characterized in that The step of removing the special effect portion corresponding to the internal pixels from the initial stroke special effect corresponding to each of the model sub-regions to obtain the outer contour stroke special effect corresponding to the three-dimensional model includes: The animation portion corresponding to the internal pixels is removed from the initial stroke animation corresponding to each of the model sub-regions to obtain the outer contour stroke animation corresponding to the three-dimensional model.
11. The method according to claim 1, characterized in that: The step of determining internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model comprises: Acquire depth template data set for the three-dimensional model; Determine a difference between preset depth template data corresponding to each pixel in the screen space and depth template data set for the three-dimensional model; Pixels with a difference value of 0 are determined as internal pixels of the three-dimensional model.
12. The method according to claim 9, characterized in that The controlling each vertex of the model sub-region to move to the corresponding first position at each time node to generate an initial stroke animation corresponding to the model sub-region includes: Get the stroke color set for the three-dimensional model; Each vertex of the model sub-region is controlled to move to the corresponding first position at each time node, and the pixels on the moving path are rendered as the stroke color to generate an initial stroke animation corresponding to the model sub-region.
13. The method according to claim 12, characterized in that The stroke colors corresponding to different types of the three-dimensional models are different, or the stroke colors corresponding to the three-dimensional models of different camps are different.
14. A device for generating a model stroke, characterized in that: The device comprises: A first determining unit is used to determine at least one pre-generated material instance included in the three-dimensional model for which a stroke is to be generated, and for each material instance, determine first coordinates corresponding to each vertex of a model sub-region corresponding to the material instance; A second determining unit, used to determine first offsets corresponding to respective vertices of the model sub-region; A third determining unit, configured to determine first positions to be moved to which the vertices of the model sub-region correspond respectively according to the first offset and the first coordinate; A control unit, used for controlling each vertex of the model sub-region to move to the corresponding first position, and generating an initial stroke special effect corresponding to the model sub-region; a fourth determining unit, configured to determine internal pixels of the three-dimensional model according to the depth template data set for the three-dimensional model; The culling unit is used to remove the special effect part corresponding to the internal pixels from the initial stroke special effect corresponding to each model sub-region, so as to obtain the outer contour stroke special effect corresponding to the three-dimensional model.
15. An electronic device, characterized in that: include: processor; as well as The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method according to any one of claims 1 to 13 is executed.
16. A computer-readable storage medium, characterized in that: A data processing program is stored, and the program is run by a processor to execute the method according to any one of claims 1 to 13.