Model processing method, device, equipment and storage medium
Through the method of ray detection and automatic adjustment of interspersed vertices, the model model penetration problem in 3D games is solved, and automated processing is realized, reducing the art workload and game resource usage.
Patent Information
- Application Number
- CN202211065238.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-01
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-09-01
AI Technical Summary
In 3D games, the phenomenon of model penetration between models leads to an increase in art workload and occupies game resources, and the existing manual adjustment methods are inefficient.
By ray detection, the interspersed vertices of the model are automatically processed, and the interspersed vertices are moved to the lower vertex area of the second model to hide the model penetration situation, and a programmatic scheme is used to reduce manual model replacement.
It realizes automatic processing of model mold penetration, reduces art workload, saves game resources and optimizes resource maintenance.
Smart Images

Figure CN115382206B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game technology, and in particular to a model processing method, a model processing device, a corresponding electronic device, and a corresponding computer-readable storage medium. Background Art
[0002] Clipping refers to the phenomenon of mutual penetration and overlap between objects or characters in many 3D games due to incorrect collision volume settings. Clipping usually occurs between at least two models during the art resource / file generation process. For example, in a game's dress-up system, a variety of hairstyles and hats are provided, but because hairstyles and hats have different shapes, clipping will inevitably occur when matching hairstyles and hats.
[0003] Currently, the solution to the problem of hair clipping through the model is usually to manually adjust the hair model that clips through the model to generate a non-clipping hair model for each hair and hat combination by the artist. In this way, when this type of hair requires this specific hat, the adjusted hair model will replace the original hair model to avoid the clipping through problem. However, this method of manually adjusting the clipping through model by the artist will increase the workload of the artist. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a model processing method, a model processing device, a corresponding electronic device and a corresponding computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
[0005] An embodiment of the present invention discloses a model processing method, involving a first model and a second model connected to the first model in a hooked manner, wherein the first model serves as a model of an obstructed object and the second model serves as a model of an obstructing object. The method includes:
[0006] detecting a ray emitted by the first model toward the bounding box of the first model, and determining a penetrating vertex of the first model based on the emitted ray; the penetrating vertex is used to indicate that the first model has penetrated the model;
[0007] Acquire a vertex region located in a lower layer of the second model, and move the interpenetrating vertices toward the vertex region located in the lower layer of the second model to hide the interpenetrating vertices.
[0008] An embodiment of the present invention further discloses a model processing device, including a first model and a second model connected to the first model in a hooked manner, wherein the first model serves as a model of an obstructed object and the second model serves as a model of an obstructing object. The device includes:
[0009] a penetrating vertex determination module, configured to detect rays emitted from the first model to the bounding box of the first model, and determine penetrating vertices of the first model based on the emitted rays; the penetrating vertices are used to indicate that the first model has penetrated the model;
[0010] The interlaced vertex moving module is used to obtain the vertex area located in the lower layer of the second model, and move the interlaced vertices to the vertex area located in the lower layer of the second model to hide the interlaced vertices.
[0011] An embodiment of the present invention further discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements any one of the model processing methods when executed by the processor.
[0012] An embodiment of the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, any one of the model processing methods is implemented.
[0013] The embodiments of the present invention include the following advantages:
[0014] In an embodiment of the present invention, the first model serving as the occluded object and the second model serving as the occluder are connected in a hanging manner. At this time, the rays emitted by the first model to the second model can be detected, and the interpenetrating vertices of the first model can be determined based on the rays emitted by the first model to its bounding box. The determined interpenetrating vertices can be used to indicate that the current first model has a penetration situation. At this time, the interpenetrating vertices can be moved to the vertex area located in the lower layer of the second model to hide the interpenetrating vertices. When the model is used, the ray is automatically detected, and the detected interpenetrating vertices are automatically adjusted to hide the interpenetrating vertices that have penetrated the model to solve the penetration situation of the model. Not only can the purpose of automation of the penetration processing be achieved, but also based on this ray-based automatic detection and automatic adjustment method, there is no need to manually generate a new model to replace the original model, thereby reducing the workload of art. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 is a flowchart of steps of an embodiment of a model processing method of the present invention;
[0016] Figure 2 is a flowchart of steps of another model processing method embodiment of the present invention;
[0017] Figure 3 is a schematic diagram of an application scenario of the processing provided by an embodiment of the present invention;
[0018] Figure 4 It is a structural block diagram of an embodiment of a model processing device of the present invention. DETAILED DESCRIPTION
[0019] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0020] Clipping usually occurs between at least two models during the generation of art resources / files, such as the clipping between hair and hats in a game's dressing system. Currently, the solution for clipping hair is to manually modify the vertices of the hair model that clips through, then re-output a new model to fit the corresponding hat. The adjusted hair model is used as a variant of the original art hair file. When this hair requires this specific hat, the adjusted hair model replaces the original hair model to avoid clipping.
[0021] However, this method of manually adjusting the model based on art not only increases the workload of artists, but also takes up game resources. While increasing the size of the game package, it also increases the complexity of subsequent resource maintenance. Specifically, on the one hand, since it is necessary to output a new hair model that is compatible with the hat for each hair and hat combination that is worn through the model, each time a new hairstyle or hat is designed, it is necessary to perform regression testing on the permutations and combinations of the current resources, and then output multiple copies of the adapted models, which increases the workload of artists; on the other hand, since multiple copies of the adapted models need to be output, there will be multiple copies of the same hairstyle at the same time, which will additionally increase the size of the game package and increase the complexity of subsequent resource maintenance.
[0022] In order to solve the problem of penetration between two models connected in a hanging manner, such as the problem that most hair and hats do not match, thereby effectively saving the workload of artists, one of the core ideas of the embodiments of the present invention is to propose a solution for automatically solving the penetration problem based on ray detection. It mainly manifests itself in that when the model is used, automatic detection is performed based on rays, and the interpenetrating vertices obtained by detection, which are used to indicate the penetration of the model, are automatically adjusted to move to the lower vertex area, so that the interpenetrating vertices with penetration are hidden to solve the penetration of the model. This not only achieves the purpose of automating the penetration processing, but also, based on this ray-based automatic detection and automatic adjustment method, there is no need to manually generate a new model to replace the original model, thereby reducing the workload of artists.
[0023] Reference Figure 1 , shows a flowchart of a model processing method embodiment of the present invention, which may specifically include the following steps:
[0024] Step 101: detecting rays emitted from a first model to a bounding box of the first model, and determining intersecting vertices of the first model based on the emitted rays;
[0025] Model clipping typically occurs between at least two models during the generation of art resources / files. In embodiments of the present invention, this involves at least two models connected in a hooked manner, for example, a first model and a second model hooked to the first model. The hooking manner may refer to a connection method that exhibits relative invariance, primarily manifested in the first model's position remaining relatively stationary with respect to the second model, i.e., the first model and the second model remain relatively stationary during most of their movement.
[0026] The penetration situation usually occurs between the occluder and the occluded object, including the completely occluded object completely occluded by the occluder and the partially occluded object partially occluded by the occluder. In the embodiment of the present invention, it is assumed that in the models of the penetration situation involved, the first model is the model of the occluded object, such as the hair model of the dressing system in the game, and the second model is the model of the occluder, such as the hat model of the dressing system in the game. The penetration processing performed in the embodiment of the present invention can be manifested as the first model as the occluded object penetrating the second model as the occluder, and this penetration situation is processed.
[0027] For the first model and the second model with relative invariance, the penetration of the first model relative to the second model can mostly be manifested as the first model interpenetrating with the second model in any direction, such as upward. At this time, if the vertices of the interpenetrating first model can be detected and these interpenetrating vertices can be moved into the interior of the second model, then the second model can be used to block the interpenetrating vertices, thereby solving the penetration of the first model relative to the second model.
[0028] In one embodiment of the present invention, in order to solve the problem of the first model penetrating the second model, the vertices in the first model that intersect with the second model can be first detected. The detected vertices that intersect can be called intersecting vertices, that is, the intersecting vertices can refer to the vertices in the model that serves as the occluded object that intersect from the model that serves as the occluded object. Then the detected intersecting vertices are mainly used to indicate the problem of the first model serving as the occluded object intersecting with the second model.
[0029] In practical applications, the detection method for interlaced vertices can be determined based on the rays emitted by the first model to the bounding box of the first model, specifically, the rays can be emitted to the center of the bounding box of the first model. The center of the bounding box of the first model can be mainly achieved by obtaining the vertices of the geometric objects constituting the first model, solving the optimal bounding space of the discrete point set for these vertices, obtaining a geometric body with simple characteristics (called a bounding box), and determining the center of the obtained geometric body with simple characteristics. It should be noted that the embodiments of the present invention do not limit the specific methods for solving the bounding box of the model and solving the center of the bounding box.
[0030] Step 102: Acquire a vertex region located in the lower layer of the second model, and move interlaced vertices toward the vertex region located in the lower layer of the second model to hide the interlaced vertices.
[0031] After determining the interpenetrating vertices of the first model that is the occluded object, these interpenetrating vertices can be moved into the second model, and the second model can be used to block the interpenetrating vertices to hide the interpenetrating vertices, thereby solving the problem of the first model interpenetrating the second model.
[0032] Specifically, when the model is used, automatic detection is performed based on rays, and automatic adjustment of the interpenetrating vertices detected is completed. The automatic adjustment operation mainly moves the interpenetrating vertices to the vertex area in the lower layer of the second model. It is directly based on the automatic adjustment operation of the interpenetrating vertices of the first model, and does not deliberately generate the art model file corresponding to the first model adapted to the second model. There is no need to replace the original first model with a newly generated model, which saves the size of the package and is also beneficial to the subsequent maintenance of resources.
[0033] In an embodiment of the present invention, the ray detection of intersecting vertices and the automatic adjustment scheme of intersecting vertices can be implemented in a programmatic manner, that is, a first model that matches the second model and does not produce intersecting situations can be directly generated based on this programmed scheme, thereby realizing the automation of the intersecting processing of the model. It should be noted that the model generation technology during programmatic operation is only for specific combination parts in the model, such as the combination of hair and hat. In order to avoid the geometric data generated after the automatic adjustment of the intersecting vertices affecting the original model static data of the first model, a new model data can usually be copied for the first model to be processed, and the model data of the copied first model can be processed. That is, the model data of the first model is copied to move the intersecting vertices in the copied model data of the first model to the vertex area of the lower layer of the second model.
[0034] In actual applications, since the data unit moved during the automatic adjustment of interpenetrating vertices is the vertex, the movement of the interpenetrating vertices to the collision point does not mean that the surface formed by the interpenetrating vertices after the movement is not in a collision state. For example, when the second model serving as the occluder is concave, although the interpenetrating vertices that have moved to the collision point are already located below the concave, the surface formed by the interpenetrating vertices can easily cause interpenetration in the middle of the concave. Therefore, in order to avoid the situation where the surface formed by the interpenetrating vertices still penetrates and overlaps with the second model after multiple movements of the interpenetrating vertices, the interpenetrating vertices can be moved to the vertex area located in the lower layer of the second model according to the preset number of iterations.
[0035] Among them, the setting of the preset number of iterations can be the experience value accumulated by the artists, determined based on the actual situation. In practice, the artists can set the experience value in the editor as the usage value of the model when running the game. The usage value usually tries to ensure that the interpenetrating vertices do not penetrate the model, and try to ensure that the faces formed by the interpenetrating vertices do not collide. It should be noted that the first model generated based on this program is for adapting to most of the second models. For some special cases, such as models with certain geometric bodies with extreme shapes, whether it is the first time or multiple times the position of the interpenetrating vertices is moved, it cannot be completely guaranteed whether the faces connected by the vertices of the first model will penetrate the model. In such special cases, the preset number of iterations may be unpredictable.
[0036] In an embodiment of the present invention, the first model serving as the occluded object and the second model serving as the occluder are connected in a hanging manner. At this time, the rays emitted by the first model to the second model can be detected, and the interpenetrating vertices of the first model can be determined based on the rays emitted by the first model to its bounding box. The determined interpenetrating vertices can be used to indicate that the current first model has a penetration situation. At this time, the interpenetrating vertices can be moved to the vertex area located in the lower layer of the second model to hide the interpenetrating vertices. When the model is used, automatic detection is performed based on the rays, and automatic adjustment of the detected interpenetrating vertices is completed to achieve the hiding of the interpenetrating vertices that have penetrated the model to solve the penetration situation of the model. Not only can the purpose of automation of the penetration processing be achieved, but also based on this method of automatic detection and automatic adjustment based on rays, there is no need to manually generate a new model to replace the original model, thereby reducing the workload of art.
[0037] Reference Figure 2 , shows a flowchart of another model processing method embodiment of the present invention, involving a first model and a second model connected to the first model in a hanging manner, wherein the first model serves as a model of the obstructed object and the second model serves as a model of the obstructing object. Specifically, the method may include the following steps:
[0038] Step 201, traversing the vertices of the first model, emitting rays to the center of the bounding box of the first model based on the vertices of the first model, and determining the intersecting vertices of the first model;
[0039] In an embodiment of the present invention, assuming that the penetration occurs in a first model and a second model that are relatively invariant, that is, connected in a hanging manner, and that the penetration of the first model relative to the second model can mostly be manifested as the first model penetrating with the second model in any direction, such as upward, then the penetration vertices of the first model can be determined first, so that the detected penetration vertices can be automatically adjusted to hide the penetration vertices.
[0040] The interpenetrating vertex may refer to a vertex in the model of the occluded object that intersects the model of the occluded object, and may be mainly used to indicate that the first model serving as the occluder is interpenetrating the model.
[0041] The detection method for interpenetrating vertices can be mainly based on the rays emitted by the first model to the center of the bounding box of the first model, that is, the determination is made based on the rays emitted by the first model. In a specific implementation, it can be mainly manifested as traversing the rays emitted from all vertices of the first model to detect all interpenetrating vertices of the first model, that is, traversing all vertices of the first model, emitting rays from the vertices of the first model to the center of the bounding box of the first model, and then determining the interpenetrating vertices based on the emitted rays.
[0042] Specifically, when traversing all vertices of the first model and emitting a ray toward the center of the bounding box of the first model, if the emitted ray intersects with the second model, that is, the ray collides with the second model in the process of being emitted toward the center of the bounding box, then it can be determined that the ray emitted on the first model that intersects with the second model, that is, the vertex corresponding to the ray that hits it is the intersecting vertex.
[0043] For example, assuming that the first model of the occluded object is the hair model of the dressing system in the game, and the second model of the occluded object is the hat model of the dressing system in the game, in order to detect the vertices of the hair model that intersect with the hat model, that is, the interspersed vertices, a feasible method can be expressed as emitting rays from all vertices of the hair model to the center of the bounding box of the hair model. If the emitted ray hits the hat model, this ray can be called a hitting ray, and it can be considered that the vertex corresponding to the hitting ray in the hair model is interspersed outside the hat model, that is, the vertex interspersed outside the hat model is the interspersed vertex when the hair model penetrates the model.
[0044] In a preferred embodiment, when rays emitted from all vertices of the first model are traversed, in addition to detecting all intersecting vertices of the first model, collision points corresponding to the rays that hit the model can also be detected. The detected collision points can be represented as the intersection points of the rays emitted from the first model and the second model. The collision points are primarily determined by determining, when a ray emitted from the first model intersects the second model, that the vertex where the intersecting ray intersects the second model is the collision point.
[0045] Among them, the determined collision point is usually the intersection point of the model serving as the occluded object and the model serving as the occluder. In order to avoid the model serving as the occluded object from penetrating the model, the interpenetrating vertex of the model serving as the occluded object should be located in the vertex area below the intersection point (i.e., the collision point). The determined collision point can be used to represent the moving position of the interpenetrating vertex.
[0046] It should be noted that to prevent the geometric data generated after the automatic adjustment of intersecting vertices from affecting the original static data of the first model, it is usually possible to copy a new copy of the model data of the first model to be processed and process the copied model data of the first model. In other words, the model data of the first model is copied to move the intersecting vertices in the copied model data of the first model to the vertex area of the lower layer of the second model.
[0047] Step 202 : moving the interpenetrating vertices along the direction in which the rays are emitted according to a preset number of iterations, until the surface formed by the interpenetrating vertices at the position of the collision point does not collide with the second model.
[0048] After determining the interpenetrating vertices of the first model that is the occluded object, these interpenetrating vertices can be moved into the second model, and the second model can be used to block the interpenetrating vertices to hide the interpenetrating vertices, thereby solving the problem of the first model interpenetrating the second model.
[0049] Specifically, when the model is used, automatic detection is performed based on rays, and automatic adjustment of the interpenetrating vertices detected is completed. The automatic adjustment operation mainly moves the interpenetrating vertices to the vertex area in the lower layer of the second model. It is directly based on the automatic adjustment operation of the interpenetrating vertices of the first model, and does not deliberately generate the art model file corresponding to the first model adapted to the second model. There is no need to replace the original first model with a newly generated model, which saves the size of the package and is also beneficial to the subsequent maintenance of resources.
[0050] In practical applications, in order to avoid the model being obscured from penetrating the model, the interpenetrating vertex of the model being obscured should be located in the vertex area below the intersection point (i.e., the collision point), and the direction in which the ray is emitted can essentially be the same as the direction in which the collision point is located. Assuming that there is a collision point between the ray emitted by the first model and the second model in the direction in which the ray is emitted, the interpenetrating vertex can be moved along the direction in which the ray is emitted to the position of the collision point.
[0051] For example, the interpenetrating vertices of the first model can be moved to the position of the collision point along the direction of the ray from which they are emitted (in actual operation, a slight offset can be added to avoid z-fighting), and the interpenetrating vertices after being moved to the position of the collision point can be moved again to a lower layer according to a preset number of iterations, so as to move these interpenetrating vertices into the interior of the second model, and the second model can be used to block the interpenetrating vertices to hide the interpenetrating vertices, thereby solving the problem of the interpenetration of the first model relative to the second model.
[0052] The setting of the preset number of iterations can be the experience value accumulated by the artist, determined based on the actual situation. In practice, the artist can set the experience value in the editor as the usage value of the model when running the game. The usage value is usually used to ensure that the intersecting vertices do not penetrate the model, and to ensure that there are no collisions with the faces formed by the intersecting vertices.
[0053] Specifically, the second model serving as an occluder may have thickness. In this case, the ray emitted from the vertex of the first model to the center of the bounding box may intersect with the second model at more than one collision point. In order to avoid the first model from penetrating the model as much as possible, the intersecting vertices can be moved to the lower layer as much as possible.
[0054] In this case, the interpenetrating vertex can be moved along the direction of the ray emission to the position of the collision point; then, according to a preset number of iterations, a ray is emitted again toward the center of the bounding box of the first model based on the moved interpenetrating vertex; if the re-emitted ray intersects with the second model, the moved interpenetrating vertex can be moved again to the position of the collision point where the re-emitted ray intersects with the second model, until the interpenetrating vertex moved to the position of the collision point has no collision point with the second model when the ray emitted toward the center of the bounding box. The number of iterations can be given, and the ray detection and movement of the interpenetrating vertex can be repeated according to the number of iterations. The position of each subsequent movement can be determined based on the position of the intersection of the ray detection performed on the moved interpenetrating vertex and the geometry of the second model.
[0055] In another case, after the interpenetrating vertices of the first model are moved, since the data unit moved in the process of automatically adjusting the interpenetrating vertices is the vertex, the movement of the interpenetrating vertices to the position of the collision point does not mean that the surface formed by the interpenetrating vertices after the movement is not in a collision state. In particular, for some models with extreme geometric shapes, the surfaces formed by the interpenetrating vertices (including the surfaces formed by a certain interpenetrating vertex and the interpenetrating vertices and / or other vertices) may still penetrate and overlap with the second model. For example, when the second model serving as an obstruction is concave, although the interpenetrating vertices that have been moved to the collision point are already located below the concave, the surfaces formed by the interpenetrating vertices are likely to cause interpenetration in the middle part of the concave. In order to avoid the surface formed in the first model from penetrating the model as much as possible, the interpenetrating vertices can also be moved to the lower layer as much as possible.
[0056] Specifically, after moving the interpenetrating vertex along the direction of the ray to the position of the collision point, the surface formed by the moved interpenetrating vertex in the model data of the copied first model can be obtained according to the preset number of iterations. If the surface formed by the moved interpenetrating vertex collides with the second model, the moved interpenetrating vertex can be moved again to the lower position of the collision point on the intersecting ray until the surface formed by the moved interpenetrating vertex does not collide with the second model.
[0057] It should be noted that the scheme of detecting the interlaced vertices of the first model and moving the interlaced vertices according to a preset number of iterations can be implemented programmatically. When performing automatic detection of interlaced vertices and automatic movement of interlaced vertices, the interlaced vertices detected and moved can be one or more, and multiple interlaced vertices can be detected and moved at the same time. This embodiment of the present invention does not impose any restrictions on this.
[0058] In an embodiment of the present invention, the first model serving as the occluded object and the second model serving as the occluder are connected in a hanging manner. At this time, the rays emitted by the first model to the second model can be detected, and the interpenetrating vertices of the first model can be determined based on the rays emitted by the first model to its bounding box. The determined interpenetrating vertices can be used to indicate that the current first model has a penetration situation. At this time, the interpenetrating vertices can be moved to the vertex area located in the lower layer of the second model to hide the interpenetrating vertices. When the model is used, automatic detection is performed based on the rays, and automatic adjustment of the detected interpenetrating vertices is completed to achieve the hiding of the interpenetrating vertices that have penetrated the model to solve the penetration situation of the model. Not only can the purpose of automation of the penetration processing be achieved, but also based on this method of automatic detection and automatic adjustment based on rays, there is no need to manually generate a new model to replace the original model, thereby reducing the workload of art.
[0059] Reference Figure 3 , showing a schematic diagram of an application scenario of the processing provided by an embodiment of the present invention, the model penetration processing proposed in the embodiment of the present invention, that is, the ray detection of the first model and the automatic adjustment of the interpenetrating vertices can be implemented in a programmed manner, that is, the first model that matches the second model and does not produce penetration can be directly generated based on this programmed solution, thereby realizing the automated processing of model penetration.
[0060] The automated processing of model penetration provided by the embodiments of the present invention can be applied to in-game costume systems, such as a scene where a hair model passes through a hat model. In this scenario, the first model involved can be a hair model serving as an occluded object, and the second model connected to the first model by a hook can be a hat model serving as an occluded object.
[0061] When handling the problem of hair models clipping through hat models, this is typically applied to the costume change system of client 310. This is primarily manifested in that when a person selects or inputs a certain hair, hat, and the hat's relative wearing position (i.e., attachment point information) for an avatar in the costume change system of the client, a static hair image that fits the hat without clipping can be displayed on the client.
[0062] In the specific process, the center point of the bounding box of the selected hair model (i.e., the center of the bounding box) can be calculated. The programmatic method used is mainly a generation technology at runtime. In this application scenario, it targets a specific combination of hair and hat. In order to avoid the generated geometric data from being written back to the original model, that is, to avoid affecting the static data of the model, a new model data can be copied for the hair model to be processed, and then the selected hat model can be attached to the copied hair model based on the attachment point information, and the hat can be moved to a specific position on a specific hair.
[0063] The skinning calculations are then performed, primarily recording relevant information and calculating the bindpose bone matrix of the hair model in model space for subsequent vertex skinning. At this point, you can iterate through all the vertices of the hair model, manually calculating the vertex position after skinning. Using this position and the center point of the bounding box, you can send a ray to detect whether the emitted ray collides with the hat model, i.e., whether there is an intersection. If so, the vertex position is moved to the collision point.
[0064] For example, Figure 3As shown in (1), assuming that the center point P of the hair model bounding box is each vertex V of the hair model, the rays emitted from all vertices of the hair model to the center of the hair model bounding box can be expressed as constructing a line VP. At this time, the constructed line VP can be used to perform ray detection with the hat model attached to the hair. If the emitted ray hits the hat model, this ray can be called a hitting ray, and it can be considered that the vertex corresponding to the hitting ray in the hair model is interspersed outside the hat model, that is, the vertex interspersed outside the hat model is the interspersed vertex when the hair model penetrates the model, such as the interspersed vertex W.
[0065] After determining the intersecting vertices of the hair model that are being occluded, these intersecting vertices can be moved into the hat model. The hat model can then be used to occlude the intersecting vertices, thus resolving the problem of the hair model intersecting the hat model. This can be achieved by repeating the ray detection and intersecting vertex movement according to a given number of iterations.
[0066] For example, Figure 3 As shown in (2), after determining the interpenetrating vertex W of the hair model as the occluded object, the collision point V' between the line VP and the hat model can also be determined. The position of the interpenetrating vertex W can be moved to the position of the collision point V', and according to the preset number of iterations, based on the position of the interpenetrating vertex after the movement, a ray is again emitted to the center point P of the bounding box, that is, the line V'P is constructed, and the position of the interpenetrating vertex is moved again when the line VP intersects with the hat model, until the surface formed by the interpenetrating vertex moved to the position of the collision point does not collide. The position of each subsequent movement can be determined based on the position of the intersection point of the ray detection of the interpenetrating vertex after the movement and the geometry of the hat model, so that the following can be generated in the end. Figure 3 The hair model shown in (3) matches the hat model and does not produce any penetration, thereby automating the penetration processing of the model.
[0067] It should be noted that the specific preset number of iterations needs to be determined based on the actual situation, and the hair model generated based on this program is suitable for most hat models. For some special cases, such as models with certain geometric bodies with extreme shapes, no matter whether the position of the interlaced vertices is moved for the first time or multiple times, it cannot be completely guaranteed whether the faces connected by the vertices of the hair model will be interlaced. In such special cases, the preset number of iterations may be unpredictable.
[0068] In an embodiment of the present invention, when a model is used, automatic detection is performed based on rays, and automatic adjustment is performed on the interpenetrating vertices detected, so that the interpenetrating vertices that penetrate the model are hidden to solve the problem of the model penetrating. This not only achieves the purpose of automating the processing of the model penetration, but also, based on this automatic detection and automatic adjustment based on rays, there is no need to manually generate a new model to replace the original model, thereby reducing the workload of the artist.
[0069] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0070] Reference Figure 4 , shows a structural block diagram of an embodiment of a model processing device of the present invention, involving a first model and a second model connected to the first model in a hanging manner, wherein the first model serves as a model of the obstructed object, and the second model serves as a model of the obstructing object, and specifically may include the following modules:
[0071] The interpenetrating vertex determination module 401 is configured to detect rays emitted from the first model to the bounding box of the first model, and determine interpenetrating vertices of the first model based on the emitted rays; the interpenetrating vertices are used to indicate that the first model has interpenetrated;
[0072] The interpenetrating vertex moving module 402 is configured to obtain a vertex region located in the lower layer of the second model, and move the interpenetrating vertices to the vertex region located in the lower layer of the second model to hide the interpenetrating vertices.
[0073] In one embodiment of the present invention, the bounding box has a bounding box center; the interspersed vertex determination module 401 may include the following submodules:
[0074] A vertex traversal submodule, configured to traverse the vertices of the first model and obtain rays emitted from the vertices of the first model to the center of the bounding box of the first model;
[0075] The interpenetrating vertex determining submodule is configured to determine, when the emitted ray intersects the second model, a vertex on the first model from which the ray intersecting the second model is emitted as an interpenetrating vertex.
[0076] In one embodiment of the present invention, the interspersed vertex determination module 401 may further include the following submodules:
[0077] The collision point determination submodule is configured to determine, when a ray emitted by the first model intersects the second model, a vertex where the intersecting ray intersects the second model as a collision point.
[0078] In one embodiment of the present invention, the interspersed vertex movement module 402 may include the following submodules:
[0079] The interspersed vertex moving submodule is used to copy the model data of the first model and move the interspersed vertices in the copied model data of the first model to the vertex area of the lower layer of the second model.
[0080] In one embodiment of the present invention, the direction of the vertex region of the lower layer of the second model is the same as the direction in which the ray is emitted, and the interspersed vertex movement submodule may include the following units:
[0081] The interlaced vertex moving unit is used to move the interlaced vertices in the model data of the copied first model along the direction in which the ray is emitted according to a preset number of iterations.
[0082] In one embodiment of the present invention, a collision point exists between the ray emitted by the first model and the second model in the direction in which the ray is emitted; the interlaced vertex moving unit may include the following subunits:
[0083] The interpenetrating vertex moving unit is used to move the interpenetrating vertex to the position of the collision point and / or the lower position of the collision point on the ray multiple times along the direction of the ray according to a preset number of iterations.
[0084] Among them, according to a preset number of iterations, the interpenetrating vertex is moved multiple times along the direction in which the ray is emitted to the position of the collision point, including moving the interpenetrating vertex along the direction in which the ray is emitted to the position of the collision point; there are multiple collision points; according to a preset number of iterations, based on the moved interpenetrating vertex, a ray is emitted again to the center of the bounding box of the first model; if the re-emitted ray intersects with the second model, the moved interpenetrating vertex is moved again to the position of the collision point where the re-emitted ray intersects with the second model, until the interpenetrating vertex is moved to the position of the collision point, and the ray emitted to the center of the bounding box does not have a collision point with the second model. According to a preset number of iterations, the interpenetrating vertex is moved multiple times along the direction of the ray to the lower position of the collision point on the ray, including after the interpenetrating vertex is moved to the position of the collision point, obtaining the surface formed by the moved interpenetrating vertex in the model data of the copied first model according to a preset number of iterations; if the surface formed by the moved interpenetrating vertex collides with the second model, the moved interpenetrating vertex is moved again to the lower position of the collision point on the intersecting ray, until the surface formed by the interpenetrating vertex after another movement does not collide with the second model.
[0085] In an embodiment of the present invention, the first model serving as the occluded object and the second model serving as the occluder are connected in a hanging manner. At this time, the rays emitted by the first model to the second model can be detected, and the interpenetrating vertices of the first model can be determined based on the rays emitted by the first model to its bounding box. The determined interpenetrating vertices can be used to indicate that the current first model has a penetration situation. At this time, the interpenetrating vertices can be moved to the vertex area located in the lower layer of the second model to hide the interpenetrating vertices. When the model is used, automatic detection is performed based on the rays, and automatic adjustment of the detected interpenetrating vertices is completed to achieve the hiding of the interpenetrating vertices that have penetrated the model to solve the penetration situation of the model. Not only can the purpose of automation of the penetration processing be achieved, but also based on this method of automatic detection and automatic adjustment based on rays, there is no need to manually generate a new model to replace the original model, thereby reducing the workload of art.
[0086] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0087] An embodiment of the present invention further provides an electronic device, including:
[0088] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned model processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0089] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned model processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0090] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0091] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, apparatus, or computer program products. Thus, embodiments of the present invention may take the form of a fully hardware embodiment, a fully software embodiment, or an embodiment combining software and hardware. Furthermore, embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0092] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the process in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0093] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0094] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0095] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0096] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0097] The above is a detailed introduction to a model processing method, a model processing device, a corresponding electronic device and a corresponding computer-readable storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A model processing method, characterized in that: The method involves a first model and a second model connected to the first model in a hanging manner, wherein the first model serves as a model of an obstructed object and the second model serves as a model of an obstructing object, and the method includes: Detecting rays emitted by the first model toward the bounding box of the first model, and determining interpenetrating vertices of the first model based on the emitted rays; the interpenetrating vertices are used to indicate that the first model has interpenetrated, and the bounding box has a bounding box center; Acquire a vertex region located in a lower layer of the second model, and move the interpenetrating vertices toward the vertex region located in the lower layer of the second model to hide the interpenetrating vertices, wherein the vertex region in the lower layer of the second model is located inside the second model; The detecting of the rays emitted by the first model toward the bounding box of the first model and determining the intersecting vertices of the first model according to the emitted rays includes: Traversing the vertices of the first model, and obtaining rays emitted from the vertices of the first model to the center of the bounding box of the first model; If the emitted ray intersects the second model, the vertex on the first model from which the ray intersecting the second model is emitted is determined to be an intersecting vertex.
2. The method according to claim 1, characterized in that Also includes: When a ray emitted by the first model intersects the second model, a vertex where the intersecting ray intersects the second model is determined as a collision point.
3. The method according to claim 1, characterized in that The step of moving the interspersed vertices to the vertex region of the lower layer of the second model includes: The model data of the first model is copied, and interspersed vertices in the copied model data of the first model are moved to the vertex area of the lower layer of the second model.
4. The method according to claim 3, characterized in that The direction of the vertex region of the lower layer of the second model is the same as the direction in which the ray is emitted; and moving the interpenetrating vertex toward the vertex region of the lower layer of the second model includes: According to a preset number of iterations, the interspersed vertices in the model data of the copied first model are moved along the direction in which the ray is emitted.
5. The method according to claim 4, characterized in that In the direction in which the ray is emitted, a ray emitted by the first model and the second model have a collision point; and moving the intersecting vertices in the model data of the copied first model along the direction in which the ray is emitted according to a preset number of iterations includes: According to a preset number of iterations, the interpenetrating vertex is moved multiple times along the direction in which the ray is emitted to the position of the collision point and / or the lower position of the collision point on the ray.
6. The method according to claim 5, characterized in that The step of moving the interpenetrating vertex to the position of the collision point multiple times along the direction in which the ray is emitted according to a preset number of iterations includes: Moving the interpenetrating vertex along the direction in which the ray is emitted to the position of the collision point; there are multiple collision points; According to a preset number of iterations, rays are emitted again towards the center of the bounding box of the first model based on the moved intersecting vertices; If the ray emitted again intersects with the second model, the moved intersecting vertex is moved again to the position of the collision point where the ray emitted again intersects with the second model, until the intersecting vertex is moved to the position of the collision point and there is no collision point between the ray emitted toward the center of the bounding box and the second model.
7. The method according to claim 5 or 6, characterized in that According to a preset number of iterations, the interpenetrating vertex is moved multiple times along the direction in which the ray is emitted to a lower position of the collision point on the ray, including: After the interpenetrating vertex is moved to the position of the collision point, a surface formed by the interpenetrating vertex after the movement and the model data of the copied first model is obtained according to a preset number of iterations; If the surface formed by the moved intersecting vertices collides with the second model, the moved intersecting vertices are moved again to the lower position of the collision point on the intersecting ray until the surface formed by the moved intersecting vertices does not collide with the second model.
8. A model processing device, characterized in that: The device relates to a first model and a second model connected to the first model in a hanging manner, wherein the first model serves as a model of an obstructed object and the second model serves as a model of an obstructing object, and the device comprises: a penetrating vertex determination module, configured to detect rays emitted from the first model to the bounding box of the first model, and determine penetrating vertices of the first model based on the emitted rays; the penetrating vertices are used to indicate that the first model has penetrated the model, and the bounding box has a bounding box center; an interspersed vertex moving module, configured to obtain a vertex region located in a lower layer of the second model, and move the interspersed vertices toward the vertex region located in the lower layer of the second model to hide the interspersed vertices, wherein the vertex region in the lower layer of the second model is located inside the second model; The interspersed vertex determination module includes: A vertex traversal submodule, configured to traverse the vertices of the first model and obtain rays emitted from the vertices of the first model to the center of the bounding box of the first model; The interpenetrating vertex determining submodule is configured to determine, when the emitted ray intersects the second model, a vertex on the first model from which the ray intersecting the second model is emitted as an interpenetrating vertex.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the model processing method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the model processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Detection method for collision between solid mesh models based on GPU (Graphics Processing Unit) acceleration
CN104408774A
Cutting method based on Unity 3D model
CN111145356A