Model generation method and device and electronic equipment
By generating points on the surface of the target model and deformation and connection processing of line segments, the problem of low efficiency in cocoon-like model production in the prior art is solved, and the effect of rapid generation of cocoon-like model is achieved.
Patent Information
- Application Number
- CN202411776333.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-05-06
AI Technical Summary
In the prior art, the production of cocoon-like models requires a lot of manpower and has low production efficiency.
By obtaining the target model surface, generating multiple points, copying the preset line segments to the positions of these points, deformation processing is performed on the line segments, and connecting the deformed line segment vertices with nearby vertices, generating an initial model, and then rendering based on the preset attribute parameters to generate a cocoon-like model.
This method can quickly generate models with cocoon morphology, simplify the difficulty of making cocoon-like models and improve the generation efficiency of cocoon-like models.
Smart Images

Figure CN119941976A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of model rendering, and in particular to a model generation method, device and electronic device. Background Art
[0002] In some 3D science fiction games, "cocoon" is a common concept, such as the cocoons of some insects, the cocoons of alien monsters, etc. In the production method of cocoon-shaped models in related technologies, original painting design is required and the model artist must manually carve to complete it, but this production method consumes a lot of manpower and has low production efficiency. Summary of the invention
[0003] The purpose of the present disclosure is to provide a model generation method, device and electronic device to improve the generation efficiency of the cocoon-shaped model.
[0004] In a first aspect, the present disclosure provides a model generation method, the method comprising: obtaining a target model and generating multiple points on the surface of the target model; copying preset line segments to the locations of the multiple points respectively; wherein the preset line segments are line segments comprising multiple vertex segments; deforming the preset line segments on the multiple points to obtain multiple deformed preset line segments; connecting the vertices on the deformed preset line segments with multiple vertices within a range near the vertices to obtain an initial model; rendering the initial model based on preset attribute parameters to generate a cocoon-like model; wherein the model shape of the cocoon-like model matches the cocoon morphology; the preset attribute parameters include color parameters and / or size parameters.
[0005] In a second aspect, the present disclosure provides a model generation device, which includes: a point scattering module, which is used to obtain a target model and generate multiple points on the surface of the target model; a line segment copying module, which is used to copy preset line segments to the locations of multiple points respectively; wherein the preset line segments are line segments containing multiple vertex segments; a line segment deformation module, which is used to deform the preset line segments on multiple points to obtain multiple deformed preset line segments; a vertex connection module, which is used to connect the vertices on the deformed preset line segments with multiple vertices in the vicinity of the vertices to obtain an initial model; a model rendering module, which is used to render the initial model based on preset attribute parameters to generate a cocoon-like model; wherein the model shape of the cocoon-like model matches the cocoon morphology; the preset attribute parameters include color parameters and / or size parameters.
[0006] In a third aspect, the present disclosure provides an electronic device, which includes a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned model generation method.
[0007] In a fourth aspect, the present disclosure provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned model generation method.
[0008] The embodiments of the present disclosure bring the following beneficial effects:
[0009] The present disclosure provides a model generation method, device and electronic device, which first obtains a target model and generates multiple points on the surface of the target model; then copies the preset line segments to the locations of the multiple points respectively; wherein the preset line segments are line segments containing multiple vertex segments; then deforms the preset line segments on the multiple points to obtain multiple deformed preset line segments; then connects the vertices on the deformed preset line segments with multiple vertices in the vicinity of the vertices to obtain an initial model; based on preset attribute parameters, renders the initial model to generate a cocoon-shaped model; wherein the model shape of the cocoon-shaped model matches the cocoon shape; the preset attribute parameters include color parameters and / or size parameters. This method can quickly generate a model with a cocoon shape by deforming the line segments on the points generated on the surface of the target model and connecting the line segment vertices, so that the method can make a cocoon-shaped model of any shape by using programmatic formation, which simplifies the difficulty of making the cocoon-shaped model and helps to improve the generation efficiency of the cocoon-shaped model.
[0010] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.
[0011] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, the following specifically cites preferred implementation modes and describes them in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A flow chart of a model generation method provided in an embodiment of the present disclosure;
[0014] Figure 2 A schematic diagram of displaying a target model provided by an embodiment of the present disclosure;
[0015] Figure 3A schematic diagram of multiple points generated on a target model surface provided by an embodiment of the present disclosure;
[0016] Figure 4 A schematic diagram of a preset line segment provided in an embodiment of the present disclosure;
[0017] Figure 5 A display schematic diagram of copying a preset line segment to the positions of multiple points respectively provided in an embodiment of the present disclosure;
[0018] Figure 6 A schematic diagram of an initial deformation line segment deforming in a preset direction provided by an embodiment of the present disclosure;
[0019] Figure 7 A schematic diagram of a deformed preset line segment provided in an embodiment of the present disclosure;
[0020] Figure 8 A schematic diagram of an initial model provided for an embodiment of the present disclosure;
[0021] Fig. 9 A schematic diagram of an initial model after smoothing provided by an embodiment of the present disclosure;
[0022] Fig.10 A schematic diagram of a cocoon-shaped model provided in an embodiment of the present disclosure;
[0023] Fig.11 A schematic diagram of another cocoon-shaped model provided in an embodiment of the present disclosure;
[0024] Fig.12 A schematic diagram of the structure of a model generation device provided in an embodiment of the present disclosure;
[0025] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. The components of the embodiments of the present disclosure described and shown in the drawings here can be arranged and designed in various different configurations.
[0027] Therefore, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the present disclosure claimed for protection, but merely represents selected embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present disclosure.
[0028] In order to facilitate understanding of the embodiment of the present invention, a model generation method provided by the embodiment of the present invention is first described in detail. Figure 1 As shown, the method includes the following specific processes:
[0029] Step S102: acquiring a target model and generating a plurality of points on the surface of the target model.
[0030] In a specific implementation, the above-mentioned target model can be a three-dimensional model or a two-dimensional model, and the model style corresponding to the target model can be determined according to the user operation. For example, the target model can be a cone, a cuboid, a sphere or an ellipsoid, etc. The target model can be a geometric body drawn in real time, or it can be a model passed in from a preset file. After acquiring the target model, multiple points can be generated randomly or uniformly on the surface of the target model, and multiple points can also be generated at fixed positions on the surface of the target model, wherein the number of points generated can be determined according to user operation or R&D requirements. For example, the number of points can be 1000 or 2000, etc.
[0031] In a specific embodiment, the number of points generated on the surface of the target model can be adjusted according to user needs, and the number of points will affect the shape of the cocoon-shaped model finally generated. Generally, the more points are generated, the more cocoon silks the cocoon-shaped model has.
[0032] Step S104, copying the preset line segments to the locations of the multiple points respectively; wherein the preset line segments are line segments including multiple vertex segments.
[0033] The above-mentioned preset line segment is pre-set, and the preset line segment contains multiple vertices, and there is a line segment between every two adjacent vertices, and the line segments corresponding to all vertices constitute the preset line segment. The preset line segment is copied to the position of each vertex generated on the surface of the target model, forming a shape composed of many line segments.
[0034] Step S106, deforming the preset line segments at the multiple points to obtain multiple deformed preset line segments.
[0035] In a specific implementation, a deformation process is performed on each preset line segment in a shape composed of a plurality of line segments to obtain a deformed preset line segment. The deformation process here can be determined according to research and development requirements. For example, the deformation process may include but is not limited to at least one of the following: applying a force in a certain direction to the preset line segment so that the preset line segment bends in that direction; performing a disturbance process on the preset line segment so that the preset line segment has a blown disordered shape; performing an arbitrary bending process on the preset line segment so that the preset line segment has a bending effect, etc.
[0036] Step S108, connecting the vertex on the deformed preset line segment with multiple vertices in a range near the vertex to obtain an initial model.
[0037] In the specific implementation, through deformation processing, the deformed preset line segments at multiple points are presented in a disordered bending state, in preparation for the subsequent simulation of the cocoon-like model. For each vertex on the preset line segment after deformation, the vertex and multiple vertices in the vicinity of the vertex are determined, and the vertex is connected to multiple vertices respectively to obtain an initial model with a line segment connection state. Among them, the specific range corresponding to the vicinity of the vertex can be determined according to research and development needs. For example, the vicinity can be a range with a distance from the vertex less than a preset distance threshold, or a fixed range corresponding to the vertex, etc.
[0038] Step S110, based on preset attribute parameters, the initial model is rendered to generate a cocoon-shaped model; wherein the model shape of the cocoon-shaped model matches the cocoon form; the preset attribute parameters include color parameters and / or size parameters.
[0039] In a specific implementation, the above preset attribute parameters may include only color parameters, only size parameters, or both color parameters and size parameters. The color parameters are used to indicate the color corresponding to each line segment in the initial model, and the size parameters are used to indicate the width corresponding to each line segment in the initial model. Specifically, the user can set the preset attribute parameters as required, so as to render a model with a cocoon shape that meets their own requirements.
[0040] A model generation method provided by an embodiment of the present invention can quickly generate a model with a cocoon shape by deforming line segments on points generated on the surface of a target model and connecting the line segment vertices. Thus, this method can produce cocoon-shaped models of any shape by utilizing programmatic formation, thereby simplifying the difficulty of producing cocoon-shaped models and helping to improve the generation efficiency of cocoon-shaped models.
[0041] The following embodiments are used to describe a method of copying a line segment at a point generated on a model surface, and a method of deforming the line segment.
[0042] Specifically, the specific process of generating a plurality of points on the surface of the target model may include: evenly scattering a preset number of points on the surface of the target model. The preset number may be determined according to user settings, and the user may set any number as the preset number according to needs.
[0043] In the specific implementation, we first need to construct a geometric body of arbitrary shape in space (equivalent to the target model mentioned above), and then evenly sprinkle a preset number (for example, 1000) of points on the surface of the geometric body. Since the cocoon shape tends to be an ellipsoid, the target model can be determined as an ellipsoid, such as Figure 2FIG. 1 is a schematic diagram showing a display of a target model provided by an embodiment of the present invention. Figure 2 The ellipsoid in the figure is the target model. In order to make the cocoon-shaped model obtained later closer to the cocoon shape, it is necessary to evenly scatter points on the surface of the target model so that the scattered points can present the shape of the target model, such as Figure 3 FIG. 1 is a schematic diagram of a plurality of points generated on a target model surface provided by an embodiment of the present invention. Figure 3 The shape of multiple points generated on the surface of the target model is still similar to that of an ellipsoid, which is conducive to simulating the cocoon shape.
[0044] Furthermore, the specific process of copying the preset line segments to the locations of the multiple points may include: vertically placing the preset line segments at the locations of the multiple points, and aligning the vertices at the bottom of the preset line segments with the multiple points.
[0045] In the specific implementation, it is first necessary to create a preset line segment with certain vertex segments, and then place the vertices at the bottom of the preset line segment at the locations of scattered points on the surface of the target model to form a shape composed of many lines.
[0046] like Figure 4 The figure shows a schematic diagram of a preset line segment provided by an embodiment of the present invention. The preset line segment contains 12 vertices, and there is a line segment between every two adjacent vertices. Since the final cocoon-shaped model is composed of line segments, the more line segments the preset line segment corresponds to, the smoother each line will appear. If the number of line segments is too small, there will be hard turns. Figure 5 FIG. 1 is a schematic diagram showing a method of copying a preset line segment to positions of multiple points provided by an embodiment of the present invention. Figure 5 Yes Figure 4 The bottom vertex of the preset line segment is shown with Figure 2 A schematic diagram showing the alignment of each scattered point in the image and placing the preset line segment vertically at the location of the scattered point.
[0047] After the preset line segments are copied to the positions of multiple points respectively, the preset line segments at the multiple points are deformed to obtain multiple deformed preset line segments. The specific process may include: fixing the vertices at the bottom of the preset line segments, applying a force in a preset direction to the unfixed vertices in the preset line segments, and obtaining initial deformed line segments in which the preset line segments are deformed in the preset direction; adding a perturbation coefficient to the initial deformed line segments to obtain the deformed line segments after the perturbation, and the deformed line segments after the perturbation are the deformed preset line segments.
[0048] In specific implementation, after the preset line segments are copied to the locations of multiple points respectively, it is necessary to select the vertices at the bottom of each preset line segment, which are also the vertices corresponding to the points generated on the surface of the target model, so that the shape composed of the vertices at the bottom of all preset line segments is similar to the dot matrix of the model shape of the target model. Specifically, when the preset line segments are copied to the locations of multiple points on the surface of the target model, one preset line segment is copied into multiple preset line segments, and when each preset line segment is generated, the vertex serial number of the preset line segment is continuous. For example, if the preset line segment is composed of 12 vertices, then the vertex serial number of this preset line segment is 0-11, and the vertex No. 0 selected for each preset line segment is the vertex at the bottom of the preset line segment.
[0049] The above fixes the vertices at the bottom of all preset line segments, that is, turns these vertices into a group. When solving the problem later, the vertices in the group can be selected as fixed points and will not be changed. The force in the preset direction applied to the unfixed vertices in the preset line segment can be determined according to research and development needs. For example, the force in the preset direction can be a force from top to bottom, or from left to right, etc. By applying a force in the preset direction to the unfixed vertices in the preset line segment, the preset line segment can be bent in the preset direction. Figure 6 FIG. 1 is a schematic diagram of an initial deformation line segment deforming toward a preset direction provided by an embodiment of the present invention. Figure 6 Yes Figure 5 There is no fixed vertex on the preset line segment. The schematic diagram of applying force from top to bottom can be understood as applying a force from top to bottom. The line closer to the edge is subject to greater pressure. The direction of pressure is from the center point of the model to the preset line segment, so the following is formed: Figure 6 The initial deformation line segments of the shape shown.
[0050] In order to interrupt the regular deformation of the line segment, it is necessary to add a disturbance coefficient to the initial deformation line segment, so that the initial deformation line segment is blown into a more disordered shape, and the preset line segment in this shape corresponds to the preset line segment after deformation. Figure 7 FIG. 1 is a schematic diagram of a deformed preset line segment provided by an embodiment of the present invention. Figure 7 The preset line segments in the figure are schematic diagrams of the image being blown into a more chaotic shape after the disturbance parameters are added.
[0051] In an optional embodiment, the embodiment of the present invention can be applied to Houdini software, and the pop attract node in the vellumsolver solver is used in the Houdini software to apply a force in a preset direction to the unfixed vertices in the preset line segment, so as to obtain an initial deformed line segment in which the preset line segment is deformed in a preset direction. Among them, the pop attract node is mainly used to simulate the movement of objects under the action of gravity. The pop attract node calculates the gravity between objects so that the objects are affected by the attraction during the solution process, thereby achieving complex physical effects. Then, the pop force node in the vellumsolver solver is used in the Houdini software to add a perturbation coefficient to the initial deformed line segment to obtain the deformed line segment after the perturbation. The pop force node is mainly used to simulate the influence of wind or other external forces on objects.
[0052] The following example is used to describe the method of generating an initial model.
[0053] Specifically, the specific process of connecting the vertices on the deformed preset line segment with multiple vertices in the vicinity of the vertex to obtain the initial model includes: for each vertex in the deformed preset line segment, determining multiple target vertices whose distances from the current vertex are less than a preset distance threshold from the vertices on the multiple deformed preset line segments, and connecting the current vertex to the multiple target vertices respectively; and determining the model after each vertex in the deformed preset line segment is connected as the initial model.
[0054] In specific implementation, the specific value corresponding to the above preset distance threshold can be determined according to research and development requirements. For each vertex in the preset line segment after deformation, it is necessary to find the nearest specified number of target vertices within a certain range near the vertex, and connect the vertex with each target vertex respectively, so as to obtain a model form connected by line segments, and the model corresponding to the model form is also the initial model. Among them, the above specified number can be determined according to research and development requirements, for example, the specified number can be 4 or 5, etc.
[0055] like Figure 8 FIG. 1 is a schematic diagram of an initial model provided by the present invention. Figure 8 The initial model in is Figure 7 A schematic diagram showing that each vertex in the deformed preset line segment is connected to target vertices within a certain range nearby.
[0056] The following embodiments are used to describe the smoothing process and model rendering method.
[0057] Specifically, since the cocoon shape is similar to a circle or an ellipse, in order to make the overall shape of the model more and more round or elliptical, it is necessary to connect the vertices on the deformed preset line segment with multiple vertices in the vicinity of the vertex to obtain the initial model, and then smooth the vertices contained in the initial model to obtain an updated initial model. The smoothing method can be determined according to R&D needs. Fig. 9 FIG. 1 is a schematic diagram of an initial model after smoothing provided by an embodiment of the present invention. Fig. 9 It is for Figure 8 Schematic diagram after smoothing each vertex on the preset line segment.
[0058] In an optional embodiment, the specific process of smoothing the vertices included in the initial model to obtain the updated initial model may include: for each vertex included in the initial model, performing the following operations: determining the adjacent vertices of the current vertex from the initial model, determining the weighted average position of the current vertex and the adjacent vertices; and updating the weighted average position to the new position of the current vertex. In this manner, when smoothing the vertex position of each vertex, an iterative weighted average algorithm can be used to adjust the position of the vertex so that the model surface becomes smoother.
[0059] Specifically, for each vertex on the initial model, the adjacent vertices of the current point are first determined through the topological structure of the geometry, and then the weighted average position of the current vertex and its adjacent vertices can be obtained by using the position mean of all adjacent vertices or by weighted calculation based on factors such as distance. Then, the position is iteratively updated, that is, the calculated weighted average position is updated to the new position of the current vertex. By iterating this process multiple times, a smoother geometric surface can be obtained. This smoothing process is similar to the common Gaussian blur in image processing, except that it acts on the vertex position in three-dimensional space. In this way, surface details can be effectively removed and a smoother geometric appearance can be produced.
[0060] In a specific embodiment, an attribute blur node can be used in Houdini to smooth the vertices contained in the initial model. The attribute blur node usually allows the user to control the intensity of the smoothing (for example, by setting the number of iterations or the smoothing factor) so that the user can adjust the desired smoothing effect.
[0061] After obtaining the smoothed initial model, you also need to set color parameters or size parameters. Specifically, you can set the color parameters and size parameters corresponding to each vertex according to the vertex sequence number on each preset line segment on the initial model, so that the subsequent rendering can generate a gradient color, mixed color or single color cocoon-shaped model. Fig.10FIG. 1 is a schematic diagram of a cocoon-shaped model provided by an embodiment of the present invention. Fig.10 For Fig. 9 Schematic diagram of the initial model after attribute rendering.
[0062] In a specific implementation, the method of generating a cocoon-shaped model disclosed in the present invention includes a plurality of parameters that can be set by the user, so that the user can generate models of ever-changing cocoon shapes by adjusting these parameters. Fig.11 FIG. 1 is a schematic diagram of another cocoon-shaped model provided by an embodiment of the present invention. Fig.11 The morphology of the cocoon model in Fig.10 The parameters set by the user may include but are not limited to: the shape of the target model, the preset number of points scattered on the surface of the target model, the number of vertices contained in the preset line segment, the magnitude and direction of the force applied to the preset line segment, the disturbance parameter added to the preset line segment, the number of connected vertices corresponding to the vertices on the preset line segment when they are connected to the surrounding vertices, etc.
[0063] The above method can quickly and batch generate various abstract "cocoon"-like model assets, thereby greatly reducing the production difficulty of such assets and improving production efficiency.
[0064] Corresponding to the above method embodiment, the embodiment of the present invention also provides a model generation device, such as Fig.12 As shown, the device comprises:
[0065] The point scattering module 90 is used to obtain a target model and generate a plurality of points on the surface of the target model.
[0066] The line segment copying module 91 is used to copy the preset line segments to the locations of multiple points respectively; wherein the preset line segments are line segments including multiple vertex segments.
[0067] The line segment deformation module 92 is used to perform deformation processing on the preset line segments at multiple points to obtain multiple deformed preset line segments.
[0068] The vertex connection module 93 is used to connect the vertex on the deformed preset line segment with multiple vertices in the vicinity of the vertex to obtain an initial model.
[0069] The model rendering module 94 is used to render the initial model based on preset attribute parameters to generate a cocoon-like model; wherein the model shape of the cocoon-like model matches the cocoon morphology; the preset attribute parameters include color parameters and / or size parameters.
[0070] The above-mentioned model generating device can quickly generate a model with a cocoon shape by deforming the line segments on the points generated on the surface of the target model and connecting the line segment vertices. Thus, this method can make cocoon-shaped models of any shape by utilizing programmatic formation, which simplifies the difficulty of making cocoon-shaped models and helps to improve the generation efficiency of cocoon-shaped models.
[0071] Furthermore, the point scattering module 90 is used to evenly scatter a preset number of points on the surface of the target model.
[0072] Furthermore, the line segment copying module 91 is used to vertically place the preset line segments at the locations of the multiple points respectively, and align the vertices at the bottom of the preset line segments with the multiple points.
[0073] Furthermore, the above-mentioned line segment deformation module 92 is used to: fix the vertex at the bottom of the preset line segment, apply a force in a preset direction to the unfixed vertices in the preset line segment, and obtain an initial deformed line segment in which the preset line segment is deformed in the preset direction; add a perturbation coefficient to the initial deformed line segment to obtain a deformed line segment after disturbance, and the deformed line segment after disturbance is the deformed preset line segment.
[0074] Furthermore, the above-mentioned line segment deformation module 92 is used to: for each vertex in the deformed preset line segment, determine a plurality of target vertices whose distance from the current vertex is less than a preset distance threshold from the vertices on the plurality of deformed preset line segments, and connect the current vertex to the plurality of target vertices respectively; and determine the model after each vertex in the deformed preset line segment is connected as the initial model.
[0075] Furthermore, the above-mentioned device also includes a model smoothing module, which is used to: after connecting the vertex on the deformed preset line segment with multiple vertices in the vicinity of the vertex to obtain the initial model, smooth the vertices included in the initial model to obtain an updated initial model.
[0076] Furthermore, the above-mentioned model smoothing module is also used to: for each vertex included in the initial model, perform the following operations: determine the adjacent vertices of the current vertex from the initial model, determine the weighted average position of the current vertex and the adjacent vertices; and update the weighted average position to the new position of the current vertex.
[0077] The model generation device provided in the embodiment of the present disclosure has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0078] The present disclosure also provides an electronic device, such as Fig.13As shown, the electronic device includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned model generation method.
[0079] Specifically, the above-mentioned model generation method includes: obtaining a target model and generating multiple points on the surface of the target model; copying preset line segments to the locations of multiple points respectively; wherein the preset line segments are line segments containing multiple vertex segments; deforming the preset line segments on multiple points to obtain multiple deformed preset line segments; connecting the vertices on the deformed preset line segments with multiple vertices in the vicinity of the vertices to obtain an initial model; rendering the initial model based on preset attribute parameters to generate a cocoon-like model; wherein the model shape of the cocoon-like model matches the cocoon shape; the preset attribute parameters include color parameters and / or size parameters.
[0080] The above-mentioned model generation method can quickly generate a model with a cocoon shape by deforming the line segments on the points generated on the surface of the target model and connecting the line segment vertices. Therefore, this method can make cocoon-shaped models of any shape by using programmatic formation, which simplifies the difficulty of making cocoon-shaped models and helps to improve the generation efficiency of cocoon-shaped models.
[0081] In an optional embodiment, the step of generating a plurality of points on the surface of the target model includes: evenly scattering a preset number of points on the surface of the target model.
[0082] In an optional embodiment, the step of copying the preset line segments to the locations of the multiple points respectively includes: vertically placing the preset line segments at the locations of the multiple points respectively, and aligning the vertices at the bottom of the preset line segments with the multiple points.
[0083] In an optional embodiment, the above-mentioned step of deforming the preset line segments at multiple points to obtain multiple deformed preset line segments includes: fixing the vertices at the bottom of the preset line segments, applying a force in a preset direction to the unfixed vertices in the preset line segments, and obtaining initial deformed line segments in which the preset line segments are deformed in a preset direction; adding a perturbation coefficient to the initial deformed line segments to obtain deformed line segments after disturbance, and the deformed line segments after disturbance are the deformed preset line segments.
[0084] In an optional embodiment, the step of connecting the vertices on the deformed preset line segment with multiple vertices in a range near the vertex to obtain an initial model includes: for each vertex in the deformed preset line segment, determining multiple target vertices whose distances from the current vertex are less than a preset distance threshold from the vertices on the multiple deformed preset line segments, and connecting the current vertex to the multiple target vertices respectively; and determining the model after connecting each vertex in the deformed preset line segment as the initial model.
[0085] In an optional embodiment, after the step of connecting the vertex on the deformed preset line segment with multiple vertices in the vicinity of the vertex to obtain an initial model, the method further includes: smoothing the vertices included in the initial model to obtain an updated initial model.
[0086] In an optional embodiment, the above-mentioned step of smoothing the vertices included in the initial model to obtain an updated initial model includes: for each vertex included in the initial model, performing the following operations: determining the adjacent vertices of the current vertex from the initial model, determining the weighted average position of the current vertex and the adjacent vertices; and updating the weighted average position to the new position of the current vertex.
[0087] Further, Fig.13 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .
[0088] The memory 100 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.13 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0089] The processor 101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 101 or the instruction in the form of software. The above processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and completes the steps of the method of the above embodiment in combination with its hardware.
[0090] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above model generation method. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0091] Specifically, the above-mentioned model generation method includes: obtaining a target model and generating multiple points on the surface of the target model; copying preset line segments to the locations of multiple points respectively; wherein the preset line segments are line segments containing multiple vertex segments; deforming the preset line segments on multiple points to obtain multiple deformed preset line segments; connecting the vertices on the deformed preset line segments with multiple vertices in the vicinity of the vertices to obtain an initial model; rendering the initial model based on preset attribute parameters to generate a cocoon-like model; wherein the model shape of the cocoon-like model matches the cocoon shape; the preset attribute parameters include color parameters and / or size parameters.
[0092] The above-mentioned model generation method can quickly generate a model with a cocoon shape by deforming the line segments on the points generated on the surface of the target model and connecting the line segment vertices. Therefore, this method can make cocoon-shaped models of any shape by using programmatic formation, which simplifies the difficulty of making cocoon-shaped models and helps to improve the generation efficiency of cocoon-shaped models.
[0093] In an optional embodiment, the step of generating a plurality of points on the surface of the target model includes: evenly scattering a preset number of points on the surface of the target model.
[0094] In an optional embodiment, the step of copying the preset line segments to the locations of the multiple points respectively includes: vertically placing the preset line segments at the locations of the multiple points respectively, and aligning the vertices at the bottom of the preset line segments with the multiple points.
[0095] In an optional embodiment, the above-mentioned step of deforming the preset line segments at multiple points to obtain multiple deformed preset line segments includes: fixing the vertices at the bottom of the preset line segments, applying a force in a preset direction to the unfixed vertices in the preset line segments, and obtaining initial deformed line segments in which the preset line segments are deformed in a preset direction; adding a perturbation coefficient to the initial deformed line segments to obtain deformed line segments after disturbance, and the deformed line segments after disturbance are the deformed preset line segments.
[0096] In an optional embodiment, the step of connecting the vertices on the deformed preset line segment with multiple vertices in a range near the vertex to obtain an initial model includes: for each vertex in the deformed preset line segment, determining multiple target vertices whose distances from the current vertex are less than a preset distance threshold from the vertices on the multiple deformed preset line segments, and connecting the current vertex to the multiple target vertices respectively; and determining the model after connecting each vertex in the deformed preset line segment as the initial model.
[0097] In an optional embodiment, after the step of connecting the vertex on the deformed preset line segment with multiple vertices in the vicinity of the vertex to obtain an initial model, the method further includes: smoothing the vertices included in the initial model to obtain an updated initial model.
[0098] In an optional embodiment, the above-mentioned step of smoothing the vertices included in the initial model to obtain an updated initial model includes: for each vertex included in the initial model, performing the following operations: determining the adjacent vertices of the current vertex from the initial model, determining the weighted average position of the current vertex and the adjacent vertices; and updating the weighted average position to the new position of the current vertex.
[0099] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a terminal device, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0100] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0101] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A model generation method, characterized in that: The method comprises: Acquire a target model, and generate a plurality of points on a surface of the target model; Copying the preset line segments to the locations of the multiple points respectively; wherein the preset line segments are line segments including multiple vertex segments; Performing deformation processing on the preset line segments at the plurality of points to obtain a plurality of deformed preset line segments; Connecting the vertex on the deformed preset line segment with a plurality of vertices in a range near the vertex to obtain an initial model; Based on preset attribute parameters, the initial model is rendered to generate a cocoon-shaped model; wherein the model shape of the cocoon-shaped model matches the cocoon form; and the preset attribute parameters include color parameters and / or size parameters.
2. The method according to claim 1, characterized in that The step of generating a plurality of points on the surface of the target model comprises: A preset number of points are evenly sprinkled on the surface of the target model.
3. The method according to claim 1, characterized in that The step of copying the preset line segments to the locations of the plurality of points respectively comprises: The preset line segments are respectively placed vertically at the locations of the multiple points, and the vertices at the bottom of the preset line segments are aligned with the multiple points.
4. The method according to claim 3, characterized in that The step of deforming the preset line segments at the plurality of points to obtain a plurality of deformed preset line segments comprises: Fixing the vertex at the bottom of the preset line segment, applying a force in a preset direction to the unfixed vertex in the preset line segment, to obtain an initial deformed line segment in which the preset line segment is deformed toward the preset direction; A disturbance coefficient is added to the initial deformed line segment to obtain a disturbed deformed line segment, wherein the disturbed deformed line segment is the deformed preset line segment.
5. The method according to claim 1, characterized in that The step of connecting the vertex on the deformed preset line segment with a plurality of vertices in a range near the vertex to obtain an initial model comprises: For each vertex in the deformed preset line segment, determine a plurality of target vertices whose distances from the current vertex are less than a preset distance threshold from the vertices on the plurality of deformed preset line segments, and connect the current vertex to the plurality of target vertices respectively; A model formed by connecting each vertex in the deformed preset line segment is determined as an initial model.
6. The method according to claim 1, characterized in that After the step of connecting the vertex on the deformed preset line segment with a plurality of vertices in a range near the vertex to obtain an initial model, the method further comprises: The vertices included in the initial model are smoothed to obtain an updated initial model.
7. The method according to claim 6, characterized in that The step of smoothing the vertices included in the initial model to obtain an updated initial model comprises: For each vertex included in the initial model, perform the following operations: Determine adjacent vertices of a current vertex from the initial model, and determine a weighted average position of the current vertex and the adjacent vertices; The weighted average position is updated to the new position of the current vertex.
8. A model generation device, characterized in that: The device comprises: A point scattering module is used to obtain a target model and generate a plurality of points on the surface of the target model; A line segment copying module, used to copy the preset line segments to the locations of the plurality of points respectively; wherein the preset line segments are line segments including a plurality of vertex segments; A line segment deformation module, used for deforming the preset line segments at the plurality of points to obtain a plurality of deformed preset line segments; A vertex connection module, used to connect the vertex on the deformed preset line segment with multiple vertices in the vicinity of the vertex to obtain an initial model; The model rendering module is used to render the initial model based on preset attribute parameters to generate a cocoon-shaped model; wherein the model shape of the cocoon-shaped model matches the cocoon morphology; the preset attribute parameters include color parameters and / or size parameters.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the model generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the model generation method according to any one of claims 1 to 7.