Virtual line model generation method and device, program product and electronic equipment
By determining nodes on a virtual base model and generating lines through ray reflection, the problem of low efficiency in developing line wrapping effects is solved, and a virtual line model with efficient automatic generation and good wrapping effects is realized.
Patent Information
- Application Number
- CN202511087245.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2025-11-21
AI Technical Summary
In existing technologies, the development efficiency of line wrapping effects is low, and it consumes high manpower and time costs, resulting in a long development cycle.
By acquiring a virtual base model, determining the first node, and intersecting and reflecting a ray with the surface of the virtual base model to form a node group, connecting the nodes within the node group to generate initial lines, and then generating a virtual line model.
It enables the automatic generation of virtual line models, saving manpower and time costs, shortening the development cycle, and improving the expressiveness of line winding effects.
Smart Images

Figure CN120997390A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a virtual line model generation method and device, a program product and an electronic device. BACKGROUND
[0002] In digital art such as games and animations, sometimes the effect of line winding (for example, plant vines growing, braids, etc.) needs to be realized.
[0003] In the related art, a developer manually creates such an effect. For example, the developer needs to manually model the line according to a reference picture and adjust the model details. This way consumes high labor and time costs, resulting in a long development cycle and low efficiency. SUMMARY
[0004] The present disclosure provides a virtual line model generation method, device, program product and electronic device to at least partially solve the problem of low efficiency of manually creating line winding effects.
[0005] According to a first aspect of the present disclosure, a virtual line model generation method is provided, the method comprising: obtaining a virtual base model; determining one or more first nodes on the surface of the virtual base model; determining a ray with the first node as a starting point, intersecting the ray with the surface of the virtual base model and reflecting the ray one or more times, taking the intersection point of the ray with the virtual base model and the intersection point of the reflected ray with the virtual base model as second nodes to form a node group; each node group includes one first node and one or more corresponding second nodes; connecting the nodes in the same node group to form an initial line; and generating a virtual line model according to the initial line.
[0006] According to a second aspect of the present disclosure, a virtual line model generation device is provided, the device comprising: a model obtaining module configured to obtain a virtual base model; a first node determining module configured to determine one or more first nodes on the surface of the virtual base model; a second node determining module configured to determine a ray with the first node as a starting point, intersect the ray with the surface of the virtual base model and reflect the ray one or more times, take the intersection point of the ray with the virtual base model and the intersection point of the reflected ray with the virtual base model as second nodes to form a node group; each node group includes one first node and one or more corresponding second nodes; an initial line forming module configured to connect the nodes in the same node group to form an initial line; and a model generating module configured to generate a virtual line model according to the initial line.
[0007] According to a third aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method of the first aspect above and possible implementation manners thereof.
[0008] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the method of the first aspect above and possible implementation manners thereof via execution of the executable instructions.
[0009] The technical solution of the present disclosure has the following beneficial effects:
[0010] After obtaining the virtual base model, the first nodes are determined based on the surface of the virtual base model, and the second nodes are derived through the way of ray intersection and reflection, and the initial lines are formed by connecting these nodes, and then the virtual line model is generated according to the initial lines. On the one hand, a scheme for automatically generating a virtual line model and realizing a line winding effect is provided, and the developer does not need to manually model the line model, which saves the labor and time cost, shortens the development cycle, and improves the efficiency. On the other hand, the first nodes and the second nodes are located on the trajectory of the ray intersecting and reflecting the surface of the virtual base model, and the nodes in each node group form a distribution state surrounding the virtual base model as a whole, and the initial lines and the virtual line model formed thereby have a good winding effect, which increases the expressiveness of the virtual line model. BRIEF DESCRIPTION OF DRAWINGS
[0011] Figure 1 A flowchart of a virtual line model generation method in an embodiment of the present disclosure is shown;
[0012] Figure 2 A schematic diagram of a virtual base model in an embodiment of the present disclosure is shown;
[0013] Figure 3 A schematic diagram of a first node in an embodiment of the present disclosure is shown;
[0014] Figure 4 A flowchart of determining a ray in an embodiment of the present disclosure is shown;
[0015] Figure 5 A visualization effect schematic diagram of a normal vector corresponding to a first node in an embodiment of the present disclosure is shown;
[0016] Figure 6 A visualization effect schematic diagram of a random initial vector in an embodiment of the present disclosure is shown;
[0017] Figure 7 A schematic diagram of determining a second node in an embodiment of the present disclosure is shown;
[0018] Figure 8 A schematic diagram showing a first node and a second node in an embodiment of the present disclosure;
[0019] Figure 9 A schematic diagram showing an initial line in an embodiment of the present disclosure;
[0020] Figure 10 A schematic diagram showing a smooth line in an embodiment of the present disclosure;
[0021] Figure 11 A schematic diagram showing generation of a fifth node in an embodiment of the present disclosure;
[0022] Figure 12 A schematic diagram showing a virtual line model in an embodiment of the present disclosure;
[0023] Figure 13 A schematic diagram showing display effects of a virtual line model at different moments in an animation playing period in an embodiment of the present disclosure;
[0024] Figure 14 A schematic diagram showing a structure of a virtual line model generation apparatus in an embodiment of the present disclosure;
[0025] Figure 15 A schematic diagram showing a structure of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] Example embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings.
[0027] The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this application, illustrate certain non-limiting embodiments of the present disclosure. In the drawings, some embodiments are shown in schematic form that can not be drawn to scale. Some of the block components shown in the drawings can be functional blocks that can not necessarily correspond to physical or logical independent entities. These functional blocks can be implemented in software, or in hardware modules or integrated circuits, or in networks, processors or microcontrollers. The embodiments can be implemented in various forms and should not be construed as being limited to the examples set forth herein. The features, structures or characteristics described in the present disclosure can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present disclosure. One skilled in the relevant art will recognize, however, that the various embodiments of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc.
[0028] An embodiment of the present disclosure provides a virtual line model generation method. Figure 1An exemplary flow of the method is shown, including the following steps:
[0029] Step S110: Obtain the virtual base model;
[0030] Step S120: Determine one or more first nodes on the surface of the virtual base model;
[0031] Step S130: Determine the ray originating from the first node, intersect the ray with the surface of the virtual base model and reflect it once or multiple times, and use the intersection of the ray with the virtual base model and the intersection of the reflected ray with the virtual base model as the second node to form a node group; each node group includes a first node and one or more corresponding second nodes.
[0032] Step S140: Connect the nodes within the same node group to form the initial lines;
[0033] Step S150: Generate a virtual line model based on the initial lines.
[0034] based on Figure 1 This method involves obtaining a virtual base model, determining the first node based on the surface of the virtual base model, and deriving the second node through ray intersection and reflection. Connecting these nodes forms initial lines, which are then used to generate a virtual line model. On one hand, this provides a solution for automatically generating virtual line models and achieving a line-wrapping effect, eliminating the need for developers to manually model the line model, saving manpower and time costs, shortening the development cycle, and improving efficiency. On the other hand, the first and second nodes are located on the trajectory where rays intersect and reflect off the surface of the virtual base model. The nodes within each node group form a distribution surrounding the virtual base model, resulting in initial lines and virtual line models with a good wrapping effect, increasing the expressiveness of the virtual line model.
[0035] The following is about Figure 1 Each step is explained in detail.
[0036] refer to Figure 1 In step S110, the virtual base model is obtained.
[0037] The virtual base model provides fundamental information for the generation of the virtual line model. For example, in this embodiment, the first node and the second node are line nodes, both located on the surface of the virtual base model; that is, the virtual base model provides basic positional information for the line nodes. Any virtual model can be used as the virtual base model. Figure 2A schematic diagram of a virtual base model is shown. In order to generate a virtual line model with stereoscopic effect in a three-dimensional scene, a three-dimensional virtual model can be used as the virtual base model.
[0038] In an embodiment, in order to finally achieve the effect that the object is wrapped by the line, the object model to be wrapped can be used as the virtual base model.
[0039] With reference to the foregoing description, the virtual base model can be a three-dimensional virtual model. Figure 1 In step S120, one or more first nodes are determined on the surface of the virtual base model.
[0040] The first nodes are initially determined line nodes. The first nodes are located on the surface of the virtual base model. The disclosure does not limit the specific manner of determining the first nodes. For example, a certain number of points can be randomly determined on the surface of the virtual base model as the first nodes. Alternatively, the surface of the virtual base model can be divided into surface units, which can be two-dimensional units such as triangular patches and quadrilateral patches, and the vertices of the surface units can be used as the first nodes.
[0041] In an embodiment, the above-mentioned step of determining one or more first nodes on the surface of the virtual base model comprises the following steps:
[0042] The area of each surface unit on the surface of the virtual base model is determined, and the number of nodes corresponding to each surface unit is determined according to the area of each surface unit.
[0043] The first nodes are determined in each surface unit according to the number of nodes corresponding to each surface unit.
[0044] The surface units can be the original constituent units of the surface of the virtual base model. For example, if a triangular patch is used to create the virtual base model, the surface of the virtual base model is composed of triangular patches, and the triangular patches are the surface units. Alternatively, the surface of the virtual base model can be divided to obtain the surface units. For example, each face of the virtual base model can be divided into a plurality of triangles, and each triangle is a surface unit.
[0045] The area of each surface unit is determined. For example, the positions of three vertices of each surface unit can be obtained, and the area of the surface unit is calculated according to the positions of the three vertices. The number of nodes corresponding to the surface unit is determined according to the area of the surface unit, which represents the number of first nodes to be determined in each surface unit. The relationship between the number of nodes and the area of the surface unit can be preset, such as a linear positive function relationship, and the number of nodes corresponding to the area of the surface unit is calculated based on the relationship.
[0046] In an embodiment, the above-mentioned step of determining the number of nodes corresponding to each surface unit according to the area of each surface unit comprises the following steps:
[0047] Determine the ratio of the area of each face unit to the surface area of the virtual base model, and determine the number of nodes corresponding to each face unit based on the product of the ratio and the preset total number of nodes.
[0048] The surface area of the virtual base model can be the sum of the areas of all surface units, denoted as TotalArea. (Using Face...) i Let Area represent any face element whose area is denoted as Area. i Calculate the ratio W = Area of the area of the surface unit to the surface area of the virtual base model. i / TotalArea. The preset total number of nodes represents the total number of nodes in the first area. This can be set by the user or automatically determined by the system based on factors such as the size of the virtual base model. Let TotalCount represent the preset total number of nodes. Calculate the product of the above ratio and the preset total number of nodes: E = W × TotalCount. The Face is determined based on this product. i The corresponding number of nodes: base_points i Specifically, E can be rounded, such as rounding up, rounding down, or rounding to the nearest integer, and the rounded result can be used as the base_points. i For example, the integer and fractional parts of E are separated; if the fractional part is less than a preset threshold, the integer part is used as the base_points. i If the decimal part is greater than a preset threshold, then the integer part is incremented by one and used as the base_points. i .
[0049] The number of nodes corresponding to each surface element is determined by the above method, so that the number of nodes is proportional to the area of the surface element. This ensures that the first node can be distributed relatively evenly in various areas on the surface of the virtual base model.
[0050] Confirm Face i The corresponding number of nodes: base_points i Later, on Face i Internally determine base_points i The first node. For example, it can be found on Face. i randomize base_points i The first node, or based on Face i The base points are calculated to be uniformly distributed based on the center point location. i The first node.
[0051] In one implementation, generating the first node in each face cell according to the number of nodes corresponding to each face cell includes the following steps:
[0052] With the center point of the surface unit and the edge line of the surface unit as the division line, the surface unit is divided into sub-units according to the number of nodes corresponding to the surface unit, and the center point of each sub-unit is taken as the first node.
[0053] For example, the angle is calculated as 360° / base_points i The center point of Face i is taken as an end point, and a conical region with an opening of 360° / base_points i is generated, so that / base_points i conical regions can be generated along a circle of the center point, the boundary of each conical region is extended to the edge of Face i to form a division line, and Face i is divided into base_points i sub-units. The center point of each sub-unit is taken as a first node to obtain base_points i first nodes in Face i . In this way, the first nodes can be uniformly distributed in each surface unit.
[0054] In the above manner, a plurality of first nodes are determined on the surface of the virtual base model Figure 2 . The distribution of the first nodes can refer to Figure 3 , and it can be seen that the first nodes are uniformly distributed in each region on the surface of the virtual base model.
[0055] Continuing to refer to Figure 1 , in step S130, a ray is determined with the first node as the starting point, the ray intersects the surface of the virtual base model and is reflected one or more times, and the intersection point of the ray and the virtual base model and the intersection point of the reflected ray and the virtual base model are taken as second nodes to form a node group; each node group includes one first node and one or more corresponding second nodes.
[0056] The direction of the ray can be set to point to the inside of the virtual base model, and the direction of the ray is randomly determined from the first node within the range. The ray extends along its direction and intersects with the surface of the virtual base model, and then the ray is reflected according to the shape at the intersection point. The reflected ray intersects with the surface of the virtual base model again and can be reflected again. The second node derived from the first node is obtained by the intersection and reflection of the ray with the surface of the virtual base model. The second node derived from the same first node and the first node form a node group. In an embodiment, the first node can be assigned a node number, and by performing step S130, one or more second nodes corresponding to each first node are obtained. The second node is assigned the same node number as the corresponding first node, and the first node and the second node with the same node number form a node group.
[0057] In an embodiment, referring to FIG. 1, the determination of the ray starting from the first node includes steps S410 and S420: Figure 4
[0058] Step S410, generating a random initial vector with the first node as an end point.
[0059] The starting point or the end point of the random initial vector is the first node. The random initial vector can be a unit vector, and its direction can be randomly determined.
[0060] In an embodiment, the above-mentioned generation of the random initial vector with the first node as an end point includes the following steps:
[0061] Generating a first random number and a second random number according to the node number of the first node;
[0062] Determining an azimuth angle according to the first random number and a polar angle according to the second random number and a preset angle;
[0063] Determining a random spherical vector based on the azimuth angle and the polar angle;
[0064] Adding the random spherical vector and the normal vector corresponding to the first node to obtain the random initial vector.
[0065] The preset angle represents the opening angle of the conical range (such as the cone angle), which is the range for determining the random spherical vector. It can be understood that the conical range is determined according to the preset angle, the azimuth angle and the polar angle are randomly determined within the conical range, and the random spherical vector is determined accordingly. The preset angle can be set by the user or automatically determined by the system, denoted as α, which can be a value within the range of 0-360°. In addition, different preset angles can be set for different first nodes.
[0066] The normal vector corresponding to the first node can be obtained based on the virtual base model. The normal vector can point to the outside or inside of the virtual base model, and the disclosure does not limit this. Figure 5 Visualization of the normal vector corresponding to the first node is shown.
[0067] Let the first node j represent any first node, and its node number be denoted as ptnum j , and its corresponding normal vector be denoted as N j . The first random number u j and the second random number v j are generated according to the following formula:
[0068] float u j = rand(@ptnum j ); (1)
[0069] float v j = rand(@ptnum j + diff); (2)
[0070] Where diff is an offset value, which can be set according to experience or specific business requirements, and its role is to make the values of u j and v j different.
[0071] Then, the azimuth angle φ j and the polar angle θ j are calculated according to the following formula:
[0072] float φ j = 2π × u j ; (3)
[0073] float θ j = acos(1 - (1 - cosα) × v j ); (4)
[0074] Next, based on the azimuth angle φ j and the polar angle θ j , the random spherical vector dir j is determined, which can be a unit vector, as follows:
[0075] vector dir j = set(sinθ j × cosφ j , sinθ j × sinφ j , cosθ j ); (5)
[0076] wherein, according to the azimuth angle φ j and the polar angle θ j a vector in polar coordinates can be determined, which is converted to a Cartesian coordinate system to obtain a random spherical vector dir j .
[0077] Finally, the random spherical vector dir j is added to the normal vector N j to obtain a random initial vector random_n j :
[0078] random_n j = dir j + N j ; (6)
[0079] Figure 6 The visualization of the random initial vector is shown, and by comparing with Figure 6 and Figure 5 it can be seen that for each first node, a random initial vector is generated beside the normal vector of the first node, which takes the first node as a segment.
[0080] Step S420 reflects the random initial vector based on the normal vector corresponding to the first node as the reflection axis, and determines the ray based on the direction after reflection.
[0081] Exemplarily, the vector after reflection is denoted as R j1 , and the following formula is referred to:
[0082] R j1 = reflect (random_n j , N j ) ; (7)
[0083] A ray is formed in the direction of R j1 with ptnum j as the starting point.
[0084] In an embodiment, the above-mentioned intersection of the ray with the surface of the virtual base model and one or more reflections are performed, and the intersection point of the ray with the virtual base model and the intersection point of the reflected ray with the virtual base model are taken as the second node, including the following steps:
[0085] The ray is intersected with the surface of the virtual base model, and the intersection point is taken as the second node;
[0086] The normal vector corresponding to the second node at the intersection is taken as the reflection axis, the ray is reflected, and the intersection point of the reflected ray with the surface of the virtual base model is taken as the second node.
[0087] The step of reflecting the ray and taking the intersection of the reflected ray and the surface of the virtual base model as the second node can be performed in a loop. For example, the user can set the number of loops M, or set the number of second nodes corresponding to each first node as M. When the step is performed in a loop for M times, or M first nodes are determined, the loop is stopped. Based on the way the ray intersects the surface of the virtual base model and is reflected, any number of second nodes can be determined.
[0088] The first node ptnum j Each determined second node is assigned a node number ptnum j The first node and the second node with the same node number form a node group. The nodes in each node group form a distribution state that surrounds the virtual base model as a whole, facilitating the formation of a better line winding effect in the subsequent steps.
[0089] Figure 7 A schematic diagram of determining the second node by the way the ray intersects the surface of the virtual base model and is reflected is shown from the perspective of a planar projection. A random initial vector with the first node as an endpoint is reflected along the normal to form a ray. The camera intersects the surface of the virtual base model to determine the second node. Then, the normal at the intersection is taken as the reflection axis to perform reflection again, and the surface of the virtual base model is intersected again. After multiple intersections and reflections, multiple second nodes are determined.
[0090] In the above manner, a large number of second nodes can be derived from the first node. Figure 8 A schematic diagram of the first node and the second node is shown, and Figure 3 Compared with the prior art, the number and density of nodes are greatly increased, which is conducive to the subsequent generation of a high-quality virtual line model.
[0091] With reference to Figure 1 In step S140, the nodes in the same node group are connected to form an initial line.
[0092] In one embodiment, a straight line or a curve can be used for connection. In one embodiment, the nodes in the same node group can be connected along the surface of the virtual base model, so that the connection line between any two nodes is on the surface of the virtual base model.
[0093] In one embodiment, any two nodes in the same node group can be connected.
[0094] In one embodiment, the above step of connecting the nodes in the same node group to form an initial line includes the following steps:
[0095] In the same node group, each node is sequentially connected to the nearest unconnected node to form an initial line.
[0096] For example, a node group includes node 1, node 2, node 3, node 4, and node 5. Node 1 is taken as a node to be processed, and the distance between node 1 and node 2 is determined to be the shortest. Node 1 and node 2 are connected. Then node 2 is taken as a node to be processed. Among the unconnected nodes, the distance between node 2 and node 5 is determined to be the shortest. Node 2 and node 5 are connected. Then node 5 or node 3 is taken as a node to be processed. If node 5 is taken as a node to be processed, among the unconnected nodes, the distance between node 5 and node 4 is determined to be the shortest. Node 5 and node 4 are connected. Finally, node 4 is taken as a node to be processed, and node 4 and node 3 are connected. In this way, the initial line has a good winding effect.
[0097] In an embodiment, the nodes in the same node group can be connected in a determined order to form an initial line. For example, in a node group, the determined order of a first node is the earliest, the second node determined by the intersection of the ray emitted by the first node and the surface of the virtual base model is the second, and the second node determined by the intersection of the reflected ray of the ray and the surface of the virtual base model is the third. The nodes in the same node group are connected in order from early to late according to the determined order to form an initial line. The initial line can also have a good winding effect.
[0098] In an embodiment, the starting point and the ending point of the initial line can be set. For example, according to the above connection order, the node in the early order is taken as the starting point, and the node in the late order is taken as the ending point.
[0099] In Figure 8 Based on the first node and the second node shown in the figure, a large number of initial lines can be formed by connecting the nodes in the same node group, Figure 9 A schematic diagram of the initial line is shown.
[0100] With reference to Figure 1 In step S150, a virtual line model is generated according to the initial line.
[0101] In the initial line, the thickness of the initial line is 0, that is, the cross-sectional radius of the initial line is 0. A model with a certain thickness can be generated based on the initial line. For example, each point on the initial line is converted into a circle with a certain radius and perpendicular to the initial line, and a three-dimensional virtual model with a cross-sectional radius of 0 is obtained. The model can also be given a texture, material, etc., to form a virtual line model.
[0102] In an embodiment, the above-mentioned generation of a virtual line model according to the initial line includes the following steps:
[0103] A plurality of third nodes are determined on the initial line;
[0104] For each third node, a position of a neighboring third node is weighted to update the position of the third node;
[0105] Based on the updated position of the third node, a smoothed line is generated;
[0106] A virtual line model is generated according to the smoothed line.
[0107] The third node can be a point determined by sampling on the initial line. For example, the initial line can be evenly divided into X segments, and X can be set according to experience or specific business requirements, such as a value in the range of 50-100. The endpoints of each segment are taken as the third nodes. In addition, the starting point and the ending point of the initial line can also be taken as the third nodes.
[0108] For each third node, the positions of the neighboring third nodes are obtained. Exemplarily, the neighboring third nodes can include a certain number of third nodes closest to the third node (the number can be set according to experience or specific business requirements), or third nodes within a certain range (such as a 6*6 range centered on the third node) determined based on the third node, etc. It should be noted that the neighboring third nodes can include third nodes on the same initial line, and can also include third nodes on other initial lines. The same weight can be set for each neighboring third node, so that the positions of the neighboring third nodes are weighted, which is equivalent to calculating the center point of the neighboring third nodes. Alternatively, the weight is determined according to the distance between each neighboring third node and the third node, and the weight is negatively related to the distance, such as the weight obtained by normalizing the inverse of the distance. The positions of the neighboring third nodes are weighted according to the weight. The updated position of the third node is the weighted position. By updating the position of the third node, the initial line is moved to obtain the smoothed line.
[0109] In Figure 9 Based on the initial line shown in FIG. 1, the positions of the third nodes are updated to generate a smoothed line, Figure 10 FIG. 2 shows a schematic diagram of the smoothed line. Compared with the initial line, the smoothed line is closer to a curve, and is more smooth and beautiful as a whole. Further, a virtual line model can be generated according to the smoothed line, which can improve the quality of the virtual line model.
[0110] In an embodiment, the virtual line model is generated according to the smoothed line, including the following steps:
[0111] A plurality of fourth nodes are determined on the smoothed line, and a radius corresponding to each fourth node is determined;
[0112] A fifth node is generated around the smoothed line with each fourth node as the center and according to the radius corresponding to the fourth node;
[0113] Connect the fifth nodes to form a virtual line model.
[0114] The fourth node is used to give a certain radius to the smooth line, so that it changes from a line to a three-dimensional virtual model. The third node described above can be used as the fourth node, or the fourth node can be resampled on the smooth line. The radius corresponding to the fourth node represents the thickness of the virtual line model at the fourth node. In order to make the virtual line model beautiful, the radius corresponding to the fourth node can have a certain smoothness. In an embodiment, the radius corresponding to the fourth node is determined according to the distance between the fourth node and the end point of the smooth line, and the radius and the distance are positively correlated. For example, the distance can be used as the radius, or the distance multiplied by a certain coefficient can be used as the radius.
[0115] At each fourth node, a circle of fifth nodes is generated according to the corresponding radius, that is, the distance between the fifth node and the fourth node is equal to the radius. The circle of fifth nodes corresponding to each fourth node can form a circle around the smooth line, and the cross section of the circle can be perpendicular to the smooth line. Figure 11 A schematic diagram of generating fifth nodes around a smooth line is shown.
[0116] Connect the fifth nodes, such as connecting each circle of fifth nodes in turn to form a circle of circles, and then connect the circles to form a continuous surface, which is equivalent to converting the smooth line into a virtual line model with a certain thickness. Figure 12 A schematic diagram of a virtual line model generated based on a smooth line is shown. The virtual line model has a change in thickness and presents a strong sense of reality.
[0117] In an embodiment, the virtual line model generation method further includes the following steps:
[0118] Setting display control parameters for different parts of the virtual line model, the display control parameters being configured to gradually decrease from the start point to the end point of the virtual line model;
[0119] During the animation playing period, determine the display threshold according to the current time progress, and control the display of the part of the virtual line model whose display control parameter is not less than the display threshold; the display threshold and the current time progress are negatively correlated.
[0120] The virtual line model can be divided into different parts based on the third node or the fourth node as a division point. For example, the area between two adjacent fourth nodes is a part, which can be regarded as a line element or a volume element. In addition, the virtual line model can be divided based on other manners, such as setting a division precision (which can be a number indicating how many parts a virtual line model is divided into), and dividing the virtual line model according to the division precision. The system can control the display of each part separately. It should be noted that the more fine the virtual line model is divided, the smaller each part is, and the better the dynamic effect is when playing the line animation, but the more calculation is required. Therefore, the division precision can be set according to experience or specific business requirements.
[0121] The display control parameter is a quantization parameter used to determine whether to display each part, denoted as U. The display control parameters of the parts gradually decrease in order from the starting point to the ending point of the virtual line model. For example, the display control parameter is determined according to the distance between each part and the ending point of the virtual line model, and the display control parameter is positively correlated with the distance, that is, the closer to the starting point, the larger the display control parameter, and the closer to the ending point, the smaller the display control parameter. For example, U = PL / L, where PL represents the distance between each part and the ending point of the virtual line model, and L represents the total length of the virtual line model.
[0122] The dynamic effect animation of the virtual line model can be realized according to the embodiments of the present disclosure, and the animation playing time period refers to the playing time period of the animation. For example, a 1-second animation can be set, and the animation playing time period is 0-1 second. The display threshold is determined according to the current time progress, and the display threshold is negatively correlated with the current time progress. For example, 1-time is used as the display threshold, and time represents the current time progress. The display threshold gradually decreases as the animation playing process proceeds. In this process, the parts of the virtual line model with a display control parameter not less than the display threshold (i.e., U≥1-time) are displayed, and the parts with a display control parameter less than the display threshold (i.e., U<1-time) are not displayed. Figure 13 The display effect of the virtual line model at different times in the animation playing time period is shown. When the animation is just started, only the part of the starting point of the virtual line model is displayed due to the large display threshold, and more and more parts are displayed as the animation is played, and finally the complete virtual line model is displayed. Thus, the effect of gradually generating and spreading of the line is presented.
[0123] The embodiments of the present disclosure also provide a virtual line model generation device. Referring to FIG. 14, Figure 14 As shown in the figure, the virtual line model generation device 1400 includes the following modules:
[0124] The model acquisition module 1410 is configured to acquire a virtual base model;
[0125] The first node determination module 1420 is configured to determine one or more first nodes on the surface of the virtual base model;
[0126] The second node determination module 1430 is configured to determine a ray with the first node as a starting point, intersect the ray with the surface of the virtual base model and reflect the ray one or more times, and form a node group with the intersection point of the ray with the virtual base model and the intersection point of the reflected ray with the virtual base model as second nodes; each node group includes one first node and one or more corresponding second nodes;
[0127] The initial line formation module 1440 is configured to connect the nodes in the same node group to form an initial line;
[0128] The model generation module 1450 is configured to generate a virtual line model according to the initial line.
[0129] In an embodiment, the determination of one or more first nodes on the surface of the virtual base model includes:
[0130] Determining the area of each face element on the surface of the virtual base model, and determining the number of nodes corresponding to each face element according to the area of each face element;
[0131] Determining the first nodes in each face element according to the number of nodes corresponding to each face element.
[0132] In an embodiment, the determination of the number of nodes corresponding to each face element according to the area of each face element includes:
[0133] Determining the proportion of the area of each face element to the surface area of the virtual base model, and determining the number of nodes corresponding to each face element according to the product of the proportion and a preset total number of nodes.
[0134] In an embodiment, the determination of the first nodes in each face element according to the number of nodes corresponding to each face element includes:
[0135] Dividing the face element into sub-elements according to the number of nodes corresponding to the face element with the center point of the face element and the edge of the face element as a division line, and taking the center point of each sub-element as the first node.
[0136] In an embodiment, the determination of the ray with the first node as a starting point includes:
[0137] Generating a random initial vector with the first node as an end point;
[0138] reflect the random initial vector based on a normal vector corresponding to the first node as a reflection axis, and determine the ray based on a direction after the reflection.
[0139] In an embodiment, the generating a random initial vector with the first node as an end point comprises:
[0140] generating a first random number and a second random number according to a node number of the first node;
[0141] determining an azimuth angle according to the first random number and determining a polar angle according to the second random number and a preset angle;
[0142] determining a random spherical vector based on the azimuth angle and the polar angle;
[0143] adding the random spherical vector and a normal vector corresponding to the first node to obtain the random initial vector.
[0144] In an embodiment, the intersecting the ray with a surface of the virtual base model and reflecting the ray one or more times, taking an intersection point of the ray with the virtual base model and an intersection point of the reflected ray with the virtual base model as a second node comprises:
[0145] intersecting the ray with the surface of the virtual base model and taking the intersection point as the second node;
[0146] reflecting the ray based on a normal vector corresponding to the second node at the intersection, and taking an intersection point of the reflected ray with the surface of the virtual base model as the second node.
[0147] In an embodiment, the connecting nodes in the same node group to form an initial line comprises:
[0148] sequentially connecting each node in the same node group with a nearest unconnected node to form the initial line.
[0149] In an embodiment, the generating a virtual line model according to the initial line comprises:
[0150] determining a plurality of third nodes on the initial line;
[0151] for each third node, updating a position of the third node by weighting positions of adjacent third nodes;
[0152] generating a smooth line based on the updated positions of the third nodes;
[0153] generating a virtual line model according to the smooth line.
[0154] In an embodiment, the generating the virtual line model according to the smooth line comprises:
[0155] determining a plurality of fourth nodes on the smooth line, and determining a radius corresponding to each fourth node;
[0156] generating a fifth node around the smooth line with each fourth node as a center and according to the radius corresponding to the fourth node;
[0157] connecting the fifth nodes to form the virtual line model.
[0158] In an embodiment, the determining the radius corresponding to each fourth node comprises:
[0159] determining the radius corresponding to each fourth node according to a distance between the fourth node and an end point of the smooth line; the radius and the distance are positively correlated.
[0160] In an embodiment, the apparatus is further configured to:
[0161] setting a display control parameter of different parts of the virtual line model, the display control parameter being configured to gradually decrease from a start point to an end point of the virtual line model;
[0162] determining a display threshold according to a current time progress in an animation playing time period, and controlling to display a part of the virtual line model whose display control parameter is not less than the display threshold; the display threshold and the current time progress are negatively correlated.
[0163] The specific details of each part of the above apparatus have been described in detail in the method embodiments, and the undisclosed details can be referred to the embodiment contents of the method part, thus no further description is given.
[0164] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, such division is not mandatory. In fact, according to the example embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into embodied by multiple modules or units.
[0165] The example embodiments of the present disclosure also provide a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the above method.
[0166] In an embodiment, the computer program product can be a tangible product, such as a computer-readable storage medium storing the computer program. The computer-readable storage medium can be based on electrical, magnetic, optical, electromagnetic, infrared, or any other type of signals capable of being stored on a computer-readable storage medium, including but not limited to random access memory (RAM), read-only memory (ROM), tapes, floppy disks, flash memories, hard disks (HDDs), solid-state drives (SSDs), and the like. For example, the computer program product can be a non-volatile storage medium, such as a read-only memory (ROM), a Nand Flash, or the like, storing the computer program.
[0167] In an embodiment, the computer program product can be an intangible product. For example, the computer program product can be a virtual digital product, such as an executable file or an installation package containing the computer program.
[0168] The code of the computer program can be written in one or more programming languages. The programming language can be, for example, C, Java, C++, or the like. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, such as a local area network (LAN), a wide area network (WAN), or the like, or can be connected to an external computing device (for example, through an Internet connection provided by an operator).
[0169] The computer program can be carried or transmitted by electrical, magnetic, optical, electromagnetic, infrared, or the like signals. The electronic device can convert the signals carrying the computer program into digital signals, and then run the computer program. When the computer program is running on the electronic device, its code is used to make the electronic device perform (more specifically, can make the processor of the electronic device perform) the method steps of various embodiments of the present disclosure, for example: step S110, obtaining a virtual base model; step S120, determining one or more first nodes on the surface of the virtual base model; step S130, determining a ray starting from the first node, intersecting the surface of the virtual base model and reflecting one or more times, taking the intersection point of the ray and the virtual base model and the intersection point of the reflected ray and the virtual base model as the second node, and forming a node group; each node group includes one first node and one or more corresponding second nodes; step S140, connecting the nodes in the same node group to form an initial line; step S150, generating a virtual line model according to the initial line.
[0170] The above method steps are implemented by a computer program. After obtaining the virtual base model, the first nodes are determined based on the surface of the virtual base model, and the second nodes are derived by means of ray intersection and reflection, the initial lines are formed by connecting the nodes, and then the virtual line model is generated according to the initial lines. On the one hand, a scheme for automatically generating a virtual line model and realizing a line winding effect is provided, and a developer does not need to manually model the line model, thereby saving the labor and time cost, shortening the development cycle, and improving the efficiency. On the other hand, the first nodes and the second nodes are located on the trajectory of the ray intersection and reflection with the surface of the virtual base model, and the nodes in each node group form a distributed state surrounding the virtual base model as a whole, so that the initial lines and the virtual line model formed thereby have a good winding effect, and the expressiveness of the virtual line model is increased.
[0171] Exemplary embodiments of the present disclosure also provide an electronic device. The electronic device can include a processor and a memory. The memory stores executable instructions of the processor, such as a computer program. The processor executes the method steps of various exemplary embodiments of the present disclosure by executing the executable instructions.
[0172] The following refers to Figure 15 The electronic device is exemplarily illustrated in the form of a general computing device. It should be understood that Figure 15 The electronic device 1500 shown is merely an example, and should not limit the functions and use range of the embodiments of the present disclosure.
[0173] As Figure 15 shown, the electronic device 1500 can include a processor 1510, a memory 1520, a bus 1530, an I / O (input / output) interface 1540, and a network adapter 1550.
[0174] The memory 1520 can include a volatile memory, such as a RAM 1521, a cache unit 1522, and a non-volatile memory, such as a ROM 1523. The memory 1520 can further include one or more program modules 1524, such as an operating system, one or more application programs, other program modules, and program data, each of which or some combination of which can include implementation of a network environment. For example, the program modules 1524 can include the modules in the above-described apparatus.
[0175] The processor 1510 can include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, an encoder, a decoder, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc.
[0176] The processor 1510 can be configured to execute executable instructions stored in the memory 1520 to perform the method steps of various embodiments of the present disclosure, such as: step S110, obtaining a virtual base model; step S120, determining one or more first nodes on the surface of the virtual base model; step S130, determining a ray starting from the first node, and the ray intersects the surface of the virtual base model and reflects one or more times, taking the intersection point of the ray and the virtual base model and the intersection point of the reflected ray and the virtual base model as the second node, to form a node group; each node group includes one first node and one or more corresponding second nodes; step S140, connecting the nodes in the same node group to form an initial line; and step S150, generating a virtual line model according to the initial line.
[0177] By executing the above method steps through the processor 1510, after obtaining the virtual base model, the first node is determined based on the surface of the virtual base model, and the second node is derived through the ray intersection and reflection, the initial line is formed by connecting these nodes, and then the virtual line model is generated according to the initial line. On the one hand, a scheme for automatically generating a virtual line model and realizing a line winding effect is provided, without the need for a developer to manually model the line model, saving manpower and time costs, shortening the development cycle, and improving efficiency. On the other hand, the first node and the second node are located on the trajectory of the ray intersecting and reflecting with the surface of the virtual base model, and the nodes in each node group form a distribution state that surrounds the virtual base model as a whole, so that the initial line and the virtual line model formed thereby have a good winding effect, increasing the expressiveness of the virtual line model.
[0178] The bus 1530 is configured to realize the connection between different components of the electronic device 1500, and can include a data bus, an address bus, and a control bus.
[0179] The electronic device 1500 can communicate with one or more external devices 1600 (such as a keyboard, a mouse, an external controller, etc.) through the I / O interface 1540.
[0180] The electronic device 1500 can communicate with one or more networks through the network adapter 1550, for example, the network adapter 1550 can provide a mobile communication solution such as 3G / 4G / 5G, or provide a wireless communication solution such as a wireless local area network, Bluetooth, near field communication, etc. The network adapter 1550 can communicate with other modules of the electronic device 1500 through the bus 1530.
[0181] Although Figure 15 Other hardware and / or software modules can also be provided in the electronic device 1500, including but not limited to: a display, microcode, device drivers, redundant processors, external disk drive arrays, RAID (Redundant Arrays of Independent Disks) systems, tape drives, and data backup storage systems, etc., which are not shown in the electronic device 1500.
[0182] As can be seen from the above, the technical solutions of the present disclosure can be implemented as methods, devices, systems, computer program products, storage media, electronic devices, etc. Those skilled in the art can understand that various aspects of the present disclosure can be implemented in the following forms: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, such as can be referred to as "circuitry", "modules" or "systems", respectively.
[0183] It should be understood that the present disclosure is not limited to the specific method steps or structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. Those skilled in the art, based on the specific embodiments provided by the present disclosure, will easily think of other embodiments. Therefore, the specific embodiments provided by the present disclosure are only exemplary, the scope and spirit of the present disclosure are indicated by the claims, and should cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure, and include common knowledge or conventional technical means in the technical field of the present disclosure that are not disclosed by the present disclosure.
Claims
1. A method of generating a virtual line model, characterized by, The method comprises: acquiring a virtual base model; determining one or more first nodes on the surface of the virtual base model; determining a ray with the first node as a starting point, intersecting the ray with the surface of the virtual base model and reflecting the ray one or more times, taking the intersection of the ray with the virtual base model and the intersection of the reflected ray with the virtual base model as second nodes to form a node group; each node group comprises one first node and one or more corresponding second nodes; connecting the nodes in the same node group to form an initial line; generating a virtual line model according to the initial line.
2. The method of claim 1, wherein, The method comprises: determining the area of each face element on the surface of the virtual base model, and determining the number of nodes corresponding to each face element according to the area of each face element; determining the first nodes in each face element according to the number of nodes corresponding to each face element.
3. The method of claim 2, wherein, The method comprises: determining the proportion of the area of each face element to the surface area of the virtual base model, and determining the number of nodes corresponding to each face element according to the product of the proportion and a preset total number of nodes.
4. The method of claim 2, wherein, The method comprises: taking the center point of the face element and the edge of the face element as a dividing line, and dividing the face element into sub-elements according to the number of nodes corresponding to the face element, and taking the center point of each sub-element as the first node.
5. The method of claim 1, wherein, The method comprises: generating a random initial vector with the first node as an end point; reflecting the random initial vector with the normal vector corresponding to the first node as a reflection axis, and determining the ray based on the reflected direction.
6. The method of claim 5, wherein, The method comprises: generating a first random number and a second random number according to the node number of the first node; determining an azimuth angle according to the first random number, and determining a polar angle according to the second random number and a preset angle; determining a random spherical vector based on the azimuth angle and the polar angle; adding the random spherical vector and the normal vector corresponding to the first node to obtain the random initial vector.
7. The method of claim 1, wherein, The method comprises: intersecting the ray with the surface of the virtual base model to take the intersection point as a second node; reflecting the ray with the normal vector corresponding to the second node at the intersection as a reflection axis, and taking the intersection of the reflected ray with the surface of the virtual base model as a second node.
8. The method of claim 1, wherein, The method comprises: connecting each node in the same node group to the nearest unconnected node to form an initial line.
9. The method of claim 1, wherein, The method comprises: determining a plurality of third nodes on the initial line. For each third node, a position of the third node is updated by weighting positions of neighboring third nodes; a smoothed line is generated based on the updated positions of the third nodes; a virtual line model is generated according to the smoothed line.
10. The method of claim 9, wherein, The generating of the virtual line model according to the smoothed line comprises: a plurality of fourth nodes are determined on the smoothed line, and a radius corresponding to each fourth node is determined; a fifth node is generated around the smoothed line with each fourth node as a center and according to the radius corresponding to the fourth node; the fifth nodes are connected to form the virtual line model.
11. The method of claim 10, wherein, The determining of the radius corresponding to each fourth node comprises: the radius corresponding to each fourth node is determined according to a distance between the fourth node and an end point of the smoothed line; the radius and the distance are positively correlated.
12. The method according to any one of claims 1 to 11, characterized in that, The method further comprises: display control parameters of different parts of the virtual line model are set, and the display control parameters are configured to gradually decrease from a start point to an end point of the virtual line model; in an animation playing time period, a display threshold is determined according to a current time progress, and a part of the virtual line model with a display control parameter not less than the display threshold is controlled to be displayed; the display threshold and the current time progress are negatively correlated.
13. A virtual lineament model generation apparatus, comprising: The apparatus comprises: a model obtaining module configured to obtain a virtual base model; a first node determining module configured to determine one or more first nodes on a surface of the virtual base model; a second node determining module configured to determine a ray with the first node as a start point, and to intersect and reflect the ray with the surface of the virtual base model one or more times, to take an intersection point of the ray with the virtual base model and an intersection point of the reflected ray with the virtual base model as second nodes, and to form a node group; each node group comprises one first node and one or more corresponding second nodes; an initial line forming module configured to connect nodes in a same node group to form an initial line; a model generating module configured to generate a virtual line model according to the initial line.
14. A computer program product comprising a computer program, characterized in that, The computer program is executed by a processor to implement the method of any one of claims 1 to 12.
15. An electronic device, comprising: comprises: a processor; a memory for storing executable instructions of the processor; wherein the processor is configured to execute the method of any one of claims 1 to 12 by executing the executable instructions.