Model generation method, apparatus, and electronic device
By setting planes perpendicular to different directional axes on the model for automated segmentation and merging, the problem of low efficiency in manually drawing waffle structure models is solved, and efficient and stable waffle structure model generation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-09-27
- Publication Date
- 2026-06-02
AI Technical Summary
The existing technology of manually drawing virtual models of waffle structures is inefficient and not universal, which leads to a large amount of manpower required for the production of large-scale models, and the artistic effect is unstable.
By setting multiple planes perpendicular to different directional axes on the model to be processed, and using automated segmentation and merging operations, a target model with a waffle structure is generated.
It improves the efficiency of model making, saves manpower and time, and ensures the consistency of models and the stability of artistic effects.
Smart Images

Figure CN115908695B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of model making technology, and in particular to a model generation method, apparatus and electronic device. Background Technology
[0002] In virtual model creation, models such as waffle-shaped structures or buildings with waffle grids are typically produced. In related technologies, users usually manually draw virtual models of waffle grid structures using 3D modeling software. However, manual drawing is inefficient, and each model is unique and not universally applicable. Therefore, when creating a large number of models, a significant amount of manpower is required. Summary of the Invention
[0003] The purpose of this invention is to provide a model generation method, apparatus, and electronic device to improve the production efficiency of models with waffle structures.
[0004] In a first aspect, the present invention provides a model generation method, the method comprising: acquiring a model to be processed; setting a plurality of first planes perpendicular to a first direction axis on the model to be processed, and dividing the model to be processed based on the plurality of first planes to obtain a first structure; setting a plurality of second planes perpendicular to a second direction axis on the model to be processed, and dividing the model to be processed based on the plurality of second planes to obtain a second structure; wherein the second direction axis forms a preset angle with the first direction axis; and generating a target model with a waffle structure based on the first structure and the second structure.
[0005] Secondly, the present invention provides a model generation apparatus, comprising: a model acquisition module for acquiring a model to be processed; a first segmentation module for setting a plurality of first planes perpendicular to a first direction axis on the model to be processed, and segmenting the model to be processed based on the plurality of first planes to obtain a first structure; a second segmentation module for setting a plurality of second planes perpendicular to a second direction axis on the model to be processed, and segmenting the model to be processed based on the plurality of second planes to obtain a second structure; wherein the second direction axis forms a preset angle with the first direction axis; and a model generation module for generating a target model with a waffle structure based on the first structure and the second structure.
[0006] Thirdly, the present invention provides an electronic device including a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the above-described model generation method.
[0007] Fourthly, the present invention provides a computer-readable storage medium storing computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the above-described model generation method.
[0008] The embodiments of the present invention bring the following beneficial effects:
[0009] This invention provides a model generation method, apparatus, and electronic device. First, a model to be processed is acquired. Then, multiple first planes perpendicular to a first direction axis are set on the model to be processed, and the model is segmented based on these first planes to obtain a first structure. Next, multiple second planes perpendicular to a second direction axis are set on the model to be processed, and the model is segmented based on these second planes to obtain a second structure. The second direction axis forms a preset angle with the first direction axis. Finally, a target model with a waffle structure is generated based on the first and second structures. This method automatically segments the model after acquisition to obtain a waffle structure. Compared to manually creating models with waffle structures, this method automates model creation through a program, saving significant manpower and time and improving model creation efficiency.
[0010] Other features and advantages of the invention will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.
[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0013] Figure 1 A flowchart of a model generation method provided in an embodiment of the present invention;
[0014] Figure 2 A flowchart of another model generation method provided in an embodiment of the present invention;
[0015] Figure 3 A schematic diagram of a model to be processed provided in an embodiment of the present invention;
[0016] Figure 4 A schematic diagram of a closed polygonal model provided in an embodiment of the present invention;
[0017] Figure 5This is a schematic diagram of the minimum circumscribed cuboid of the model to be processed provided in an embodiment of the present invention;
[0018] Figure 6 A schematic diagram showing the minimum and maximum coordinate positions of the first direction axis provided in an embodiment of the present invention;
[0019] Figure 7 A schematic diagram of a plurality of first planes provided in an embodiment of the present invention;
[0020] Figure 8 This is a schematic diagram of the intersection of the first plane and the model to be processed in the processing result provided by the embodiment of the present invention;
[0021] Figure 9 This is a schematic diagram of the first structure obtained after extrusion calculation according to an embodiment of the present invention;
[0022] Figure 10 A flowchart of another model generation method provided in an embodiment of the present invention;
[0023] Figure 11 A schematic diagram of a plurality of second planes provided in an embodiment of the present invention;
[0024] Figure 12 This is a schematic diagram of the intersection of the second plane and the model to be processed in the processing result provided by the embodiment of the present invention;
[0025] Figure 13 This is a schematic diagram of the second structure obtained after extrusion calculation according to an embodiment of the present invention;
[0026] Figure 14 A schematic diagram of the overlapping results provided in an embodiment of the present invention;
[0027] Figure 15 A schematic diagram of the fourth structure provided in an embodiment of the present invention;
[0028] Figure 16 A schematic diagram of a target model with a waffle structure provided in an embodiment of the present invention;
[0029] Figure 17 This is a schematic diagram of the structure of a model generation device provided in an embodiment of the present invention;
[0030] Figure 18 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0032] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0033] In virtual model creation, it's common to create hollowed-out waffle models or artistic waffle-structured building exteriors or ceilings. In related technologies, users typically use 3D modeling software to manually draw virtual waffle-structured models. This involves creating individual blocks, assembling them, and then deforming them to fit the target shape. However, manual drawing is inefficient, and each model is unique and not universally applicable. Therefore, when creating a large number of models, it requires significant manpower. Furthermore, the artistic effects of manually drawn models are easily affected by human factors, leading to inconsistent results.
[0034] To address the aforementioned problems, embodiments of the present invention provide a model generation method, apparatus, and electronic device. This technology can be applied to model creation scenarios, particularly those involving waffle grid structures. To facilitate understanding of these embodiments, a model generation method disclosed in these embodiments will first be described in detail, such as... Figure 1 As shown, the method includes the following specific steps:
[0035] Step S102: Obtain the model to be processed.
[0036] The aforementioned model to be processed can be any model input by the user that needs to be processed. This model can be a 3D model drawn by the user in drawing software, or a 3D model saved in a preset file. Specifically, this invention is implemented on preset software, which can design a set of logic encapsulated as a plug-in tool. This plug-in tool can output a target model with a waffle structure based on the input model to be processed. In some embodiments, the preset software can be Houdini software or other software used by the user.
[0037] It should be noted that a waffle grid structure is typically a structure with multiple square or rhomboid embossed patterns.
[0038] Step S104: Set multiple first planes perpendicular to the first direction axis on the model to be processed, and divide the model to be processed based on the multiple first planes to obtain the first structure.
[0039] The aforementioned first direction axis can be the Z-axis direction in a three-dimensional coordinate system, or it can be the X-axis direction, Y-axis direction, etc. The specific direction of the first direction axis is set according to the research and development needs. When setting a first plane perpendicular to the first direction axis on the model to be processed, multiple subdivision points can be placed on the first direction axis first, and then a first plane perpendicular to the plane containing the first direction axis can be set at each subdivision point, thus obtaining multiple first planes. Then, the model to be processed can be divided using multiple first planes, resulting in a model whose surface is divided into strip-like structures. This divided model to be processed is also the first structure.
[0040] Step S106: Set multiple second planes perpendicular to the second direction axis on the model to be processed, and divide the model to be processed based on the multiple second planes to obtain a second structure; wherein the second direction axis is at a preset angle to the first direction axis.
[0041] The aforementioned second direction axis is a different direction axis from the first direction axis in the three-dimensional coordinate system, and the first direction axis and the second direction axis form a preset angle, which is usually 90 degrees, but can also be other angles set by the user. Specifically, the second direction axis can be the Z-axis direction, the X-axis direction, or the Y-axis direction in the three-dimensional coordinate system, etc. The specific direction of the first direction axis and the second direction axis is set according to the research and development requirements.
[0042] When setting a second plane perpendicular to the second direction axis on the model to be processed, multiple subdivision points can be placed on the second direction axis first, and then a second plane perpendicular to the plane where the second direction axis is located can be set on each subdivision point, thus obtaining multiple second planes. Then, the model to be processed can be divided using multiple second planes, resulting in a model whose surface is divided into strip-shaped structures. This divided model to be processed is also the second structure.
[0043] Step S108: Based on the first structure and the second structure, generate a target model with a waffle structure.
[0044] By performing a comprehensive operation on the first structure and the second structure, a target model with a waffle structure can be obtained. This comprehensive operation may include merging the first structure and the second structure, taking the intersection of the first structure and the second structure, etc. The specific operation method of the comprehensive operation can be set according to the research and development needs, and is not specifically limited here.
[0045] This invention provides a model generation method that first obtains a model to be processed; then, multiple first planes perpendicular to a first direction axis are set on the model to be processed, and the model is divided based on the multiple first planes to obtain a first structure; next, multiple second planes perpendicular to a second direction axis are set on the model to be processed, and the model is divided based on the multiple second planes to obtain a second structure; wherein the second direction axis forms a preset angle with the first direction axis; then, a target model with a waffle structure is generated based on the first structure and the second structure. This method can automatically segment the model to be processed after obtaining it, obtaining a model with a waffle structure. Compared to manually creating models with waffle structures, this method automates model creation through a program, saving a significant amount of manpower and time, and improving the efficiency of model creation.
[0046] This invention also provides another model generation method, which is implemented based on the above embodiments. This method focuses on describing the specific process of setting multiple first planes perpendicular to the first direction axis on the model to be processed, and dividing the model based on the multiple first planes to obtain a first structure (specifically implemented through steps S204-S208 below); such as Figure 2 As shown, the method includes the following specific steps:
[0047] Step S202: Obtain the model to be processed.
[0048] In practical implementation, after obtaining the model to be processed, it is necessary to move the center position of the model to the center position in world coordinates. Then, the moved model is converted into a closed polygon model, which is then used to replace the model to be processed in subsequent steps. Specifically, moving the center position of the model to the center position in world coordinates simplifies subsequent model processing. The method for determining the center position of the model to be processed includes: for each axis, the average of the maximum and minimum coordinate values of the model to be processed in the current axis is used as the center coordinate value of the current axis. The center coordinate values of each axis are combined to obtain the coordinates of the center position of the model to be processed. The center position in world coordinates is also the position at coordinates (0,0,0).
[0049] In practical applications, the `matchsize` node can be used to move the center position of the model to be processed to the center position in world coordinates. The `matchsize` node mentioned above is a built-in node of the Houdini software, which can reset the size and center position of the model to be processed based on the input model.
[0050] In practical applications, after moving the center of the model to be processed to the center of the world coordinate system, it is necessary to convert the model to VDB (Volume Database File) format using `vdbfrompolygons` to obtain a closed polygonal model. This conversion of the moved model to a closed polygonal model is to make the entire model a closed, unified model. Specifically, the `convertvdb` node can be used to convert the volume elements of the model to be processed into a uniform, closed polygonal model. This `convertvdb` node can convert a VDB into a closed polygon. Figure 3 The diagram shown is a schematic representation of a model to be processed according to an embodiment of the present invention. Figure 3 The spherical shape with a support at the bottom is the model to be processed; for example... Figure 4 The diagram shown is a schematic diagram of a closed polygonal model provided in an embodiment of the present invention.
[0051] Step S204: Determine the longest line connecting the model to be processed on the first direction axis.
[0052] In practice, step S204 above is implemented through the following steps 10-12:
[0053] Step 10: Generate the minimum bounding box of the model to be processed.
[0054] A minimum bounding box is set around the model to be processed to enclose it. Specifically, a box adapted to the size of the model to be processed can be automatically generated using preset nodes; this box is the minimum bounding box of the model. In practical applications, the preset node can be a box node or other functions. Figure 5 The diagram shown is a schematic of the minimum bounding cuboid of the model to be processed. Figure 5 The cuboid surrounding the model to be processed is the smallest circumscribed cuboid.
[0055] Step 11: Determine the maximum and minimum coordinate positions of the smallest circumscribed cuboid on the first direction axis.
[0056] In practical implementation, the maximum and minimum coordinates of the smallest circumscribed cuboid on the first direction axis can be obtained through a preset program. The position of the maximum coordinate within the smallest circumscribed cuboid is determined as the maximum coordinate position, and the position of the minimum coordinate within the smallest circumscribed cuboid is determined as the minimum coordinate position. Specifically,
[0057] In practical applications, we can first obtain the position coordinates of the largest first direction axis, second direction axis, and third direction axis of the smallest circumscribed cuboid (that is, the coordinate positions of the X-axis, Y-axis, and Z-axis), as well as the position coordinates of the smallest first direction axis, second direction axis, and third direction axis. Then, we can extract the maximum and minimum coordinates of the first direction axis from them, and thus obtain the maximum and minimum coordinate positions on the first direction axis.
[0058] Step 12: Determine the line connecting the maximum and minimum coordinate positions as the longest line on the first direction axis of the model to be processed.
[0059] In the actual implementation, a preset program connects the maximum and minimum coordinate positions to obtain a line, which is the longest connecting line. The preset program includes the following code:
[0060] v@max = getbbox_max(0);
[0061] v@min = getbbox_min(0);
[0062] vector zp0=set(0,0,@max.z);
[0063] vector zp1=set(0,0,@min.z);
[0064] int np0 = addpoint(0, zp0);
[0065] int np1 = addpoint(0, zp1);
[0066] intnewprimz=addprim(0,"polyline",np0,np1);
[0067] setprimgroup(0,"pz",newprimz,1).
[0068] Here, zp0 = set(0,0,@max.z) represents obtaining the maximum coordinate position of the first direction axis; zp1 = set(0,0,@min.z) represents obtaining the minimum coordinate position of the first direction axis, and pz is an array that stores the connection information between the maximum and minimum coordinate positions. Figure 6 The diagram shown illustrates the minimum and maximum coordinate positions of the first direction axis provided in an embodiment of the present invention. Figure 6 In the diagram, points 8 and 9 circled in the box represent the minimum coordinate positions.
[0069] Step S206: Set multiple subdivision points on the longest connecting line, and set a first plane perpendicular to the first direction axis at each subdivision point to obtain multiple first planes.
[0070] In practical implementation, multiple subdivision points can be set evenly or non-uniformly along the longest connecting line. The rules for setting subdivision points can be set according to R&D needs. After obtaining multiple subdivision points, a first plane perpendicular to the first direction axis will be set on each subdivision point.
[0071] In practical applications, step S206 above can be achieved through the following steps 20-21:
[0072] Step 20: Set multiple subdivision points on the longest connecting line on average.
[0073] In the specific implementation, a resample node can be added and its segments channel can be written to ch(".. / null1 / X") and then connected to a null node (also known as a virtual node). The resample node can sample the line multiple times and subdivide the line into points on an average basis. X represents the number of subdivided points, which can be input by the user to control the number of times the model is segmented.
[0074] Step 21: Copy multiple planes perpendicular to the first direction axis in the smallest circumscribed cuboid, and assign the copied planes to the subdivision points to obtain the first plane perpendicular to the first direction axis set at each subdivision point.
[0075] At each subdivision point, a first plane perpendicular to the first direction axis is set. This first plane has the same size as the plane perpendicular to the first direction axis in the smallest circumscribed cuboid. Specifically, the plane perpendicular to the first direction axis in the smallest circumscribed cuboid can be moved to the origin of the world coordinate system; then the moved plane is copied and offset to the position of each subdivision point, thus obtaining the first plane perpendicular to the first direction axis set at each subdivision point.
[0076] In practical applications, `split_prim_by_normal` can be used on the minimum bounding cube of the model to be processed, allowing selection of the normal direction for each directional axis. Here, the normal direction of the first directional axis is selected, resulting in a face on one side of the minimum bounding cube. This face is also the face in the minimum bounding cube that is parallel to the normal of the first directional axis. Then, the obtained plane is moved to the center position in world coordinates using the `matchsize` node.
[0077] The resulting plane is moved to the center of the world because it needs to be copied later. The copied plane is then positioned at the world center (coordinates (0,0,0)). The copied plane will not carry displacement information. For example, if the center of the original plane is (0,1,0), all copied planes will be offset upwards by one unit. We want to avoid this offset, so we set it to 0 before copying, thus simplifying the calculation.
[0078] like Figure 7 The diagram shown is a schematic representation of a plurality of first planes provided in an embodiment of the present invention. Figure 7 It contains 9 subdivision points, numbered 0-8, and each subdivision point has a first plane perpendicular to the first direction axis. Figure 7 The first direction axis in the diagram is the Z-axis.
[0079] Step S208: Perform Boolean operations on multiple first planes and the model to be processed to segment the model to be processed and obtain the first structure.
[0080] The Boolean operations described above are a logical deduction method using digital symbols, including operations such as union, intersection, and subtraction. This logical operation method is used in graphics processing to generate new shapes from simple basic graphic combinations. Specifically, boolean nodes (also called Boolean nodes) can be used to perform Boolean operations on multiple first planes and the model to be processed.
[0081] In practical applications, step S208 above can be achieved through the following steps 30-31:
[0082] Step 30: Overlap multiple first planes with the model to be processed to obtain the processing result.
[0083] Step 31: Determine the first structure based on the intersection of the first plane and the model to be processed in the processing result.
[0084] Specifically, the intersection of the first plane and the model to be processed in the processing result can be determined as the first structure, or a polygon extrusion operation can be performed on the intersection of the first plane and the model to be processed in the processing result according to a preset extrusion distance to obtain the first structure.
[0085] In practical implementation, the Polyextrude node can be used to perform polygon extrusion operations on the intersection of the first plane in the processing result and the plane to be processed. This Polyextrude node has the function of extruding faces. Distance is a parameter of the Polyextrude node, which is equivalent to the extrusion distance and is used to control the extrusion distance (thickness). The above-mentioned extrusion distance can be manually controlled. Users can set different distance values according to their needs, which is beneficial to the personalized needs of the model.
[0086] In practical applications, the backlog distance parameter is controlled by a `newparameter` under a `null` node. This centralizes all parameters that can be manually controlled later onto the `null` node, making it convenient to control only this node. The parameters on this node can be freely adjusted by the user according to different usage scenarios, providing convenience while also ensuring a degree of freedom. For example... Figure 8 The diagram shown is a schematic representation of the intersection of the first plane and the model to be processed in the processing result provided by an embodiment of the present invention. Figure 9 The diagram shown is a schematic diagram of the first structure obtained after extrusion calculation according to an embodiment of the present invention.
[0087] Step S210: Set multiple second planes perpendicular to the second direction axis on the model to be processed, and divide the model to be processed based on the multiple second planes to obtain the second structure.
[0088] The method for obtaining the second structure described above can be the same as the method for obtaining the first structure. That is, the first direction axis in steps S204-S210 is replaced with the first direction axis to obtain multiple second planes perpendicular to the second direction axis. Then, the multiple second planes are subjected to Boolean operations with the model to be processed to divide the model to be processed and obtain the second structure.
[0089] Step S212: Based on the first structure and the second structure, generate a target model with a waffle structure.
[0090] The above-described model generation method involves uniformly placing points along a single axis of the model to be processed. Each point is copied to a plane, and a polygon is extruded from the plane. After Boolean operation with the original model, the same process is performed on the other axis. The results are then combined to generate a target model with a waffle structure. This method eliminates the manual modeling process and creates a tool to replace it, thus quickly generating models with a waffle structure. It is especially efficient when processing a large number of similar models.
[0091] This invention also provides another model generation method, which is implemented based on the above embodiments. This method focuses on describing the specific process of setting multiple second planes perpendicular to the second direction axis on the model to be processed, dividing the model based on the multiple second planes to obtain a second structure (implemented through steps S306-S310 below), and the specific process of generating a target model with a waffle structure based on the first and second structures (implemented through steps S312-S316 below); Figure 10 As shown, the method includes the following specific steps:
[0092] Step S302: Obtain the model to be processed.
[0093] Step S304: Set multiple first planes perpendicular to the first direction axis on the model to be processed, and divide the model to be processed based on the multiple first planes to obtain the first structure.
[0094] Step S306: Determine the longest connection line of the model to be processed on the second direction axis.
[0095] The first direction axis mentioned above is a different direction axis from the second direction axis. For example, the first direction axis can be the Z-axis, and the second direction axis can be the X-axis. A minimum circumscribed cuboid is set around the model to be processed to enclose the model. Then, the maximum and minimum coordinate positions of the minimum circumscribed cuboid on the second direction axis are determined. The line connecting the maximum and minimum coordinate positions is determined as the longest line connecting the model to be processed on the second direction axis.
[0096] In practical implementation, the maximum and minimum coordinate positions of the smallest circumscribed cuboid on the second direction axis can be obtained through a second preset procedure. For example, the position coordinates of the largest first direction axis, second direction axis, and third direction axis (i.e., the coordinate positions of the X-axis, Y-axis, and Z-axis) and the smallest first direction axis, second direction axis, and third direction axis of the smallest circumscribed cuboid can be obtained first. Then, the maximum and minimum coordinates of the second direction axis can be extracted from them, thus obtaining the maximum and minimum coordinate positions on the second direction axis. Connecting the maximum and minimum coordinate positions yields the longest connecting line, which is then set in the data Px for subsequent calls. The aforementioned second preset procedure includes the following code:
[0097] v@max = getbbox_max(0);
[0098] v@min = getbbox_min(0);
[0099] vector zp0=set(0,0,@max.z);
[0100] vector zp1=set(0,0,@min.z);
[0101] int np0 = addpoint(0, zp0);
[0102] int np1 = addpoint(0, zp1);
[0103] intnewprimz=addprim(0,"polyline",np0,np1);
[0104] setprimgroup(0,"pz",newprimz,1).
[0105] Where zp0 = set(0,0,@max.z) represents the maximum coordinate position of the second direction axis; zp1 = set(0,0,@min.z) represents the minimum coordinate position of the second direction axis, and px is an array.
[0106] Step S308: Set multiple subdivision points on the longest connecting line, and set a second plane perpendicular to the second direction axis at each subdivision point to obtain multiple second planes.
[0107] In practical implementation, multiple subdivision points can be evenly distributed along the longest connection line, or they can be distributed non-uniformly. The rules for setting subdivision points can be set according to development needs. In practical implementation, a resample node can be added, and its segments channel can be written to ch(".. / null1 / Y") and then connected to a null node (also called a virtual node); where Y represents the number of subdivided points, which can be input by the user to control the number of times the model is segmented.
[0108] At each subdivision point, a second plane perpendicular to the second direction axis is set. This second plane has the same size as the plane perpendicular to the second direction axis in the smallest circumscribed cuboid. Specifically, the plane perpendicular to the second direction axis in the smallest circumscribed cuboid can be moved to the origin of the world coordinate system; then, the moved plane is copied and offset to the position of each subdivision point, resulting in the second plane perpendicular to the second direction axis set at each subdivision point. Figure 11 The diagram shown is a schematic diagram of a plurality of second planes provided in an embodiment of the present invention. Figure 11 It contains 9 subdivision points, and each subdivision point has a second plane perpendicular to the second direction axis. Figure 11 The second direction axis in the diagram is the X-axis.
[0109] In practical applications, `split_prim_by_normal` can be used on the minimum bounding cube of the model to be processed, allowing selection of the normal direction for each directional axis. Here, the normal direction of the second directional axis is selected, resulting in a face on one side of the minimum bounding cube. This face is also the face in the minimum bounding cube that is parallel to the normal of the second directional axis. Then, the obtained plane is moved to the center position in world coordinates using the `matchsize` node.
[0110] Step S310: Perform Boolean operations on multiple second planes and the model to be processed to segment the model and obtain the second structure.
[0111] The aforementioned Boolean operations are a logical deduction method using digital symbols, including operations such as union, intersection, and subtraction. Specifically, multiple second faces are overlapped with the model to be processed to obtain the processing result; then, based on the intersection of the second planes in the processing result with the model to be processed, the second structure is determined. In specific implementations, the intersection of the second planes in the processing result with the model to be processed can be determined as the second structure, or a polygon extrusion operation can be performed on the intersection of the second planes in the processing result with the model to be processed according to a preset extrusion distance to obtain the second structure.
[0112] In practical applications, the Polyextrude node can be used to perform polygon extrude operations on the intersection of the second plane and the plane to be processed in the processing result. This Polyextrude node has the function of extruded faces. `distance` is a parameter of the Polyextrude node, which is equivalent to the extrusion distance, used to control the extrusion distance (thickness). The extrusion distance can be manually controlled; users can set different distance values according to their needs, thus facilitating the personalization of the model. Furthermore, users can freely adjust the parameters according to different usage scenarios, providing convenience while also ensuring a degree of freedom. Figure 12 The diagram shown is a schematic representation of the intersection of the second plane and the model to be processed in the processing result provided by an embodiment of the present invention. Figure 13 The diagram shown is a schematic diagram of the second structure obtained after extrusion calculation according to an embodiment of the present invention.
[0113] Step S312: Perform Boolean operations on the first structure and the second structure to obtain the third structure.
[0114] The Boolean operations described above can be addition, intersection, or other operations. In specific implementations, step S312 can be achieved through the following steps 40-41:
[0115] Step 40: Perform an overlap operation on the first structure and the second structure to obtain the overlap result.
[0116] Step 41: Based on the intersection of the first and second structures in the above overlapping results, determine the third structure.
[0117] In practical implementation, the intersection of the first and second structures in the overlapping result can be set as the third structure; alternatively, the intersection of the first and second structures in the overlapping result can be determined to include multiple individual models; based on the side length control parameter, a circumscribed cuboid is set for each individual model to obtain the third structure.
[0118] like Figure 14 The diagram shown illustrates the overlapping results. Figure 14As can be seen, the overlapping result contains multiple independent individual models. For each individual model, a circumscribed cuboid is set to enclose it. Specifically, a box (i.e., the circumscribed cuboid) is used to enclose each individual model, and a Peak node is added. This Peak node carries a distance parameter (equivalent to an edge length control parameter), which controls the size of the tessellation gaps in the model. The Peak node can translate metafaces, points, edges, and endpoints along the normal direction.
[0119] Step S314: Combine the first structure and the second structure to obtain the fourth structure.
[0120] In practical implementation, a merge node can be used to merge the first and second structures to obtain the fourth structure. For example... Figure 15 The diagram shown is a schematic of the fourth structure.
[0121] Step S316: Subtract the third structure from the fourth structure to obtain the target model with a waffle structure.
[0122] In practical implementation, using the sub-model of boolean nodes allows subtracting the third structure from the fourth structure, resulting in a target model with a waffle structure. For example... Figure 16 The diagram shown is a schematic of a target model with a waffle structure.
[0123] In practical applications, the model generation process provided in this embodiment of the invention can be packaged into an HDA (Houdini Digital Assets) tool. That is, the model generation process is encapsulated into a plug-in tool for Houdini software. You only need to input the model to be processed, and the model can be output as a waffle structure. The size, spacing and arrangement of the waffle grid can be freely matched. The output model is ready to use immediately without the need to adapt it back to the original model appearance or to manually assemble it. It completely eliminates the traditional manual production process and improves the efficiency of model production by automating it with the Houdini program.
[0124] The aforementioned model generation method completely eliminates the traditional manual production process, utilizing automated programming to generate models with waffle structures. This further improves production efficiency, shortens the production cycle, and, because it is programmatic, ensures greater consistency in the final product. Furthermore, this method can be used on any graphical interface platform and is easily compatible with mainstream engines, without platform limitations, reducing compatibility issues during development.
[0125] In addition to the above-described method embodiments, this invention also provides a model generation apparatus, such as... Figure 17As shown, the device includes:
[0126] The model acquisition module 90 is used to acquire the model to be processed.
[0127] The first segmentation module 91 is used to set multiple first planes perpendicular to the first direction axis on the model to be processed, and to segment the model to be processed based on the multiple first planes to obtain the first structure.
[0128] The second segmentation module 92 is used to set multiple second planes perpendicular to the second direction axis on the model to be processed, and to segment the model to be processed based on the multiple second planes to obtain a second structure; wherein the second direction axis is at a preset angle to the first direction axis.
[0129] Model generation module 93 is used to generate a target model with a waffle structure based on the first structure and the second structure.
[0130] The aforementioned model generation device first acquires a model to be processed; then, it sets multiple first planes perpendicular to a first direction axis on the model to be processed, and divides the model based on these first planes to obtain a first structure; next, it sets multiple second planes perpendicular to a second direction axis on the model to be processed, and divides the model based on these second planes to obtain a second structure; wherein the second direction axis forms a preset angle with the first direction axis; then, based on the first and second structures, it generates a target model with a waffle structure. This method, after acquiring the model to be processed, can automatically segment it to obtain a model with a waffle structure. Compared to manually creating models with waffle structures, this method automates model creation through a program, saving significant manpower and time, and improving the efficiency of model creation.
[0131] Specifically, the first segmentation module 91 includes: a longest connection determination unit, used to determine the longest connection of the model to be processed on the first direction axis; a plane setting unit, used to set multiple subdivision points on the longest connection line, and set a first plane perpendicular to the first direction axis at each subdivision point to obtain multiple first planes; and a segmentation unit, used to perform Boolean operations on the multiple first planes and the model to be processed to segment the model to be processed to obtain a first structure.
[0132] Furthermore, the aforementioned longest connection determination unit is also used to: generate the minimum circumscribed cuboid of the model to be processed; determine the maximum and minimum coordinate positions of the minimum circumscribed cuboid on the first direction axis; and determine the line connecting the maximum and minimum coordinate positions as the longest connection of the model to be processed on the first direction axis.
[0133] Furthermore, the aforementioned plane setting unit is also used to: set multiple subdivision points on an average basis along the longest connecting line; copy multiple planes perpendicular to the first direction axis in the smallest circumscribed cuboid, and assign the copied planes to the subdivision points, so as to obtain a first plane perpendicular to the first direction axis set on each subdivision point.
[0134] In a specific implementation, the aforementioned plane setting unit is also used to: move the plane perpendicular to the first direction axis in the smallest circumscribed cuboid to the origin of the world coordinate system; copy the moved plane and offset the moved plane to the position of each subdivision point to obtain the first plane perpendicular to the first direction axis set at each subdivision point.
[0135] Furthermore, the aforementioned segmentation unit is used to: perform overlapping processing on multiple first planes and the model to be processed to obtain processing results; and determine the first structure based on the intersection of the first planes and the model to be processed in the processing results.
[0136] Specifically, the aforementioned segmentation unit is also used to: perform polygon extrusion calculation on the intersection of the first plane and the model to be processed in the processing result according to a preset extrusion distance, so as to obtain the first structure.
[0137] In practical applications, the second segmentation module 92 is used to: determine the longest line connecting the model to be processed on the second direction axis; set multiple subdivision points on the longest line, and set a second plane perpendicular to the second direction axis at each subdivision point to obtain multiple second planes; and perform Boolean operations on the multiple second planes and the model to be processed to segment the model to be processed and obtain the second structure.
[0138] Furthermore, the aforementioned model generation module 93 is also used to: perform Boolean operations on the first structure and the second structure to obtain the third structure; perform a merging operation on the first structure and the second structure to obtain the fourth structure; and subtract the third structure from the fourth structure to obtain the target model with a waffle structure.
[0139] In a specific implementation, the aforementioned model generation module 93 is also used to: perform an overlap operation on the first structure and the second structure to obtain an overlap result; and determine the third structure based on the intersection of the first structure and the second structure in the overlap result.
[0140] In a specific implementation, the aforementioned model generation module 93 is also used to: determine the multiple individual models included in the intersection of the first and second structures in the overlapping results; and set an circumscribed cuboid for each individual model based on the side length control parameters to obtain the third structure.
[0141] Furthermore, the above-mentioned device also includes a model preprocessing module, used for: setting multiple first planes perpendicular to the first direction axis on the model to be processed; dividing the model to be processed based on the multiple first planes to obtain the first structure; moving the center position of the model to be processed to the center position of the world coordinates; converting the moved model to be processed into a closed polygonal model, so as to replace the polygonal model with the model to be processed to perform subsequent steps.
[0142] The model generation apparatus provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the apparatus embodiment can be referred to the corresponding content in the aforementioned method embodiment.
[0143] This invention also provides an electronic device, such as... Figure 18 As shown, the electronic device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, which executes the machine-executable instructions to implement the adjustment and control method of the object described above.
[0144] Furthermore, Figure 18 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 101, the communication interface 103 and the memory 100 connected via the bus 102.
[0145] The memory 100 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 18 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0146] Processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 101 or by instructions in software form. The 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 gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 100, and processor 101 reads information from memory 100 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.
[0147] This invention also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are invoked and executed by a processor, they cause the processor to implement the aforementioned adjustment and control method for the object. For specific implementation details, please refer to the method embodiments, which will not be repeated here.
[0148] If the aforementioned functions are implemented as 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 this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal device, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0149] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0150] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A model generation method, characterized in that, The method includes: Obtain the model to be processed; Multiple first planes perpendicular to the first direction axis are set on the model to be processed, and the model to be processed is divided based on the multiple first planes to obtain a first structure; Multiple second planes perpendicular to the second direction axis are set on the model to be processed, and the model to be processed is divided based on the multiple second planes to obtain a second structure; wherein, the second direction axis is at a preset angle to the first direction axis; Based on the first structure and the second structure, a target model with a waffle structure is generated. The step of generating a target model with a waffle structure based on the first structure and the second structure includes: performing a Boolean operation on the first structure and the second structure to obtain a third structure; performing a merging operation on the first structure and the second structure to obtain a fourth structure; and subtracting the third structure from the fourth structure to obtain a target model with a waffle structure.
2. The method according to claim 1, characterized in that, The step of setting multiple first planes perpendicular to the first direction axis on the model to be processed, and dividing the model to be processed based on the multiple first planes to obtain the first structure includes: Determine the longest line connecting the model to be processed along the first direction axis; Multiple subdivision points are set on the longest connecting line, and a first plane perpendicular to the first direction axis is set on each of the subdivision points to obtain the multiple first planes; The plurality of first planes are subjected to Boolean operations with the model to be processed to segment the model to be processed, thereby obtaining the first structure.
3. The method according to claim 2, characterized in that, The step of determining the longest connection line of the model to be processed on the first direction axis includes: Generate the minimum bounding box of the model to be processed; Determine the maximum and minimum coordinate positions of the minimum circumscribed cuboid on the first direction axis; The line connecting the maximum coordinate position and the minimum coordinate position is determined as the longest line connecting the model to be processed on the first direction axis.
4. The method according to claim 3, characterized in that, The step of setting multiple subdivision points on the longest connecting line and setting a first plane perpendicular to the first direction axis at each subdivision point to obtain the multiple first planes includes: Multiple subdivision points are evenly distributed along the longest connecting line; Multiple planes perpendicular to the first direction axis in the smallest circumscribed cuboid are copied, and the copied planes are assigned to the subdivision points to obtain a first plane perpendicular to the first direction axis set on each subdivision point.
5. The method according to claim 4, characterized in that, The step of copying multiple planes perpendicular to the first direction axis in the smallest circumscribed cuboid and assigning the copied planes to the subdivision points to obtain a first plane perpendicular to the first direction axis set at each subdivision point includes: Move the plane perpendicular to the first direction axis in the smallest circumscribed cuboid to the origin of the world coordinate system. The moved plane is copied and offset to the position of each of the subdivision points to obtain a first plane perpendicular to the first direction axis set at each of the subdivision points.
6. The method according to claim 2, characterized in that, The step of performing Boolean operations on the plurality of first planes and the model to be processed to segment the model to be processed and obtain the first structure includes: The multiple first planes are overlapped with the model to be processed to obtain the processing result; The first structure is determined based on the intersection of the first plane and the model to be processed in the processing result.
7. The method according to claim 6, characterized in that, The step of determining the first structure based on the intersection of the first plane and the model to be processed in the processing result includes: Based on a preset extrusion distance, a polygon extrusion operation is performed on the intersection of the first plane and the model to be processed in the processing result to obtain the first structure.
8. The method according to claim 1, characterized in that, The step of setting multiple second planes perpendicular to the second direction axis on the model to be processed, and dividing the model to be processed based on the multiple second planes to obtain the second structure includes: Determine the longest line connecting the models to be processed along the second direction axis; Multiple subdivision points are set on the longest connecting line, and a second plane perpendicular to the second direction axis is set on each of the subdivision points to obtain the multiple second planes; The multiple second planes are subjected to Boolean operations with the model to be processed to segment the model to be processed, thereby obtaining the second structure.
9. The method according to claim 1, characterized in that, The step of performing a Boolean operation between the first structure and the second structure to obtain the third structure includes: Perform an overlap operation on the first structure and the second structure to obtain the overlap result; The third structure is determined based on the intersection of the first and second structures in the overlapping results.
10. The method according to claim 9, characterized in that, The step of determining the third structure based on the intersection of the first and second structures in the overlap result includes: The intersection of the first structure and the second structure in the overlapping result is determined to include multiple individual models; Based on the side length control parameters, a circumscribed cuboid is set for each individual model to obtain the third structure.
11. The method according to claim 1, characterized in that, Before the step of setting multiple first planes perpendicular to the first direction axis on the model to be processed, and dividing the model to be processed based on the multiple first planes to obtain the first structure, the method further includes: Move the center position of the model to be processed to the center position in world coordinates; The moved model to be processed is converted into a closed polygon model, and the polygon model is then used to replace the model to be processed for subsequent steps.
12. A model generation apparatus, characterized in that, The device includes: The model acquisition module is used to acquire the model to be processed. The first segmentation module is used to set multiple first planes perpendicular to the first direction axis on the model to be processed, and to segment the model to be processed based on the multiple first planes to obtain a first structure; The second segmentation module is used to set multiple second planes perpendicular to the second direction axis on the model to be processed, and to segment the model to be processed based on the multiple second planes to obtain a second structure; wherein the second direction axis is at a preset angle to the first direction axis; The model generation module is used to generate a target model with a waffle structure based on the first structure and the second structure; The model generation module is further configured to: perform Boolean operations on the first structure and the second structure to obtain a third structure; perform a merging operation on the first structure and the second structure to obtain a fourth structure; and subtract the third structure from the fourth structure to obtain a target model with a waffle structure.
13. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the model generation method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the model generation method according to any one of claims 1 to 11.