Model generation method and device, electronic equipment and readable storage medium
By using ray detection in a virtual scene to determine continuous points and generate segmented models, the problem that the extension effect in the prior art cannot adapt to the scene environment in real time is solved, and the efficiency and real-time nature of resource reuse are achieved.
Patent Information
- Application Number
- CN202411723108.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, the extension effect of the extendable model is pre-made and cannot adapt to different scenario environments in real time, making it difficult to achieve resource reuse.
By determining the starting point, detection direction and extension direction of the spline in a virtual scene, determining continuous points using ray detection, and generating segmented models between adjacent continuous points, real-time segmented model extension effect is achieved.
The real-time extension effect of the segmented model is realized, and it can adapt to the virtual scene environment where the model is located in real time, without pre-production of extended models and model extension animations, avoiding waste of resources.
Smart Images

Figure CN119810270A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a model generation method, device, electronic device and readable storage medium. Background Art
[0002] In the field of computer graphics, scenes often require some models that can be extended over time, such as pipes, vines, etc. This type of model can make some dynamic changes in the scene and increase the richness of the scene.
[0003] Currently, stretchable models are usually pre-customized, that is, specific stretch animations are pre-made according to specific models, and then the stretch animations are played in the game. If there are a large number of such requirements, it will greatly increase the workload for model makers and special effects animation makers.
[0004] In current technology, the extension effect of the stretchable model is pre-made, so the extension effect is non-real-time. However, for different scene environments, the stretchable model will have different morphological expressions. For example, the morphological expressions of the vine model when it grows and extends along the wall and objects are different. Once the scene environment changes, the pre-made extension effect cannot adapt to the change, and it is difficult to reuse the produced resources. Summary of the invention
[0005] The present disclosure provides a model generation method, device, electronic device and readable storage medium to solve or at least partially solve the above-mentioned problems, as follows.
[0006] In a first aspect, the present disclosure provides a model generation method, the method comprising:
[0007] Determine the starting point, starting detection direction and starting extension direction of the spline in the virtual scene;
[0008] According to the starting point, determining a starting auxiliary point;
[0009] Determine a first auxiliary point at a first preset distance from the starting auxiliary point in the starting extension direction;
[0010] emitting rays from the first auxiliary point along the starting detection direction to perform ray detection;
[0011] If a virtual surface in the virtual scene is detected from the first auxiliary point along the starting detection direction, determine an intersection point of a ray from the first auxiliary point along the starting detection direction and the detected virtual surface as a first continuous point of the spline;
[0012] generating a preconfigured segment model between the starting point and the first continuous point;
[0013] Determine a second auxiliary point at the first preset distance from the first auxiliary point in the starting extension direction;
[0014] emitting rays from the second auxiliary point along the starting detection direction to perform ray detection;
[0015] If a virtual surface in the virtual scene is detected from the second auxiliary point along the starting detection direction, determine an intersection of a ray from the second auxiliary point along the starting detection direction and the detected virtual surface as a second continuous point of the spline;
[0016] The segment model is generated between the first continuous points and the second continuous points.
[0017] In a second aspect, the present disclosure further provides a model generation device, the device comprising:
[0018] A first determination module is used to determine a starting point, a starting detection direction and a starting extension direction of a spline in a virtual scene;
[0019] A second determining module is used to determine a starting auxiliary point according to the starting point;
[0020] A third determining module, configured to determine a first auxiliary point at a first preset distance from the starting auxiliary point in the starting extension direction;
[0021] A first ray detection module, used for emitting rays from the first auxiliary point along the starting detection direction to perform ray detection;
[0022] a fourth determination module, configured to determine, if a virtual surface in the virtual scene is detected from the first auxiliary point along the starting detection direction, an intersection of a ray from the first auxiliary point along the starting detection direction and the detected virtual surface as a first continuous point of the spline;
[0023] A first model generation module, configured to generate a preconfigured segment model between the starting point and the first continuous point;
[0024] A fifth determining module, configured to determine a second auxiliary point at the first preset distance from the first auxiliary point in the starting extension direction;
[0025] A second ray detection module, used for emitting rays from the second auxiliary point along the starting detection direction to perform ray detection;
[0026] a sixth determination module, configured to determine, if a virtual surface in the virtual scene is detected from the second auxiliary point along the starting detection direction, an intersection of a ray from the second auxiliary point along the starting detection direction and the detected virtual surface as a second continuous point of the spline;
[0027] The second model generating module is used to generate the segment model between the first continuous points and the second continuous points.
[0028] In a third aspect, the present disclosure further provides an electronic device, comprising: a processor, a memory, and computer program instructions stored in the memory and executable on the processor;
[0029] When the processor executes the computer program instructions, the model generation method described in the first aspect above is implemented.
[0030] In a fourth aspect, the present disclosure further provides a computer-readable storage medium, in which computer program instructions are stored. When the computer program instructions are executed by a processor, they are used to implement the model generation method described in the first aspect above.
[0031] The exemplary embodiments of the present disclosure have the following beneficial effects:
[0032] The model generation method provided by the present disclosure determines the starting point, starting detection direction and starting extension direction of the spline in the virtual scene; determines the starting auxiliary point according to the starting point; determines the first auxiliary point at a first preset distance from the starting auxiliary point in the starting extension direction; emits rays from the first auxiliary point along the starting detection direction to perform ray detection; if a virtual surface in the virtual scene is detected, determines the intersection of the ray from the first auxiliary point along the starting detection direction and the detected virtual surface as the first continuous point of the spline; and then generates a segmented model between the starting point and the first continuous point. Then, determines the second auxiliary point at a first preset distance from the first auxiliary point in the starting extension direction; emits rays from the second auxiliary point along the starting detection direction to perform ray detection; if a virtual surface in the virtual scene is detected from the second auxiliary point along the starting detection direction, determines the intersection of the ray from the second auxiliary point along the starting detection direction and the detected virtual surface as the second continuous point of the spline; and then generates the next segmented model between the first continuous point and the second continuous point. The present invention can perform ray detection from auxiliary points, determine continuous points on the detected virtual surface, determine the next auxiliary point and continuous point through the detection direction and the extension direction, and generate a segmented model between adjacent continuous points, thereby achieving a real-time segmented model extension effect. The extension effect of the segmented model can adapt to the virtual scene environment where the model is located in real time, without the need to pre-make extensible models and model extension animations, thereby avoiding the problem of resource waste caused by difficulty in resource reuse. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flow chart of a model generation method provided by one of the embodiments of the present disclosure;
[0034] Figure 2 is a schematic diagram of determining continuous points of a spline provided by one of the embodiments of the present disclosure;
[0035] Figure 3 is a schematic diagram of a segmented model provided by one of the embodiments of the present disclosure;
[0036] Figure 4 is a schematic diagram of determining continuous points of a spline provided by one of the embodiments of the present disclosure;
[0037] Figure 5 is a schematic diagram of determining continuous points of a spline provided by one of the embodiments of the present disclosure;
[0038] Figure 6 is a schematic diagram of determining continuous points of a spline provided by one of the embodiments of the present disclosure;
[0039] Figure 7 is a schematic diagram of determining continuous points of a spline provided by one of the embodiments of the present disclosure;
[0040] Figure 8 is a schematic diagram of determining continuous points of a spline provided by one of the embodiments of the present disclosure;
[0041] Fig. 9 is a schematic diagram of a spline provided by one of the embodiments of the present disclosure;
[0042] Fig.10 is a schematic diagram of a spline provided by one of the embodiments of the present disclosure;
[0043] Fig.11 is a schematic diagram of a spline provided by one of the embodiments of the present disclosure;
[0044] Fig.12 is a schematic diagram of a model extension effect provided by one embodiment of the present disclosure;
[0045] Fig.13 is a block diagram of a model generation device provided by one of the embodiments of the present disclosure;
[0046] Fig.14 It is a logical structure diagram of an electronic device for implementing model generation provided by one of the embodiments of the present disclosure. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present disclosure.
[0048] The terms "a", "an", "the" and "said" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first" and "second" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0049] It should be understood that in the embodiments of the present disclosure, "at least one" means one or more, and "more than one" means two or more. "And / or" is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.
[0050] It should be understood that in the embodiments of the present disclosure, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean that B is determined only according to A, and B can also be determined according to A and / or other information.
[0051] The model generation method in one embodiment of the present disclosure can be run on a local terminal device or a server. When the model generation method is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0052] In an optional implementation, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the model generation method are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the cloud game server in the cloud is used for information processing. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0053] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0054] In a possible implementation, an embodiment of the present disclosure provides a model generation method, which provides a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or can be a client device in the cloud interaction system mentioned above.
[0055] Before describing the embodiments of the present disclosure in detail, related concepts and related technologies are first further introduced.
[0056] 1. Related concepts
[0057] 1. Spline: A smooth curve can be defined by a set of control points, which is used to create paths, shapes or animation key points. Control points can be set or modified by manual adjustment or automatic generation to adjust the overall shape of the smooth curve.
[0058] 2. Ray detection: In game engines, the basic function of ray detection is often used in the scene editing stage and the game stage. The basic principle is to start from the world position of a point in the scene and emit a ray in another direction. This ray has a specific length. If the surface of an object can be detected within the length, it can be determined that the detection is successful, otherwise the detection fails. This method is often used in target detection requirements, such as determining whether there is an object in front, whether a shooting game hits the player, etc.
[0059] 2. Related technologies
[0060] At present, in order to reduce the workload of model makers and special effects animation makers, we can consider reducing the diversity of resources such as extendable models in the scene, let model makers make models of several specific forms, and make fixed special effects animation effects or skeletal animation effects based on these models, and use methods such as scaling and rotating models in the scene to increase the complexity of the scene.
[0061] However, the above method still requires pre-production of extension effects, which are non-real-time and difficult to adapt to arbitrary scenes or frequently changing scenes, making it difficult to achieve resource reuse.
[0062] Another way is bone IK (Inverse Kinematics, a technology that uses a skeletal system to simulate the movement of an object), which is to bind a dynamic bone to the model and determine the extension effect based on the movement changes of the dynamic bone in the scene.
[0063] However, although the extension effect obtained by the above method is real-time, it can only achieve simple one-segment changes, and cannot achieve multi-segment changes. In addition, the extension of the model depends on the extension and lengthening of the skeleton, but the skeleton cannot be lengthened too much, that is, it cannot achieve an effect similar to infinite extension. In addition, the skeleton IK method cannot achieve model branches and extension of model branches, such as plant branches, pipe branches, etc.
[0064] Figure 1 A model generation method provided by one embodiment of the present disclosure is shown. Figure 1 As shown, the method includes the following steps S101 to S110.
[0065] Step S101: Determine a spline starting point Q0, a starting detection direction D0, and a starting extension direction V0 in a virtual scene.
[0066] In one of the embodiments of the present disclosure, the virtual scene may be a virtual scene provided in a game.
[0067] In one embodiment of the present disclosure, the starting point Q0, the starting detection direction D0, and the starting extension direction V0 may be randomly determined in the virtual scene. Optionally, the starting detection direction D0 and the starting extension direction V0 may be perpendicular to each other. Optionally, the starting detection direction D0 and the starting extension direction V0 may not be perpendicular to each other.
[0068] In one embodiment of the present disclosure, the starting point Q0 can be determined in the virtual scene in the following manner, including: controlling the virtual character to perform a virtual behavior; determining the interaction position point between the virtual character and the virtual surface in the virtual scene when performing the virtual behavior as the starting point Q0.
[0069] In this embodiment, the virtual character in the virtual scene can perform virtual behaviors (such as using skills, outputting attacks, etc.), and the virtual character can interact with virtual surfaces in the virtual scene (such as the ground, walls, object surfaces, etc.) when performing the virtual behaviors. For example, according to the logic set in the game, the user can control the virtual character to use a skill in a certain direction in the virtual scene. The skill can be to launch spider silk, generate vines at the interaction position point of the virtual surface in the virtual scene in that direction, and so on. Then, ray detection can be performed from the virtual character along the direction in which the skill is used to determine the scene position point that interacts with the virtual scene along the direction in which the skill is used, that is, the interaction position point, and the interaction position point can be used as the starting point Q0.
[0070] In one embodiment of the present disclosure, the starting extension direction V0 may be determined in the virtual scene in the following manner, including:
[0071] According to the virtual character and the starting point Q0, a starting extension direction V0 perpendicular to the starting detection direction D0 is determined.
[0072] In this embodiment, the direction of the line from the virtual character to the starting point Q0 can be cross-multiplied with the normal direction of the starting point Q0 to obtain the tangent direction of the starting point Q0, and then the normal direction of the starting point Q0 and the tangent direction of the starting point Q0 can be cross-multiplied to obtain the starting extension direction V0 perpendicular to the starting detection direction D0.
[0073] In one embodiment of the present disclosure, the starting detection direction D0 may be determined in the virtual scene in the following manner, including:
[0074] The opposite direction of the normal direction of the starting point Q0 is determined as the starting detection direction D0.
[0075] Step S102: Determine the starting auxiliary point P0 according to the starting point Q0.
[0076] In one of the embodiments of the present disclosure, a starting auxiliary point P0 may be determined at a second preset distance H from the starting point Q0 in the starting detection direction D0.
[0077] In the present disclosure, the continuous points are used to form an extension path of the segmented model, and the auxiliary points are used to assist in the calculation and generation of the continuous points.
[0078] Step S103: determining a first auxiliary point P1 at a first preset distance L from the starting auxiliary point P0 in the starting extension direction V0.
[0079] In one embodiment of the present disclosure, it is possible to detect whether there is a virtual surface within a first preset distance L from the starting point Q0 in the starting extension direction V0 by means of ray detection, that is, whether there is an obstacle within the range of the first preset distance L from the starting point Q0 along the starting extension direction V0; if it is detected that there is no virtual surface within the first preset distance L from the starting point Q0 in the starting extension direction V0, such as Figure 2 As shown, a first auxiliary point P1 may be determined at a first preset distance L from the starting auxiliary point P0 in the starting extension direction V0, that is, P1 = P0 + L*V0.
[0080] If it is detected that a virtual surface exists within a first preset distance L from the starting point Q0 in the starting extension direction V0, the next continuous point can be determined by referring to the relevant embodiments of the case "If it is detected that a virtual surface exists within a first preset distance L from the second continuous point Q2 in the starting extension direction V0" below, the next extension direction can be obtained by rotating the starting extension direction V0, the next detection direction can be obtained by rotating the starting detection direction D0, and the next auxiliary point can be determined.
[0081] Step S104: emitting rays from the first auxiliary point P1 along the initial detection direction D0 to perform ray detection.
[0082] like Figure 2 As shown, a ray may be emitted from the first auxiliary point P1 along the starting detection direction D0 to perform ray detection. The ray emitted for ray detection has a specific length, which may be the second preset distance H.
[0083] Step S105: if a virtual surface in the virtual scene is detected from the first auxiliary point P1 along the initial detection direction D0, determine the intersection of the ray from the first auxiliary point P1 along the initial detection direction D0 and the detected virtual surface as the first continuous point Q1 of the spline.
[0084] like Figure 2 As shown, if a virtual surface in a virtual scene is detected from the first auxiliary point P1 along the starting detection direction D0 by ray detection, the intersection point between the ray emitted for ray detection and the currently detected virtual surface can be determined as the first continuous point Q1 of the spline.
[0085] Step S106: Generate a preconfigured segment model between the starting point Q0 and the first continuous point Q1.
[0086] By connecting the starting point Q0 and the first continuous point Q1, a spline can be obtained. Currently, the spline includes two determined continuous points, namely the starting point Q0 and the first continuous point Q1. The preconfigured segment model can be rendered and displayed between the starting point Q0 and the first continuous point Q1, thereby generating a segment model from the starting point Q0 to the first continuous point Q1.
[0087] Optionally, the segmented model may include a plant model (e.g., a vine model of a specific length, a branch model, etc.), a filament model (e.g., a spider silk model of a specific length, a silk model, etc.), an object model (e.g., a pipe model of a specific length, a rope model, a cable model, etc.). The present disclosure does not specifically limit the parameters such as the shape and color of the segmented model. Figure 3 As shown, a cylindrical segmented model is shown, which can be used to simulate tree branches, pipes, etc.
[0088] Optionally, the segmentation model may be determined based on a virtual behavior performed by a virtual character. For example, if the virtual behavior performed by the virtual character is a skill of using spider silk to shoot, the segmentation model may select a spider silk model.
[0089] Step S107: determining a second auxiliary point P2 at a first preset distance L from the first auxiliary point P1 in the initial extension direction V0.
[0090] In one embodiment of the present disclosure, it is possible to detect whether there is a virtual surface within a first preset distance L from the first continuous point Q1 in the starting extension direction V0 by means of ray detection, that is, whether there is an obstacle within the range of the first preset distance L from the first continuous point Q1 along the starting extension direction V0; if it is detected that there is no virtual surface within the first preset distance L from the first continuous point Q1 in the starting extension direction V0, such as Figure 4 As shown, a second auxiliary point P2 may be determined at a first preset distance L from the first auxiliary point P1 in the starting extension direction V0, that is, P2 = P1 + L*V0.
[0091] In one of the embodiments of the present disclosure, before determining the second auxiliary point P2, the starting extension direction V0 can be randomly disturbed so that the starting extension direction V0 undergoes random changes, and then the second auxiliary point P2 is determined at a first preset distance L from the first auxiliary point P1 on the starting extension direction V0 after the random disturbance.
[0092] In this embodiment, each time the next auxiliary point is determined at a first preset distance L from the previous auxiliary point in the current extension direction, the extension direction is first randomly perturbed, so that the changes of the spline lines can be richer and more natural, especially for some complex vein models (such as plant models) with a rich and random vein distribution effect.
[0093] Step S108: emitting rays from the second auxiliary point P2 along the initial detection direction D0 to perform ray detection.
[0094] like Figure 4 As shown, rays can be emitted from the second auxiliary point P2 along the starting detection direction D0 to perform ray detection.
[0095] Step S109: if a virtual surface in the virtual scene is detected from the second auxiliary point P2 along the initial detection direction D0, determine the intersection of the ray from the second auxiliary point P2 along the initial detection direction D0 and the detected virtual surface as the second continuous point Q2 of the spline.
[0096] like Figure 4 As shown, if a virtual surface in the virtual scene is detected from the second auxiliary point P2 along the starting detection direction D0 through ray detection, the intersection of the ray emitted for ray detection and the currently detected virtual surface can be determined as the second continuous point Q2 of the spline.
[0097] Step S110: generating a segment model between the first continuous point Q1 and the second continuous point Q2.
[0098] A spline can be obtained by connecting the first continuous point Q1 and the second continuous point Q2. Currently, the spline includes three determined continuous points, namely the starting point Q0, the first continuous point Q1 and the second continuous point Q2. The preconfigured segmented model can be rendered and displayed between the first continuous point Q1 and the second continuous point Q2, thereby generating a segmented model of the first continuous point Q1 and the second continuous point Q2.
[0099] At this point, the first segment model is generated between the starting point Q0 and the first continuous point Q1, and the second segment model is generated between the first continuous point Q1 and the second continuous point Q2 in sequence, thereby obtaining an extension effect of the segment model extending over time.
[0100] The model generation method provided by the present disclosure determines a spline starting point Q0, a starting detection direction D0 and a starting extension direction V0 in a virtual scene; determines a starting auxiliary point P0 according to the starting point Q0; determines a first auxiliary point P1 at a first preset distance L from the starting auxiliary point P0 on the starting extension direction V0; emits rays from the first auxiliary point P1 along the starting detection direction D0 to perform ray detection; if a virtual surface in the virtual scene is detected, determines that the intersection of the ray from the first auxiliary point P1 along the starting detection direction D0 and the detected virtual surface is the first continuous point Q1 of the spline; and then generates a segmented model between the starting point Q0 and the first continuous point Q1. Then, a second auxiliary point P2 is determined at a first preset distance L from the first auxiliary point P1 on the starting extension direction V0; a ray is emitted from the second auxiliary point P2 along the starting detection direction D0 to perform ray detection; if a virtual surface in the virtual scene is detected from the second auxiliary point P2 along the starting detection direction D0, the intersection of the ray from the second auxiliary point P2 along the starting detection direction D0 and the detected virtual surface is determined as the second continuous point Q2 of the spline; and then the next segmented model is generated between the first continuous point Q1 and the second continuous point Q2. The present disclosure can perform ray detection from auxiliary points, determine continuous points on the detected virtual surface, and determine the next auxiliary point and continuous point by the detection direction and the extension direction, and generate a segmented model between adjacent continuous points, thereby achieving a real-time segmented model extension effect. The extension effect of the segmented model can adapt to the virtual scene environment where the model is located in real time, without the need to pre-make an extendable model and a model extension animation, thereby avoiding the problem of resource waste caused by difficulty in resource reuse.
[0101] In one of the embodiments of the present disclosure, the model generation method may further include the following steps S201 to S202.
[0102] Step S201: Detect whether there is a virtual surface within a first preset distance L from the second continuous point Q2 in the starting extension direction V0.
[0103] It may be possible to detect whether a virtual surface exists within a first preset distance L from the second continuous point Q2 in the starting extension direction V0 by means of ray detection.
[0104] Step S202: If a virtual surface is detected within a first preset distance L from the second continuous point Q2 in the initial extension direction V0, a third continuous point Q3 of the spline is determined as the intersection of the ray from the second continuous point Q2 along the initial extension direction V0 and the detected virtual surface.
[0105] like Figure 5As shown, if it is detected that a virtual surface exists within the first preset distance L from the second continuous point Q2 on the starting extension direction V0, that is, it is determined that there is an obstacle within the range of the first preset distance L from the second continuous point Q2 along the starting extension direction V0, then the intersection of the ray from the second continuous point Q2 along the starting extension direction V0 and the detected virtual surface can be determined as the third continuous point Q3 of the spline.
[0106] In one of the embodiments of the present disclosure, the model generation method may further include the following step S203.
[0107] Step S203: Generate a segment model between the second continuous point Q2 and the third continuous point Q3.
[0108] After obtaining the next continuous point of the second continuous point Q2, ie, the third continuous point Q3, the segmented model may be rendered and displayed between the second continuous point Q2 and the third continuous point Q3, thereby generating a third segmented model between the second continuous point Q2 and the third continuous point Q3.
[0109] In one of the embodiments of the present disclosure, the model generation method may further include the following steps S204 to S206.
[0110] Step S204: determine the opposite direction of the normal direction of the third continuous point Q3 as the first detection direction D1.
[0111] In this step, the next detection direction needs to be determined. Since there is an obstacle within the first preset distance L from the second continuous point Q2 along the initial extension direction V0, the current detection direction needs to be changed from the initial detection direction D0 to the first detection direction D1.
[0112] Step S205: rotating the starting extension direction V0 with the cross product direction of the starting detection direction D0 and the starting extension direction V0 as the axis, so that there is no virtual surface within a first preset distance from the third continuous point Q3 on the rotated starting extension direction V0, and obtaining a first extension direction V1.
[0113] In this step, the next extension direction needs to be determined. Since there is an obstacle within the first preset distance L from the second continuous point Q2 along the initial extension direction V0, the current extension direction needs to be changed from the initial extension direction V0 to the first extension direction V1.
[0114] In one of the embodiments of the present disclosure, a first basic angle C may be preconfigured. The first basic angle C is the step length of each rotation. The first basic angle C may be, for example, 1°, 2°, 5°, etc.
[0115] In this embodiment, the following first rotation configuration can be performed in advance: when the smaller angle between the current detection direction and the current extension direction is a clockwise angle, perform a clockwise rotation; when the smaller angle between the current detection direction and the current extension direction is a counterclockwise angle, perform a counterclockwise rotation.
[0116] like Figure 5 As shown, the cross product direction of the starting detection direction D0 and the starting extension direction V0 is S0. According to the above configuration, when the starting detection direction D0 and the starting extension direction V0 are at a clockwise angle, the starting extension direction V0 is rotated clockwise with the S0 direction as the axis, and the angle of each rotation is C. After each rotation, the extended direction after rotation is used to detect whether there is a virtual surface within the first preset distance L from the third continuous point Q3 in the extended direction after rotation. When the existence of the virtual surface is detected, the extension direction continues to be rotated clockwise by the angle C until it is detected that there is no virtual surface, and the current extension direction can be set as the next extension direction, that is, the first extension direction V1.
[0117] Step S206: determining a third auxiliary point P3 at a second preset distance H from the third continuous point Q3 in the normal direction of the third continuous point Q3.
[0118] In this step, it is necessary to determine the next auxiliary point of the second auxiliary point P2, that is, the third auxiliary point P3. The third auxiliary point P3 can be used to assist in the calculation and generation of the fourth continuous point Q4.
[0119] In one of the embodiments of the present disclosure, the model generation method may further include the following steps S207 to S209.
[0120] Step S207: Detect whether there is a virtual surface within a first preset distance L from the third continuous point Q3 in the first extension direction V1.
[0121] In this step, after changing the starting extension direction V0 to the first extension direction V1, changing the starting detection direction D0 to the first detection direction D1, and determining the third continuous point Q3 and the third auxiliary point P3, it is possible to continue to use ray detection to detect whether there is a virtual surface within the first preset distance L from the third continuous point Q3 on the first extension direction V1.
[0122] Step S208: If it is detected that there is no virtual surface within the first preset distance L from the third continuous point Q3 in the first extension direction V1, a fourth auxiliary point P4 is determined at the first preset distance L from the third auxiliary point P3 in the first extension direction V1.
[0123] If it is detected that there is no virtual surface within the first preset distance L from the third continuous point Q3 in the first extension direction V1, the next auxiliary point of the third auxiliary point P3, ie, the fourth auxiliary point P4, may be determined.
[0124] Step S209: emitting rays from the fourth auxiliary point P4 along the first detection direction D1 to perform ray detection.
[0125] Continue to emit rays from the fourth auxiliary point P4 along the current detection direction to perform ray detection, and then continue to generate the next segment model in a cycle.
[0126] In one of the embodiments of the present disclosure, the model generation method may further include the following steps S301 to S304.
[0127] Step S301: Detect whether there is a virtual surface within a first preset distance L from the second continuous point Q2 in the starting extension direction V0.
[0128] In this embodiment, it is possible to detect whether there is an obstacle within the range of the first preset distance L forward from the second continuous point Q2 along the starting extension direction V0 by means of ray detection.
[0129] Step S302: If it is detected that there is no virtual surface within the first preset distance L from the second continuous point Q2 in the starting extension direction V0, a third auxiliary point P3 is determined at the first preset distance L from the second auxiliary point P2 in the starting extension direction V0.
[0130] like Figure 6 As shown, if no obstacle exists within the range of the first preset distance L forward from the second continuous point Q2 along the starting extension direction V0, a third auxiliary point P3 can be determined at the first preset distance L from the second auxiliary point P2 on the starting extension direction V0.
[0131] Step S303: emitting rays from the third auxiliary point P3 along the initial detection direction D0 to perform ray detection.
[0132] like Figure 6 As shown, a ray having a length of a second preset distance H may be emitted from the third auxiliary point P3 along the starting detection direction D0 to perform ray detection.
[0133] Step S304: If no virtual surface in the virtual scene is detected from the third auxiliary point P3 along the initial detection direction D0, a third continuous point Q3 is determined at a second preset distance H from the third auxiliary point P3 in the initial detection direction D0.
[0134] like Figure 6As shown, if the virtual surface in the virtual scene is not detected from the third auxiliary point P3 along the starting detection direction D0, a third continuous point Q3 can be determined at a second preset distance H from the third auxiliary point P3 on the starting detection direction D0, wherein, since the ray emitted from the third auxiliary point P3 along the starting detection direction D0 does not intersect with the virtual surface in the virtual scene, the third continuous point Q3 is a suspended continuous point.
[0135] like Figure 6 As shown, multiple suspended continuous points can be generated in sequence according to the above method.
[0136] In one of the embodiments of the present disclosure, the model generation method may further include the following steps S305 - 1 .
[0137] Step S305 - 1 : If the virtual surface in the virtual scene is not detected from different auxiliary points along the initial detection direction D0 for a period of time not exceeding a preset number (eg, 5 times, 8 times, 10 times, 12 times), the third auxiliary point P3 and the third continuous point Q3 are retained.
[0138] Exemplarily, the preset number of times is 10 times. If the number of times the virtual surface is not detected from different auxiliary points along the starting detection direction D0 does not exceed 10 times, that is, the number of suspended continuous points is less than or equal to 10, then all the suspended continuous points and the auxiliary points corresponding to the suspended splines can be retained, so that the spline forms a bridge between the two virtual surfaces.
[0139] Optionally, the spline portion formed by connecting the suspended continuous points may be subjected to curve processing to simulate the draping effect of the segmented model under the action of gravity.
[0140] In one of the embodiments of the present disclosure, the model generation method may further include the following step S305-2.
[0141] Step S305 - 2 : If the virtual surface in the virtual scene is not detected from different auxiliary points along the initial detection direction D0 for more than a preset number of times (eg, 5 times, 8 times, 10 times, 12 times), the third auxiliary point P3 and the third continuous point Q3 are deleted.
[0142] Exemplarily, the preset number of times is 10 times. If the number of times the virtual surface is not detected from different auxiliary points along the starting detection direction D0 exceeds 10 times in a row, that is, the number of suspended continuous points is greater than 10, then all suspended continuous points and the auxiliary points corresponding to the suspended splines can be deleted, because the distance between the two virtual surfaces is too far, and therefore no bridge is formed.
[0143] In one of the embodiments of the present disclosure, the model generation method may further include the following steps S306 to S308.
[0144] Step S306: determining a temporary auxiliary point Pt at a first preset distance L from the second auxiliary point P2 in the initial extension direction V0.
[0145] In this embodiment, if all the dangling continuous points and the auxiliary points corresponding to the dangling splines are deleted, no bridge is formed, such as Figure 7 As shown, a temporary auxiliary point Pt may be determined at a first preset distance L from the second auxiliary point P2 in the starting extension direction V0.
[0146] Step S307: Rotate the second auxiliary point P2, the temporary auxiliary point Pt, the starting detection direction D0 and the starting extension direction V0 with the cross product direction of the starting detection direction D0 and the starting extension direction V0 as the axis, so that a virtual surface exists within a second preset distance H from the rotated temporary auxiliary point Pt on the rotated starting detection direction D0; the virtual surface that exists within a second preset distance H from the rotated temporary auxiliary point Pt on the rotated starting detection direction D0 is the target virtual surface.
[0147] Step S308: determining the intersection of the rotated initial detection direction D0 and the target virtual surface as the third continuous point Q3 of the spline.
[0148] In this embodiment, it is necessary to determine the next continuous point of the second continuous point Q2, that is, the third continuous point Q3, by rotation.
[0149] In one embodiment of the present disclosure, a second basic angle R may be preconfigured, and the second basic angle R is the step length of each rotation, and the second basic angle R may be, for example, 1°, 2°, 5°, etc. The second basic angle R may be the same as or different from the value of the first basic angle C, and the present disclosure does not limit this.
[0150] In this embodiment, the following second rotation configuration can be performed in advance: when the smaller angle between the current detection direction and the current extension direction is a clockwise angle, counterclockwise rotation is performed; when the smaller angle between the current detection direction and the current extension direction is a counterclockwise angle, clockwise rotation is performed.
[0151] like Figure 7As shown, the cross product direction of the starting detection direction D0 and the starting extension direction V0 is S0. According to the above configuration, when the starting detection direction D0 and the starting extension direction V0 are at a clockwise angle, the second auxiliary point P2, the temporary auxiliary point Pt, the starting detection direction D0 and the starting extension direction V0 are taken as a whole, and the whole is rotated counterclockwise with the S0 direction as the axis, and the angle of each rotation is R. After each rotation, the rotated detection direction D'0 is used to emit rays from the rotated temporary auxiliary point P't along the rotated detection direction D'0 to perform ray detection. If the virtual surface in the virtual scene is not detected from the rotated temporary auxiliary point P't along the rotated detection direction D'0, that is, the rotated detection direction D'0 intersects with the virtual surface in the virtual scene, then the whole continues to be rotated counterclockwise by an angle R until the virtual surface is detected, and the intersection point of the current detection direction and the above-mentioned intersecting virtual surface can be determined as the third continuous point Q3 of the spline.
[0152] In one of the embodiments of the present disclosure, the model generation method may further include the following steps S309 to S311.
[0153] Step S309: determining the opposite direction of the normal direction of the third continuous point Q3 as the first detection direction D1;
[0154] Step S310: determining the initial extension direction V0 after rotation as the first extension direction V1;
[0155] Step S311: determining a third auxiliary point P3 at a second preset distance H from the third continuous point Q3 in the normal direction of the third continuous point Q3.
[0156] In this embodiment, since the virtual surface where the third continuous point Q3 is located is changed compared to the virtual surface where the second continuous point Q2 is located, it is necessary to determine the next extension direction, the next detection direction, and the next auxiliary point.
[0157] In one of the embodiments of the present disclosure, the model generation method may further include the following steps S401 to S404.
[0158] Step S401: Detect whether there is a virtual surface within a first preset distance L from the second continuous point Q2 in the starting extension direction V0;
[0159] Step S402: if it is detected that there is no virtual surface within the first preset distance L from the second continuous point Q2 in the starting extension direction V0, a temporary auxiliary point Pt is determined at the first preset distance L from the second auxiliary point P2 in the starting extension direction V0;
[0160] Step S403: Rotate the second auxiliary point P2, the temporary auxiliary point Pt, the starting detection direction D0 and the starting extension direction V0 with the cross product direction of the starting detection direction D0 and the starting extension direction V0 as the axis, so that a virtual surface exists within a second preset distance H from the rotated temporary auxiliary point Pt on the rotated starting detection direction D0; the virtual surface that exists within the second preset distance H from the rotated temporary auxiliary point Pt on the rotated starting detection direction D0 is the target virtual surface;
[0161] Step S404: determining the intersection of the rotated initial detection direction D0 and the target virtual surface as the third continuous point Q3 of the spline.
[0162] The implementation method of this embodiment can refer to the embodiment provided by the above-mentioned steps S301 to S304. The difference between this embodiment and the embodiment provided by steps S301 to S304 is that the embodiment provided by steps S301 to S304 is an embodiment adopted when an attempt to build a bridge fails, while in this embodiment, when the virtual surface is not detected during ray detection from the current auxiliary point along the current detection direction, no attempt is made to build a bridge, and the next continuous point is directly determined by this embodiment.
[0163] In one of the embodiments of the present disclosure, the model generation method may further include the following steps S501 to S505.
[0164] Step S501: determining a first branch extending direction V0-0 for a first auxiliary point P1.
[0165] In this embodiment, a branch spline may be generated on the spline, and the continuous points on the branch spline may also be generated according to the generation method of the continuous points on the main spline.
[0166] For example, Figure 8 As shown, for example, if a branch spline needs to be generated at the first continuous point Q1 of the main spline, the first branch extension direction V0-0 can be determined for the first auxiliary point P1 corresponding to the first continuous point Q1, wherein the first branch extension direction V0-0 can be obtained by randomly rotating the current extension direction on the main spline. Optionally, when rotating the current extension direction to obtain the first branch extension direction V0-0, the rotation can be performed on the plane where the first continuous point Q1 is located, that is, the current extension direction that needs to be rotated and the first branch extension direction V0-0 can be on the same plane.
[0167] like Figure 8 As shown, the starting branch continuous point Q1-0 of the branch spline at the first continuous point Q1 is the first continuous point Q1.
[0168] Step S502: determining a first branch auxiliary point P1-1 at a first preset distance L from the first auxiliary point P1 in the first branch extension direction V0-0.
[0169] like Figure 8 As shown, ray detection can be used to detect whether there is a virtual surface within the first preset distance L from the first continuous point Q1 on the first branch extension direction V0-0, that is, whether there is an obstacle within the range of the first preset distance L from the first continuous point Q1 along the first branch extension direction V0-0 forward; if it is detected that there is no virtual surface within the first preset distance L from the first continuous point Q1 on the first branch extension direction V0-0, the first branch auxiliary point P1-1 can be determined at the first preset distance L from the first auxiliary point P1 on the first branch extension direction V0-0.
[0170] Step S503: emitting rays from the first branch auxiliary point P1-1 along the initial detection direction D0 to perform ray detection.
[0171] like Figure 8 As shown, a ray having a length of a second preset distance H may be emitted from the first branch auxiliary point P1 - 1 along the starting detection direction D0 to perform ray detection.
[0172] Step S504: If a virtual surface in the virtual scene is detected from the first branch auxiliary point P1-0 along the starting detection direction D0, determine that the intersection of the ray from the first branch auxiliary point P2-0 along the starting detection direction D0 and the detected virtual surface is the first branch continuous point Q1-1 of the first continuous point Q1.
[0173] like Figure 8 As shown, if a virtual surface in a virtual scene is detected from the first branch auxiliary point P1-0 along the starting detection direction D0 through ray detection, the intersection of the ray emitted for ray detection and the currently detected virtual surface can be taken as the first branch continuous point Q1-1 of the first continuous point Q1.
[0174] Step S505: Generate a segment model between the first continuous point Q1 and the first branch continuous point Q1-1.
[0175] By connecting the first continuous point Q1 and the first branch continuous point Q1-1, a branch spline corresponding to the first continuous point Q1 can be obtained. Currently, the branch spline includes two determined continuous points, namely the first continuous point Q1 (i.e., the starting branch continuous point Q1-0) and the first branch continuous point Q1-1. The segmented model can be rendered and displayed between the first continuous point Q1 and the first branch continuous point Q1-1, thereby generating a segmented model from the first continuous point Q1 to the first branch continuous point Q1-1.
[0176] In one embodiment of the present disclosure, in the above step S106 , the following steps S601 to S602 may be further performed to generate a segment model of an adaptive length between the first continuous point Q1 and the second continuous point Q2 .
[0177] Step S601: Determine a first axial dimension of the segment model adapted between the starting point Q0 and the first continuous point Q1 according to the distance between the starting point Q0 and the first continuous point Q1.
[0178] In this embodiment, the distance between the starting point Q0 and the first continuous point Q1 may be determined as the first axial dimension of the segment model adapted between the starting point Q0 and the first continuous point Q1.
[0179] Step S602: Generate a segmented model between the starting point Q0 and the first continuous point Q1 according to the first axial dimension.
[0180] In this embodiment, the segmented model of the basic axial dimension can be scaled in the axial direction (i.e., the length direction) to scale the segmented model into a segmented model with an axial dimension (i.e., length) of the first axial dimension, and the segmented model with an axial dimension (i.e., length) of the first axial dimension can be rendered and displayed between the starting point Q0 and the first continuous point Q1.
[0181] In one embodiment of the present disclosure, in the above step S106, the following steps S603 to S605 may be performed to generate a segment model of adaptive thickness between the starting point Q0 and the first continuous point Q1, including:
[0182] Step S603: Determine the preset radial dimension as the first front end radial dimension adapted by the front end of the segmented model between the starting point Q0 and the first continuous point Q1.
[0183] For the first segment model between the starting point Q0 and the first continuous point Q1, the preset radial dimension may be determined as the first front end radial dimension of the first segment model.
[0184] Among them, the segmentation model between two adjacent continuous points, the front end of the segmentation model is the end of the segmentation model close to the continuous point generated earlier, and the back end of the segmentation model is the end of the segmentation model close to the continuous point generated later.
[0185] Step S604: Determine the first rear end radial size of the segmented model adapted between the starting point Q0 and the first continuous point Q1 according to the first front end radial size and the number of currently determined continuous points.
[0186] In an optional embodiment, the first rear end radial dimension adapted to the rear end of the segmented model between the starting point Q0 and the first continuous point Q1 can be determined according to the first front end radial dimension and the number of currently determined continuous points by the following formula.
[0187] Scale nEnd =Scale 0Start *(1-(n+1) / PointNum)
[0188] Among them, the range of n is [0, PointNum-1], PointNum represents the number of continuous points currently determined on a single spline, Scale 0Start Indicates the preset radial size, Scale nEnd It represents the radial dimension of the rear end of the segmented model labeled n.
[0189] Step S605: Generate a segmented model between the starting point Q0 and the first continuous point Q1 according to the first front end radial dimension and the first rear end radial dimension.
[0190] The segmented model rendered and displayed between the starting point Q0 and the first continuous point Q1 has a front radial dimension that is a first front radial dimension, and a rear radial dimension that is a first rear radial dimension.
[0191] With reference to the above-mentioned embodiment, a segmented model with an adaptive length can be generated between the first continuous point Q1 and the second continuous point Q2 in the following manner, including: determining the second axial dimension adapted by the segmented model between the first continuous point Q1 and the second continuous point Q2 according to the distance between the first continuous point Q1 and the second continuous point Q2; and generating the segmented model between the first continuous point Q1 and the second continuous point Q2 according to the second axial dimension.
[0192] With reference to the above-mentioned embodiment, a segmented model with adapted thickness can be generated between the first continuous point Q1 and the second continuous point Q2 in the following manner, including: determining a first rear end radial dimension to be a second front end radial dimension that the front end of a preconfigured segmented model is adapted to between the first continuous point Q1 and the second continuous point Q2; determining a second rear end radial dimension that the rear end of the segmented model is adapted to between the first continuous point Q1 and the second continuous point Q2 based on the second front end radial dimension and the number of currently determined continuous points; generating a segmented model between the first continuous point Q1 and the second continuous point Q2 based on the second front end radial dimension and the second rear end radial dimension.
[0193] The front radial dimension of the segment model between the first continuous point Q1 and the second continuous point Q2 is the same as the rear radial dimension of the segment model between the starting point Q0 and the first continuous point Q1, so that the thickness of two adjacent segment models can be smoothly transitioned.
[0194] In one of the embodiments of the present disclosure, the model generation method may further include the following steps: determining a target position on a spline; and generating a preconfigured additional model according to the target position.
[0195] The additional model may be, for example, a leaf model or a flower model.
[0196] Optionally, each time a segmented model of a specific length or a specific number is generated, a target position can be determined on the spline, and then an additional model can be generated near the surface or outside of the segmented model at the target position to avoid model penetration. In this way, the effect of the additional model gradually growing on the segmented model as it continues to extend can be achieved.
[0197] In an exemplary embodiment of the present disclosure, the segment model may stop being generated after being generated for a specific time or a specific number of segments, thereby ending the extension effect of the segment model.
[0198] Fig. 9 The splines generated by the exemplary embodiment of the present disclosure are shown, including branched splines.
[0199] Fig.10 The figure shows the spline generated by the exemplary embodiment of the present disclosure, wherein the extension direction is randomly perturbed each time the extension is made.
[0200] Fig.11 The bridging part of the spline generated by the exemplary embodiment of the present disclosure is shown.
[0201] Fig.12 The figure shows the model extension effect generated by the exemplary embodiment of the present disclosure.
[0202] Corresponding to the model generation method provided in the embodiment of the present disclosure, the embodiment of the present disclosure also provides a model generation device. Fig.13 As shown, the device 700 includes:
[0203] A first determination module 701 is used to determine a spline starting point, a starting detection direction and a starting extension direction in a virtual scene;
[0204] A second determining module 702 is used to determine a starting auxiliary point according to the starting point;
[0205] A third determining module 703 is used to determine a first auxiliary point at a first preset distance from the starting auxiliary point in the starting extension direction;
[0206] A first ray detection module 704, configured to emit rays from the first auxiliary point along the starting detection direction to perform ray detection;
[0207] A fourth determination module 705 is used to determine, if a virtual surface in the virtual scene is detected from the first auxiliary point along the starting detection direction, an intersection of a ray from the first auxiliary point along the starting detection direction and the detected virtual surface as a first continuous point of the spline;
[0208] A first model generating module 706, configured to generate a preconfigured segment model between the starting point and the first continuous point;
[0209] A fifth determining module 707, configured to determine a second auxiliary point at the first preset distance from the first auxiliary point in the starting extension direction;
[0210] A second ray detection module 708, configured to emit rays from the second auxiliary point along the starting detection direction to perform ray detection;
[0211] A sixth determination module 709 is configured to determine, if a virtual surface in the virtual scene is detected from the second auxiliary point along the starting detection direction, an intersection of a ray from the second auxiliary point along the starting detection direction and the detected virtual surface as a second continuous point of the spline;
[0212] The second model generating module 710 is configured to generate the segment model between the first continuous points and the second continuous points.
[0213] Optionally, the device is also used for:
[0214] Detecting whether there is a virtual surface within the first preset distance from the starting point in the starting extension direction;
[0215] The step of determining a first auxiliary point at a first preset distance from the starting auxiliary point in the starting extension direction includes:
[0216] If it is detected that no virtual surface exists within the first preset distance from the starting point in the starting extension direction, a first auxiliary point is determined at the first preset distance from the starting auxiliary point in the starting extension direction.
[0217] Optionally, the device is also used for:
[0218] Detecting whether there is a virtual surface within the first preset distance from the second continuous point in the starting extension direction;
[0219] If a virtual surface is detected within the first preset distance from the second continuous point in the starting extension direction, an intersection point of a ray from the second continuous point along the starting extension direction and the detected virtual surface is determined as a third continuous point of the spline.
[0220] Optionally, the device is also used for:
[0221] The segment model is generated between the second continuous point and the third continuous point.
[0222] Optionally, the device is also used for:
[0223] Determine the opposite direction of the normal direction of the third continuous point as the first detection direction;
[0224] Rotate the starting extension direction with the cross product direction of the starting detection direction and the starting extension direction as an axis so that no virtual surface exists within the first preset distance from the third continuous point in the rotated starting extension direction, thereby obtaining a first extension direction;
[0225] A third auxiliary point is determined at a second preset distance from the third continuous point in the normal direction of the third continuous point.
[0226] Optionally, the device is also used for:
[0227] detecting whether there is a virtual surface within the first preset distance from the third continuous point in the first extension direction;
[0228] If it is detected that no virtual surface exists within the first preset distance from the third continuous point in the first extension direction, determining a fourth auxiliary point at the first preset distance from the third auxiliary point in the first extension direction;
[0229] Rays are emitted from the fourth auxiliary point along the first detection direction to perform ray detection.
[0230] Optionally, the device is also used for:
[0231] Detecting whether there is a virtual surface within the first preset distance from the second continuous point in the starting extension direction;
[0232] If it is detected that there is no virtual surface within the first preset distance from the second continuous point in the starting extension direction, determining a third auxiliary point at the first preset distance from the second auxiliary point in the starting extension direction;
[0233] emitting rays from the third auxiliary point along the starting detection direction to perform ray detection;
[0234] If no virtual surface in the virtual scene is detected from the third auxiliary point along the starting detection direction, a third continuous point is determined at a second preset distance from the third auxiliary point in the starting detection direction.
[0235] Optionally, the device is also used for:
[0236] If the virtual surface in the virtual scene is not detected from different auxiliary points along the starting detection direction for a period of time that does not exceed a preset number of times in a row, the third auxiliary point and the third continuous point are retained.
[0237] Optionally, the device is also used for:
[0238] If the virtual surface in the virtual scene is not detected from different auxiliary points along the starting detection direction for more than a preset number of times in a row, the third auxiliary point and the third continuous point are deleted.
[0239] Optionally, the device is also used for:
[0240] Determine a temporary auxiliary point at the first preset distance from the second auxiliary point in the starting extension direction;
[0241] Rotate the second auxiliary point, the temporary auxiliary point, the starting detection direction and the starting extension direction with the cross product direction of the starting detection direction and the starting extension direction as the axis, so that a virtual surface exists within the second preset distance from the rotated temporary auxiliary point in the rotated starting detection direction; the virtual surface within the second preset distance from the rotated temporary auxiliary point in the rotated starting detection direction is the target virtual surface;
[0242] The intersection point of the rotated initial detection direction and the target virtual surface is determined as the third continuous point of the spline.
[0243] Optionally, the device is also used for:
[0244] Determine the opposite direction of the normal direction of the third continuous point as the first detection direction;
[0245] Determining the initial extension direction after rotation as the first extension direction;
[0246] A third auxiliary point is determined at the second preset distance from the third continuous point in the normal direction of the third continuous point.
[0247] Optionally, the device is also used for:
[0248] Detecting whether there is a virtual surface within the first preset distance from the second continuous point in the starting extension direction;
[0249] If it is detected that there is no virtual surface within the first preset distance from the second continuous point in the starting extension direction, determining a temporary auxiliary point at the first preset distance from the second auxiliary point in the starting extension direction;
[0250] Rotate the second auxiliary point, the temporary auxiliary point, the starting detection direction and the starting extension direction with the cross product direction of the starting detection direction and the starting extension direction as the axis, so that a virtual surface exists within the second preset distance from the rotated temporary auxiliary point in the rotated starting detection direction; the virtual surface that exists within the second preset distance from the rotated temporary auxiliary point in the rotated starting detection direction is the target virtual surface;
[0251] The intersection point of the rotated initial detection direction and the target virtual surface is determined as the third continuous point of the spline.
[0252] Optionally, the device is also used for:
[0253] determining a first branch extension direction for the first auxiliary point;
[0254] Determine a first branch auxiliary point at a first preset distance from the first auxiliary point in the extending direction of the first branch;
[0255] Emitting rays from the first branch auxiliary point along the starting detection direction to perform ray detection;
[0256] If a virtual surface in the virtual scene is detected from the first branch auxiliary point along the starting detection direction, determine an intersection of a ray from the first branch auxiliary point along the starting detection direction and the detected virtual surface as a first branch continuous point of the first continuous points;
[0257] The segment model is generated between the first continuous point and the first branch continuous point.
[0258] Optionally, determining the starting point in the virtual scene includes:
[0259] Controlling virtual characters to perform virtual behaviors;
[0260] The interaction position point between the virtual character and the virtual surface in the virtual scene when performing the virtual behavior is determined as the starting point.
[0261] Optionally, determining the starting extension direction in the virtual scene includes:
[0262] A starting extension direction perpendicular to the starting detection direction is determined according to the virtual character and the starting point.
[0263] Optionally, determining a starting extension direction perpendicular to the starting detection direction according to the virtual character and the starting point includes:
[0264] A cross product is performed between the direction of the line from the virtual character to the starting point and the normal direction of the starting point to obtain the tangent direction of the starting point;
[0265] A cross product is performed between the normal direction of the starting point and the tangent direction of the starting point to obtain a starting extension direction perpendicular to the starting detection direction.
[0266] Optionally, determining the starting detection direction in the virtual scene includes:
[0267] The opposite direction of the normal direction of the starting point is determined as the starting detection direction.
[0268] Optionally, generating a preconfigured segment model between the starting point and the first continuous point includes:
[0269] Determining a first axial dimension of the segmented model adapted between the starting point and the first continuous point according to the distance between the starting point and the first continuous point;
[0270] The segmented model is generated between the starting point and the first continuous point according to the first axial dimension.
[0271] Optionally, generating a preconfigured segment model between the starting point and the first continuous point includes:
[0272] Determine a preset radial dimension as a first front end radial dimension of the front end of the segmented model adapted between the starting point and the first continuous point;
[0273] Determine, according to the first front end radial dimension and the number of currently determined continuous points, a first rear end radial dimension of the rear end of the segmented model adapted between the starting point and the first continuous point;
[0274] The segmented model is generated between the starting point and the first continuous point according to the first front end radial dimension and the first rear end radial dimension.
[0275] Optionally, generating the segment model between the first continuous point and the second continuous point includes:
[0276] Determining a second axial dimension of the segmented model adapted between the first continuous point and the second continuous point according to the distance between the first continuous point and the second continuous point;
[0277] The segmented model is generated between the first continuous point and the second continuous point according to the second axial dimension.
[0278] Optionally, generating the segment model between the first continuous point and the second continuous point includes:
[0279] Determining the first rear end radial dimension to be a second front end radial dimension adapted to the front end of the preconfigured segmented model between the first continuous point and the second continuous point;
[0280] Determine, according to the second front end radial size and the number of currently determined continuous points, a second rear end radial size of the rear end of the segmented model adapted between the first continuous point and the second continuous point;
[0281] The segmented model is generated between the first continuous point and the second continuous point according to the second front end radial dimension and the second rear end radial dimension.
[0282] Optionally, determining the auxiliary starting point according to the starting point includes:
[0283] A starting auxiliary point is determined at a second preset distance from the starting point in the starting detection direction.
[0284] Optionally, determining a second auxiliary point at the first preset distance from the first auxiliary point in the starting extension direction includes:
[0285] Randomly perturbing the initial extension direction;
[0286] A second auxiliary point is determined at the first preset distance from the first auxiliary point in the initial extension direction after the random disturbance.
[0287] Optionally, the device is also used for:
[0288] determining a target position on the spline;
[0289] A preconfigured additional model is generated according to the target location.
[0290] The model generation device provided by the present disclosure determines the starting point, starting detection direction and starting extension direction of the spline in the virtual scene; determines the starting auxiliary point according to the starting point; determines the first auxiliary point at a first preset distance from the starting auxiliary point in the starting extension direction; emits rays from the first auxiliary point along the starting detection direction to perform ray detection; if a virtual surface in the virtual scene is detected, determines the intersection of the ray from the first auxiliary point along the starting detection direction and the detected virtual surface as the first continuous point of the spline; and then generates a segmented model between the starting point and the first continuous point. Then, determines the second auxiliary point at a first preset distance from the first auxiliary point in the starting extension direction; emits rays from the second auxiliary point along the starting detection direction to perform ray detection; if a virtual surface in the virtual scene is detected from the second auxiliary point along the starting detection direction, determines the intersection of the ray from the second auxiliary point along the starting detection direction and the detected virtual surface as the second continuous point of the spline; and then generates the next segmented model between the first continuous point and the second continuous point. The present invention can perform ray detection from auxiliary points, determine continuous points on the detected virtual surface, determine the next auxiliary point and continuous point through the detection direction and the extension direction, and generate a segmented model between adjacent continuous points, thereby achieving a real-time segmented model extension effect. The extension effect of the segmented model can adapt to the virtual scene environment where the model is located in real time, without the need to pre-make extensible models and model extension animations, thereby avoiding the problem of resource waste caused by difficulty in resource reuse.
[0291] Next, an electronic device provided by an embodiment of the present disclosure is introduced. Fig.14 , Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. The electronic device 800 may be deployed with the model generation device described in the embodiment of the present disclosure to implement the functions in the embodiment of the present disclosure. Specifically, the electronic device 800 includes: a receiver 801, a transmitter 802, a processor 803 and a memory 804 (the number of processors 803 in the electronic device 800 may be one or more, Fig.14 In the example of FIG. 801 , the processor 803 may include an application processor 8031 and a communication processor 8032. In some embodiments of the present disclosure, the receiver 801, the transmitter 802, the processor 803 and the memory 804 may be connected via a bus or other means.
[0292] The memory 804 may include a read-only memory and a random access memory, and provides instructions and data to the processor 803. A portion of the memory 804 may also include a non-volatile random access memory (NVRAM). The memory 804 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0293] The processor 803 controls the operation of the execution device. In a specific application, the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.
[0294] The method disclosed in the above embodiment of the present disclosure can be applied to the processor 803, or implemented by the processor 803. The processor 803 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 803. The above processor 803 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 803 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiment of the present disclosure. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiment of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 804, and the processor 803 reads the information in the memory 804 and completes the steps of the above method in combination with its hardware.
[0295] The receiver 801 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device. The transmitter 802 can be used to output digital or character information through the first interface; the transmitter 802 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 802 can also include a display device such as a display screen.
[0296] In the embodiment of the present disclosure, the application processor 8031 in the processor 803 is used to execute the model generation method in the embodiment of the present disclosure. It should be noted that the specific manner in which the application processor 8031 executes each step is based on the same concept as the various method embodiments in the present disclosure, and the technical effects brought about are the same as the various method embodiments in the present disclosure. For specific contents, please refer to the description in the method embodiments shown above in the present disclosure, and no further description will be given here.
[0297] The disclosed embodiment also provides a chip for executing instructions, which is used to execute the technical solution of the model generation method in the above embodiment.
[0298] The embodiment of the present disclosure also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a processor, the processor executes the technical solution of the model generation method in the above embodiment.
[0299] The present disclosure also provides a computer program product, including a computer program, which is used to execute the technical solution of the model generation method in the above embodiment when executed by a processor.
[0300] The computer readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or dedicated server.
[0301] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0302] Although the present disclosure is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present disclosure. Any person skilled in the art may make possible changes and modifications without departing from the spirit and scope of the present disclosure. Therefore, the scope of protection of the present disclosure shall be based on the scope defined by the claims of the present disclosure.
Claims
1. A model generation method, characterized in that: The method comprises: Determine the starting point, starting detection direction and starting extension direction of the spline in the virtual scene; According to the starting point, determining a starting auxiliary point; Determine a first auxiliary point at a first preset distance from the starting auxiliary point in the starting extension direction; emitting rays from the first auxiliary point along the starting detection direction to perform ray detection; If a virtual surface in the virtual scene is detected from the first auxiliary point along the starting detection direction, determine an intersection point of a ray from the first auxiliary point along the starting detection direction and the detected virtual surface as a first continuous point of the spline; generating a preconfigured segment model between the starting point and the first continuous point; Determine a second auxiliary point at the first preset distance from the first auxiliary point in the starting extension direction; emitting rays from the second auxiliary point along the starting detection direction to perform ray detection; If a virtual surface in the virtual scene is detected from the second auxiliary point along the starting detection direction, determine an intersection of a ray from the second auxiliary point along the starting detection direction and the detected virtual surface as a second continuous point of the spline; The segment model is generated between the first continuous points and the second continuous points.
2. The method according to claim 1, characterized in that: The method further comprises: Detecting whether there is a virtual surface within the first preset distance from the starting point in the starting extension direction; The step of determining a first auxiliary point at a first preset distance from the starting auxiliary point in the starting extension direction includes: If it is detected that no virtual surface exists within the first preset distance from the starting point in the starting extension direction, a first auxiliary point is determined at the first preset distance from the starting auxiliary point in the starting extension direction.
3. The method according to claim 1, characterized in that: The method further comprises: Detecting whether there is a virtual surface within the first preset distance from the second continuous point in the starting extension direction; If a virtual surface is detected within the first preset distance from the second continuous point in the starting extension direction, an intersection point of a ray from the second continuous point along the starting extension direction and the detected virtual surface is determined as a third continuous point of the spline.
4. The method according to claim 3, characterized in that The method further comprises: The segment model is generated between the second continuous point and the third continuous point.
5. The method according to claim 4, characterized in that The method further comprises: Determine the opposite direction of the normal direction of the third continuous point as the first detection direction; Rotate the starting extension direction with the cross product direction of the starting detection direction and the starting extension direction as an axis so that no virtual surface exists within the first preset distance from the third continuous point in the rotated starting extension direction, thereby obtaining a first extension direction; A third auxiliary point is determined at a second preset distance from the third continuous point in the normal direction of the third continuous point.
6. The method according to claim 5, characterized in that The method further comprises: detecting whether there is a virtual surface within the first preset distance from the third continuous point in the first extension direction; If it is detected that no virtual surface exists within the first preset distance from the third continuous point in the first extension direction, determining a fourth auxiliary point at the first preset distance from the third auxiliary point in the first extension direction; Rays are emitted from the fourth auxiliary point along the first detection direction to perform ray detection.
7. The method according to claim 1, characterized in that The method further comprises: Detecting whether there is a virtual surface within the first preset distance from the second continuous point in the starting extension direction; If it is detected that there is no virtual surface within the first preset distance from the second continuous point in the starting extension direction, determining a third auxiliary point at the first preset distance from the second auxiliary point in the starting extension direction; emitting rays from the third auxiliary point along the starting detection direction to perform ray detection; If no virtual surface in the virtual scene is detected from the third auxiliary point along the starting detection direction, a third continuous point is determined at a second preset distance from the third auxiliary point in the starting detection direction.
8. The method according to claim 7, characterized in that The method further comprises: If the virtual surface in the virtual scene is not detected from different auxiliary points along the starting detection direction for a period of time that does not exceed a preset number of times in a row, the third auxiliary point and the third continuous point are retained.
9. The method according to claim 7, characterized in that: The method further comprises: If the virtual surface in the virtual scene is not detected from different auxiliary points along the starting detection direction for more than a preset number of times in a row, the third auxiliary point and the third continuous point are deleted.
10. The method according to claim 9, characterized in that The method further comprises: Determine a temporary auxiliary point at the first preset distance from the second auxiliary point in the starting extension direction; Rotate the second auxiliary point, the temporary auxiliary point, the starting detection direction and the starting extension direction with the cross product direction of the starting detection direction and the starting extension direction as the axis, so that a virtual surface exists within the second preset distance from the rotated temporary auxiliary point in the rotated starting detection direction; the virtual surface within the second preset distance from the rotated temporary auxiliary point in the rotated starting detection direction is the target virtual surface; The intersection point of the rotated initial detection direction and the target virtual surface is determined as the third continuous point of the spline.
11. The method according to claim 10, characterized in that The method further comprises: Determine the opposite direction of the normal direction of the third continuous point as the first detection direction; Determining the initial extension direction after rotation as the first extension direction; A third auxiliary point is determined at the second preset distance from the third continuous point in the normal direction of the third continuous point.
12. The method according to claim 1, characterized in that The method further comprises: Detecting whether there is a virtual surface within the first preset distance from the second continuous point in the starting extension direction; If it is detected that there is no virtual surface within the first preset distance from the second continuous point in the starting extension direction, determining a temporary auxiliary point at the first preset distance from the second auxiliary point in the starting extension direction; Rotate the second auxiliary point, the temporary auxiliary point, the starting detection direction and the starting extension direction with the cross product direction of the starting detection direction and the starting extension direction as the axis, so that a virtual surface exists within the second preset distance from the rotated temporary auxiliary point in the rotated starting detection direction; the virtual surface that exists within the second preset distance from the rotated temporary auxiliary point in the rotated starting detection direction is the target virtual surface; The intersection point of the rotated initial detection direction and the target virtual surface is determined as the third continuous point of the spline.
13. The method according to claim 1, characterized in that The method further comprises: determining a first branch extension direction for the first auxiliary point; Determine a first branch auxiliary point at a first preset distance from the first auxiliary point in the extending direction of the first branch; Emitting rays from the first branch auxiliary point along the starting detection direction to perform ray detection; If a virtual surface in the virtual scene is detected from the first branch auxiliary point along the starting detection direction, determine an intersection of a ray from the first branch auxiliary point along the starting detection direction and the detected virtual surface as a first branch continuous point of the first continuous points; The segment model is generated between the first continuous point and the first branch continuous point.
14. The method according to claim 1, characterized in that Determining the starting point in the virtual scene includes: Controlling virtual characters to perform virtual behaviors; The interaction position point between the virtual character and the virtual surface in the virtual scene when performing the virtual behavior is determined as the starting point.
15. The method according to claim 14, characterized in that Determining the starting extension direction in the virtual scene includes: A starting extension direction perpendicular to the starting detection direction is determined according to the virtual character and the starting point.
16. The method according to claim 15, characterized in that The step of determining a starting extension direction perpendicular to the starting detection direction according to the virtual character and the starting point includes: A cross product is performed between the direction of the line from the virtual character to the starting point and the normal direction of the starting point to obtain the tangent direction of the starting point; A cross product is performed between the normal direction of the starting point and the tangent direction of the starting point to obtain a starting extension direction perpendicular to the starting detection direction.
17. The method according to claim 1, characterized in that Determining the starting detection direction in the virtual scene includes: The opposite direction of the normal direction of the starting point is determined as the starting detection direction.
18. The method according to claim 1, characterized in that Generating a preconfigured segment model between the starting point and the first continuous point comprises: Determining a first axial dimension of the segmented model adapted between the starting point and the first continuous point according to the distance between the starting point and the first continuous point; The segmented model is generated between the starting point and the first continuous point according to the first axial dimension.
19. The method according to claim 1, characterized in that Generating a preconfigured segment model between the starting point and the first continuous point comprises: Determine a preset radial dimension as a first front end radial dimension of the front end of the segmented model adapted between the starting point and the first continuous point; Determine, according to the first front end radial dimension and the number of currently determined continuous points, a first rear end radial dimension of the rear end of the segmented model adapted between the starting point and the first continuous point; The segmented model is generated between the starting point and the first continuous point according to the first front end radial dimension and the first rear end radial dimension.
20. The method according to claim 1, characterized in that Generating the segment model between the first continuous point and the second continuous point comprises: Determining a second axial dimension of the segmented model adapted between the first continuous point and the second continuous point according to the distance between the first continuous point and the second continuous point; The segmented model is generated between the first continuous point and the second continuous point according to the second axial dimension.
21. The method according to claim 1, characterized in that Generating the segment model between the first continuous point and the second continuous point comprises: Determining the first rear end radial dimension to be a second front end radial dimension adapted to the front end of the preconfigured segmented model between the first continuous point and the second continuous point; Determine, according to the second front end radial size and the number of currently determined continuous points, a second rear end radial size of the rear end of the segmented model adapted between the first continuous point and the second continuous point; The segmented model is generated between the first continuous point and the second continuous point according to the second front end radial size and the second rear end radial size.
22. The method according to claim 1, characterized in that The step of determining a starting auxiliary point according to the starting point comprises: A starting auxiliary point is determined at a second preset distance from the starting point in the starting detection direction.
23. The method according to claim 1, characterized in that The step of determining a second auxiliary point at the first preset distance from the first auxiliary point in the starting extension direction includes: Randomly perturbing the initial extension direction; A second auxiliary point is determined at the first preset distance from the first auxiliary point in the initial extension direction after the random disturbance.
24. The method according to claim 1, characterized in that The method further comprises: determining a target position on the spline; A preconfigured additional model is generated according to the target location.
25. A model generation device, characterized in that: The device comprises: A first determination module is used to determine a starting point, a starting detection direction and a starting extension direction of a spline in a virtual scene; A second determining module is used to determine a starting auxiliary point according to the starting point; A third determining module, configured to determine a first auxiliary point at a first preset distance from the starting auxiliary point in the starting extension direction; A first ray detection module, used for emitting rays from the first auxiliary point along the starting detection direction to perform ray detection; a fourth determination module, configured to determine, if a virtual surface in the virtual scene is detected from the first auxiliary point along the starting detection direction, an intersection of a ray from the first auxiliary point along the starting detection direction and the detected virtual surface as a first continuous point of the spline; A first model generation module, configured to generate a preconfigured segment model between the starting point and the first continuous point; A fifth determining module, configured to determine a second auxiliary point at the first preset distance from the first auxiliary point in the starting extension direction; A second ray detection module, used for emitting rays from the second auxiliary point along the starting detection direction to perform ray detection; a sixth determination module, configured to determine, if a virtual surface in the virtual scene is detected from the second auxiliary point along the starting detection direction, an intersection of a ray from the second auxiliary point along the starting detection direction and the detected virtual surface as a second continuous point of the spline; The second model generating module is used to generate the segment model between the first continuous points and the second continuous points.
26. An electronic device, characterized in that: include: A processor, a memory, and computer program instructions stored on the memory and executable on the processor; When the processor executes the computer program instructions, the model generation method as described in any one of claims 1 to 24 is implemented.
27. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, they are used to implement the model generation method as described in any one of claims 1 to 24 above.