Track model generation method, device, equipment and storage medium
By obtaining basic spline and track attribute information in the virtual scene, the emitted ray determines the collision point and calculates the track generation information, the problems of low editing efficiency and poor reusability in the existing technology are solved, and efficient automatic generation of track models is achieved.
Patent Information
- Application Number
- CN202111601271.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2041-12-24
AI Technical Summary
In the prior art, track model editing is inefficient and poor reusability, resulting in huge workloads in model editing and requires a lot of human resources.
By obtaining the basic spline and track attribute information in the virtual scene, the emitted ray determines the collision point with the scene model, calculates the track generation information, and generates the track model based on this information.
The automated generation of track models is realized, which improves the efficiency of track models generation and reduces human resources investment.
Smart Images

Figure CN114470752B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game technology, and in particular to a method, device, equipment and storage medium for generating a track model. Background Art
[0002] In an application program that runs based on a virtual scene, there are usually a variety of virtual objects and virtual objects in the virtual scene, where virtual objects refer to virtual characters, virtual animals, etc. whose movements are controlled by players in the virtual scene, and virtual objects refer to three-dimensional models set in the virtual scene, such as virtual houses, virtual trees, virtual vehicles, etc.
[0003] In the prior art, setting up a virtual light rail in a virtual scene requires staff to configure it one by one and manually edit it according to different scene requirements in the virtual scene. The track model in the virtual scene is generated by manual editing. The editing efficiency of the model is low, and due to poor reusability, the workload of model editing is huge, which requires a lot of human resources. Summary of the invention
[0004] The main purpose of the present invention is to solve the technical problems of low efficiency and poor reusability of the existing track model editing technology.
[0005] A first aspect of the present invention provides a method for generating a track model, the method comprising: obtaining basic splines and track attribute information configured in a virtual scene, wherein a scene model is configured in the virtual scene; based on the basic splines, emitting one or more rays in the virtual scene to determine the rays that collide with the scene model in the virtual scene; calculating the track generation information of the position where the collision event occurs in the virtual scene based on the rays where the collision event occurs and the track attribute information; and generating a track model based on the track generation information and the track attribute information.
[0006] Optionally, in a first implementation manner of the first aspect of the present invention, emitting one or more rays in the virtual scene based on the basic spline, and determining the rays that collide with the scene model in the virtual scene includes: sampling feature points of the basic spline to obtain one or more feature points on the basic spline; emitting one or more rays in the virtual scene based on one or more of the feature points, and determining the rays that collide with the scene model in the virtual scene.
[0007] Optionally, in a second implementation method of the first aspect of the present invention, the one or more rays emitted in the virtual scene based on one or more of the feature points and determining the rays that collide with the scene model in the virtual scene include: determining at least one direction vector preset in the world coordinate system of the virtual scene; emitting one or more rays in the virtual scene with multiple feature points as ray starting points based on the direction vector; and determining the rays that collide with the scene model in the virtual scene.
[0008] Optionally, in a third implementation method of the first aspect of the present invention, after determining the ray that collides with the scene model in the virtual scene, it also includes: determining the model category of the scene model that collides with the ray; judging, based on the model category, whether the scene model that collides with the ray will block the track model; if not, filtering the corresponding scene model that collides with the ray, so that the ray passes through the filtered scene model and is re-emitted to the virtual scene.
[0009] Optionally, in a fourth implementation method of the first aspect of the present invention, the calculation of the orbital generation information of the position where the collision event occurs in the virtual scene based on the ray where the collision event occurs and the orbital attribute information includes: obtaining the ray information of the ray where the collision event occurs, and determining the corresponding position where the collision event occurs in the virtual scene; calculating the orbital generation information of the position where the collision event occurs in the virtual scene based on the ray information and the orbital attribute information.
[0010] Optionally, in a fifth implementation manner of the first aspect of the present invention, the ray information includes ray length, the track attribute information includes track adjustment value, and the track generation information includes light rail ground contact type; calculating the track generation information of the location where the collision event occurs in the virtual scene based on the ray information and the track attribute information includes: determining whether the ray length is less than the track adjustment value; if so, then the light rail ground contact type of the location where the collision event occurs in the corresponding virtual scene is light rail ground contact; if not, then the light rail ground contact type of the location where the collision event occurs in the corresponding virtual scene is light rail not ground contact.
[0011] Optionally, in a sixth implementation manner of the first aspect of the present invention, the track attribute information includes the negative filling length of the support column and the unit length of the support column, and the track generation information also includes the number of support column groups; the track generation information of the location where the collision event occurs in the virtual scene calculated based on the ray information and the track attribute information also includes: if the light rail ground-touching type at the location where the collision event occurs in the virtual scene is the light rail not touching the ground, then subtract the negative filling length of the support column from the ray length to obtain a subtraction result; divide the subtraction result by the unit length of the support column to obtain the number of support column groups at the location where the collision event occurs in the corresponding virtual scene; if the light rail ground-touching type at the location where the collision event occurs in the virtual scene is the light rail touching the ground, then the number of support column groups is set to zero.
[0012] Optionally, in a seventh implementation manner of the first aspect of the present invention, generating a track model based on the track generation information and the track attribute information includes: adjusting the basic spline based on the track generation information and the track attribute information to obtain a light rail spline; performing point subdivision on the light rail spline, and calculating the distance value between each point on the light rail spline and the scene model directly below; judging the track form corresponding to each point on the light rail spline according to the distance value; and automatically generating a track model for the light rail spline according to the track form corresponding to each point on the light rail spline to obtain a corresponding track model.
[0013] Optionally, in an eighth implementation manner of the first aspect of the present invention, the track form includes a single track component, a transition component and a guardrail track component; the determining the track form corresponding to each point on the light rail spline according to the distance value includes: obtaining a first distance value between a first point on the light rail spline and a scene model directly below the first point and an ending distance value between a last point on the light rail spline and a scene model directly below the last first point; setting the track form corresponding to a distance value that is less than a preset floating threshold in the first distance value or the ending distance value to a single track component; setting the track form corresponding to a distance value that is greater than a preset floating threshold in the first distance value or the ending distance value or the distance value equal to the floating threshold is set as a guardrail track component; the remaining points on the light rail spline except the first point and the last point are traversed to determine whether the distance value corresponding to each remaining point is less than the floating threshold; if so, determine whether the distance values of the two points before and after the corresponding remaining point are both less than the floating threshold; if the two points before and after are both less than the floating threshold, the track form of the corresponding remaining points is set as a single track component; if the two points before and after are not both less than the floating threshold, the track form of the corresponding remaining points is set as a transfer component; if not, the track form of the corresponding remaining points is set as a guardrail track component.
[0014] Optionally, in a ninth implementation manner of the first aspect of the present invention, after one or more rays are emitted in the virtual scene using the multiple feature points as ray starting points based on the direction vector, it also includes: if no collision event occurs between the emission of one or more rays in the virtual scene and the scene model in the virtual scene, the basic spline is used as the light rail spline, and the track form corresponding to each point on the light rail spline is set to a single track component.
[0015] Optionally, in the tenth implementation manner of the first aspect of the present invention, after generating the track model based on the track generation information and the track attribute information, it also includes: obtaining the curve structure of the track model; resampling the curve structure based on a preset cutting length; generating a collision box according to the resampled curve structure, and segmenting the track model based on the collision box to obtain light rail segments; performing axis regression on the light rail segments, and recording the original position information of the light rail segments in the world coordinate system.
[0016] Optionally, in the eleventh implementation method of the first aspect of the present invention, after performing axis regression on the light rail segment and recording the original position information of the light rail segment, it also includes: splicing the light rail segment according to the original position information, and reproducing the track model in the virtual scene.
[0017] A second aspect of the present invention provides a device for generating a track model, comprising: an acquisition module, used to acquire basic splines and track attribute information configured in a virtual scene, wherein a scene model is configured in the virtual scene; a ray inspection module, used to emit one or more rays in the virtual scene based on the basic splines, and determine the rays that collide with the scene model in the virtual scene; a calculation module, used to calculate the track generation information of the position where the collision event occurs in the virtual scene based on the rays where the collision event occurs and the track attribute information; and a model editing module, used to generate a track model based on the track generation information and the track attribute information.
[0018] Optionally, in a first implementation method of the second aspect of the present invention, the ray inspection module specifically includes: a feature point sampling unit, used to perform feature point sampling on the basic spline to obtain one or more feature points on the basic spline; a ray emission unit, used to emit one or more rays in the virtual scene according to one or more of the feature points, and determine the rays that collide with the scene model in the virtual scene.
[0019] Optionally, in a second implementation method of the second aspect of the present invention, the ray emitting unit is specifically used to: determine at least one direction vector preset in the world coordinate system of the virtual scene; based on the direction vector, use multiple feature points as ray starting points to emit one or more rays in the virtual scene; and determine the ray that collides with the scene model in the virtual scene.
[0020] Optionally, in a third implementation of the second aspect of the present invention, the device for generating the track model also includes a model filtering module, and the model filtering module is specifically used to: determine the model category of the scene model of the collision event with the ray; based on the model category, determine whether the scene model of the collision event with the ray will block the track model; if not, filter the corresponding scene model of the collision event with the ray, so that the ray passes through the filtered scene model and is re-emitted to the virtual scene.
[0021] Optionally, in a fourth implementation method of the second aspect of the present invention, the calculation module specifically includes: a ray information acquisition unit, used to acquire ray information of the ray where the collision event occurs, and determine the position where the collision event occurs in the corresponding virtual scene; an information calculation unit, used to calculate the orbit generation information of the position where the collision event occurs in the virtual scene based on the ray information and the orbit attribute information.
[0022] Optionally, in a fifth implementation manner of the second aspect of the present invention, the ray information includes ray length, the track attribute information includes track adjustment value, and the track generation information includes light rail ground contact type; the information calculation unit is specifically used to: determine whether the ray length is less than the track adjustment value; if so, the light rail ground contact type of the location where the collision event occurs in the corresponding virtual scene is light rail ground contact; if not, the light rail ground contact type of the location where the collision event occurs in the corresponding virtual scene is light rail not ground contact.
[0023] Optionally, in a sixth implementation manner of the second aspect of the present invention, the track attribute information includes the negative length of the support column, and the track generation information also includes the number of support column groups; the information calculation unit is specifically used to: if the light rail ground-touching type at the location where the collision event occurs in the virtual scene is the light rail not touching the ground, then subtract the negative length of the support column from the ray length to obtain a subtraction result; divide the subtraction result by the unit length of the support column to obtain the number of support column groups at the location where the collision event occurs in the corresponding virtual scene; if the light rail ground-touching type at the location where the collision event occurs in the virtual scene is the light rail touching the ground, then set the number of support column groups to zero.
[0024] Optionally, in a seventh implementation manner of the second aspect of the present invention, the model editing module specifically includes: a spline adjustment unit, used to adjust the basic spline based on the track generation information and the track attribute information to obtain a light rail spline; a point subdivision unit, used to perform point subdivision on the light rail spline, and calculate the distance value between each point on the light rail spline and the scene model directly below; a track form judgment unit, used to judge the track form corresponding to each point on the light rail spline according to the distance value; a light rail editing unit, used to automatically generate a track model for the light rail spline according to the track form corresponding to each point on the light rail spline, to obtain a corresponding track model.
[0025] Optionally, in an eighth implementation manner of the second aspect of the present invention, the track form includes a single track component, a transition component and a guardrail track component; the track form judgment unit is specifically used to: obtain a first distance value between a first point on the light rail spline and a scene model directly below the first point and an ending distance value between a last point on the light rail spline and a scene model directly below the last first point; set the track form corresponding to a distance value less than a preset floating threshold in the first distance value or the ending distance value to a single track component; set the track form corresponding to a distance value greater than or equal to the floating threshold in the first distance value or the ending distance value The track form corresponding to the distance value of the value is set as a guardrail track component; the remaining points on the light rail spline except the first point and the last point are traversed to determine whether the distance value corresponding to each remaining point is less than the floating threshold; if so, determine whether the distance values of the two points before and after the corresponding remaining point are both less than the floating threshold; if the two points before and after are both less than the floating threshold, the track form of the corresponding remaining points is set as a single track component; if the two points before and after are not both less than the floating threshold, the track form of the corresponding remaining points is set as a transfer component; if not, the track form of the corresponding remaining points is set as a guardrail track component.
[0026] Optionally, in a ninth implementation manner of the second aspect of the present invention, the device for generating the track model also includes a collision-free module, and the collision-free module is used to: if no collision event occurs when one or more rays are emitted in the virtual scene and the scene model in the virtual scene, then the basic spline is used as the light rail spline, and the track form corresponding to each point on the light rail spline is set to a single track component.
[0027] Optionally, in a tenth implementation manner of the second aspect of the present invention, the device for generating the track model also includes a model cutting module, and the model cutting module is specifically used to: obtain the curve structure of the track model; resample the curve structure based on a preset cutting length; generate a collision box according to the resampled curve structure, and segmentally cut the track model based on the collision box to obtain light rail segments; perform axis regression on the light rail segments, and record the original position information of the light rail segments in the world coordinate system.
[0028] Optionally, in an eleventh implementation manner of the second aspect of the present invention, the device for generating the track model also includes a model splicing module, and the model splicing module is specifically used to: splice the light rail segments according to the original position information, and reproduce the track model in the virtual scene.
[0029] A third aspect of the present invention provides a device for generating a track model, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via lines; the at least one processor calls the instructions in the memory so that the device for generating the track model executes the steps of the above-mentioned method for generating the track model.
[0030] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the steps of the above-mentioned method for generating a track model.
[0031] The above-mentioned method, device, equipment and storage medium for generating a track model obtain the basic spline and track attribute information configured in a virtual scene, wherein the virtual scene is configured with a scene model; based on the basic spline, one or more rays are emitted in the virtual scene to determine the ray that collides with the scene model in the virtual scene; based on the ray that collides and the track attribute information, the track generation information of the position where the collision occurs in the virtual scene is calculated; and the track model is generated based on the track generation information and the track attribute information. In this method, the user only needs to add the basic spline in the virtual scene and input the track attribute information to automatically generate the corresponding track model without manual editing, thereby improving the generation efficiency of the track model.
[0032] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0033] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A schematic diagram of an embodiment of a method for generating a track model in an embodiment of the present invention;
[0035] Figure 2 A schematic diagram of a single track component of a track model in an embodiment of the present invention;
[0036] Figure 3 A schematic diagram of a transfer component of a track model in an embodiment of the present invention;
[0037] Figure 4 A schematic diagram of a guardrail track component of a track model in an embodiment of the present invention;
[0038] Figure 5 Schematic diagram of an embodiment of a device for generating a track model in an embodiment of the present invention;
[0039] Figure 6 It is a schematic diagram of another embodiment of a device for generating a track model in an embodiment of the present invention;
[0040] Figure 7 A schematic diagram of an embodiment of a device for generating a track model in an embodiment of the present invention; DETAILED DESCRIPTION
[0041] The embodiment of the present invention provides a method, device, equipment and storage medium for generating a track model, by acquiring basic splines and track attribute information configured in a virtual scene, wherein a scene model is configured in the virtual scene; based on the basic splines, one or more rays are emitted in the virtual scene to determine the rays that collide with the scene model in the virtual scene; based on the rays that collide and the track attribute information, the track generation information of the position where the collision occurs in the virtual scene is calculated; and the track model is generated based on the track generation information and the track attribute information. In this method, the user only needs to add basic splines in the virtual scene and input track attribute information to automatically generate the corresponding track model without manual editing, thereby improving the generation efficiency of the track model.
[0042] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0043] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , a first embodiment of a method for generating a track model in an embodiment of the present invention includes:
[0044] 101. Obtaining basic spline and track attribute information configured in a virtual scene, wherein a scene model is configured in the virtual scene;
[0045] It is understandable that the execution subject of the present invention may be a device for generating a track model, or may be a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.
[0046] In this embodiment, the virtual scene may include, but is not limited to: a game scene, a virtual reality (VR) scene, an animation scene, a simulator scene, etc. For example, a game scene is rendered in an Android system of a mobile phone, an animation scene is rendered in an Android system of a PC computer, etc. The virtual scene and the scene model in the virtual scene may be edited using Unreal Engine.
[0047] In this embodiment, the basic spline is a curve based on the native Bspline, which is used to assist in generating the entity of the track model. The scene editor sets it in advance according to the needs in the virtual scene. The scene editor can configure the basic spline by modifying the tangent direction and size of the spline, so as to achieve the purpose of quickly creating and modifying the basic type of light rail.
[0048] Specifically, the track model is an automatically constructed model based on splines. According to the needs, it can be a transportation route such as light rail, high-speed rail, subway and highway. In addition, it can also be a model of roads, bridges and fences.
[0049] In some embodiments, the basic spline is input by a scene editor, and the Unreal Engine generates the basic spline according to the instruction. The basic spline is used to generate the light rail spline after adjustment, and the light rail spline is used to generate the light rail model.
[0050] In practical applications, the track attribute information may be pre-configured by the user, or may be a parameter input when the track model needs to be edited. In this embodiment, the track attribute information mainly includes the following parameters:
[0051] 1. The default parameter group includes the option is loop, which is used to select whether the track of the track model is a circular track. If checked, the track of the track model will be automatically closed; the parameter rail_divisor is used to adjust the type parameters of the track. For example, when rail_divisor is 20 units, the track within 20 units from the ground will become a ground-contact track.
[0052] 2. Spacing parameter group, including the spacing parameter used to set the length of each track in the track model; the Pillar Spacing parameter is used to set the spacing between tracks in the track model.
[0053] 3. Support column parameter group, including parameters pillar1, pillar2 and pillar3, which are used to set three different types of support columns of the track model, corresponding to heights of 8m, 5m and 2m respectively; parameter pillar start distance, which is used to adjust the distance between the starting point of the support column and the track; parameter pillar Bias, which is used to set the negative length of the support column, which is used to adjust the distance from the ground. The more negative the value, the more the support column leaks out; parameter pillar section length, which is used to set the length of each section that can be reduced in the middle of the support column; parameter pillar height thres, which is used to determine the length of the support column below which the support column will no longer be generated.
[0054] 102. Based on the basic spline, one or more rays are emitted in the virtual scene to determine the rays that collide with the scene model in the virtual scene;
[0055] In this practical application, the ray can be generated in a variety of ways. In this embodiment, a preset ray inspection tool is mainly used. The ray inspection tool is used to emit rays and check the scene model that the ray collides with for the first time. In practical applications, the ray viewing effect can be displayed in the Unreal Engine. After the ray hits the scene model, the collision information between the ray and the scene model is saved, such as the scene type of the scene model, the length of the ray, etc. The present invention does not limit the ray emission method.
[0056] In some embodiments, determining the scene model of a collision event with a ray in a virtual scene mainly involves sampling feature points of the basic spline to obtain multiple feature points on the basic spline; sampling feature points of the basic spline to obtain one or more feature points on the basic spline; emitting one or more rays in the virtual scene based on one or more of the feature points, and determining the ray that collides with the scene model in the virtual scene.
[0057] Specifically, the track attribute information also includes the sampling distance for sampling feature points of the basic spline. For example, if the length of the basic spline is set to 100m in the virtual engine and the sampling distance in the track attribute information is 10m, 10 feature points of the basic spline are obtained.
[0058] In some embodiments, determining the ray that collides with the scene model in the virtual scene is mainly done by determining at least one direction vector preset in the world coordinate system of the virtual scene; based on the direction vector, one or more rays are emitted in the virtual scene using multiple feature points as ray starting points; and determining the ray that collides with the scene model in the virtual scene.
[0059] Specifically, in the virtual scene, (0, 0, 1) and (0, 0, -1) in the world coordinate system are used as direction vectors, and the feature point on the basic spline is used as the starting point. Rays can be emitted in the virtual scene based on the direction vector and the starting point of the ray, and the scene model in the virtual scene that collides with the ray for the first time is confirmed as the scene model of the collision event with the ray.
[0060] In some embodiments, after determining the ray that collides with the scene model in the virtual scene, it also includes determining the model category of the scene model that collides with the ray; based on the model category, judging whether the scene model that collides with the ray will block the track model; if not, filtering the corresponding scene model that collides with the ray, allowing the ray to pass through the filtered scene model and be re-emitted to the virtual scene.
[0061] Specifically, after emitting a ray, the ray inspection tool will perform type identification on the scene model after identifying the scene model that collides with the ray. The purpose of type identification is to filter out scene models corresponding to objects that will not block the light rail in the physical world, such as water surfaces and vegetation. Filtering out scene models corresponding to objects that will not block the light rail can determine the scene models corresponding to objects that will actually block the light rail, and prevent some models that should not collide from affecting the generation of the light rail. When the scene model is type-identified and the scene model corresponding to the above-mentioned object that will not block the light rail is identified, such as a water surface model, the distance of the ray will not be used as the final distance, but the search will continue downward for a farther collision body until the scene model corresponding to the object that will block the light rail is found.
[0062] 103. Calculate the orbit generation information of the position where the collision event occurs in the virtual scene according to the ray and orbit attribute information of the collision event;
[0063] In this embodiment, some of the rays emitted by the ray inspection tool collide with the scene model in the virtual scene, while other parts do not collide with the scene model in the virtual scene. The ray where the collision event occurs is determined based on the virtual scene where the collision event occurs, the ray information of the ray is obtained, and the position where the collision occurs in the scene model is determined, as well as the above-mentioned orbital attribute information to calculate the orbital generation information.
[0064] In some embodiments, the orbital generation information of the position where the collision event occurs in the virtual scene is calculated based on the ray where the collision event occurs and the orbital attribute information, mainly obtaining the ray information of the ray where the collision event occurs, and determining the corresponding position where the collision event occurs in the virtual scene; based on the ray information and the orbital attribute information, the orbital generation information of the position where the collision event occurs in the virtual scene is calculated.
[0065] Specifically, the ray information may include the ray length, that is, the distance from the corresponding feature point to the location of the collision event, the corresponding feature point coordinates, and the like.
[0066] Furthermore, in this embodiment, when the ray length in the ray information is greater than a certain length, it means that the scene model where the collision occurs is far away from the spline, and the ray and the corresponding ray and scene model can be filtered out. The length can be confirmed in the track attribute information whether to set it, and the present invention does not limit it.
[0067] In some embodiments, based on the ray information and the track attribute information, the track generation information of the location where the collision event occurs in the virtual scene is calculated mainly by judging whether the ray length is less than the track adjustment value; if so, the light rail ground-fitting type of the location where the collision event occurs in the corresponding virtual scene is light rail ground-fitting; if not, the light rail ground-fitting type of the location where the collision event occurs in the corresponding virtual scene is light rail not ground-fitting.
[0068] In some embodiments, calculating the track generation information of the location where the collision event occurs in the virtual scene based on the ray information and the track attribute information also includes: if the light rail ground-touching type at the location where the collision event occurs in the virtual scene is light rail not touching the ground, then subtracting the negative filling length of the support column from the ray length to obtain a subtraction result; dividing the subtraction result by the unit length of the support column to obtain the number of support column groups at the location where the collision event occurs in the corresponding virtual scene; if the light rail ground-touching type at the location where the collision event occurs in the virtual scene is light rail touching the ground, then setting the number of support column groups to zero.
[0069] Specifically, there are various types of track generation information. Here, the number of support columns of the light rail and whether the light rail is close to the ground are taken as examples, and the present invention does not limit this.
[0070] Specifically, the track attribute information includes a parameter pillar start distance, which is used to adjust the distance between the starting point of the support column and the track, a parameter pillar Bias, which is used to set the negative length of the support column, and a parameter for adjusting the distance from the ground. The more negative it is, the more the support column leaks out. The parameter pillar section length is used to set the length of each section that can be reduced in the middle of the support column. Among them, the parameter pillar start distance is the above-mentioned track adjustment value, and the parameter pillar Bias is the above-mentioned negative length of the support column. Whether the track model is close to the ground at the corresponding position is mainly determined by judging whether the ray length is less than the pliar start distance. When the track model is close to the ground at the corresponding position, no support column is generated at this position. When the track model is not close to the ground at the corresponding position, a support column needs to be generated at this position. At this time, it is necessary to calculate the total length of the support column that needs to support the track model at this position. The ray length is subtracted from the negative length of the support column to obtain the length of the support column exposed outside. Then the length of the support column exposed outside is divided by the unit length of the support column to obtain the number of support columns at this position.
[0071] 104. Generate a track model based on the track generation information and the track attribute information.
[0072] In this embodiment, the track model in the virtual scene can be automatically generated based on the track generation information and the track attribute information. The track model can be obtained by determining the light rail component at each position and combining the components at all positions.
[0073] In some embodiments, a track model is edited based on all track generation information and the track attribute information in the virtual scene to obtain the track model, including adjusting the basic spline based on the track generation information and the track attribute information to obtain a light rail spline; performing point subdivision on the light rail spline, and calculating the distance value between each point on the light rail spline and the scene model directly below; judging the track form corresponding to each point on the light rail spline according to the distance value; and editing the track model of the light rail spline according to the track form corresponding to each point on the light rail spline to obtain the track model.
[0074] Specifically, the track form includes a single track component, a transition component and a guardrail track component, wherein the single track component is as follows: Figure 2 As shown, the transition components are as follows Figure 3 As shown, the guardrail track components are as follows Figure 4 shown.
[0075] In some embodiments, judging the track form corresponding to each point on the light rail spline according to the distance value includes obtaining a first distance value between the first point on the light rail spline and a scene model directly below the first point and an ending distance value between the last point on the light rail spline and a scene model directly below the last first point; setting the track form corresponding to the distance value less than a preset floating threshold value in the first distance value or the ending distance value as a single track component; setting the track form corresponding to the distance value greater than or equal to the floating threshold value in the first distance value or the ending distance value as a guardrail track component; traversing the remaining points on the light rail spline except the first point and the last point to judge whether the distance value corresponding to each remaining point is less than the floating threshold; if so, judging whether the distance values of the two points before and after the corresponding remaining point are both less than the floating threshold; if the two points before and after are both less than the floating threshold, setting the track form of the corresponding remaining point to a single track component; if the two points before and after are not both less than the floating threshold, setting the track form of the corresponding remaining point to a transfer component; if not, setting the track form of the corresponding remaining point to a guardrail track component.
[0076] Specifically, by recording the distance between each point on the spline and the object below, and judging the track form of the point based on the distance between the front and rear points, if the ground height of the point is less than the floating threshold, then judging whether the front and rear points are both less than the floating threshold, if both are less than the floating threshold, then judging the component at the point is a single track component. If one of the front and rear points is higher than the threshold and the other is lower than the threshold, then judging the component at the point is a transfer component. If the ground height of the point is higher than the floating threshold, then selecting the support column model based on the specific height, and the track itself is a guardrail track component.
[0077] In some embodiments, if no collision event occurs between one or more rays emitted in the virtual scene and the scene model in the virtual scene, the basic spline is used as the light rail spline, and the track form corresponding to each point on the light rail spline is set to a single track component, and a corresponding track model is generated.
[0078] Specifically, after emitting rays based on the basic spline in the virtual scene, the emitted rays may not collide with the scene model. For example, during the editing process, the track may be placed underground. In this case, the ordinary track representation is used by default, that is, the preset single track component is used by default to generate the track model.
[0079] In some embodiments, after the track model is edited based on all the track generation information in the virtual scene to obtain the track model, it also includes obtaining the curve structure of the track model; resampling the curve structure based on a preset cutting length; generating a collision box according to the resampled curve structure, and segmenting the track model based on the collision box to obtain light rail segments; performing axis regression on the light rail segments, and recording the original position information of the light rail segments in the world coordinate system.
[0080] Specifically, the track model automatically generated by the track model is based on a spline as a unit, and cannot load multi-level details in segments, which affects the performance. Therefore, after completing the first stage of track model generation, a Houdini cutting tool will be used to cut the light rail according to the spline length.
[0081] Specifically, the curve structure of the track model is resampled. In this embodiment, a point is sampled every 10 meters for the curve structure, a collision box is generated according to the resampled curve, the light rail is cut into sections, and the cut light rail sections are axially reset, and the original position information is recorded.
[0082] In some embodiments, after performing axis regression on the light rail segment and recording the original position information of the light rail segment, the method further includes splicing the light rail segment according to the original position information to reproduce the track model in the virtual scene.
[0083] Specifically, the original track is mainly reproduced in the virtual engine using the cut track model. The relatively long light rail needs to be divided into several static meshes according to the length to facilitate the loading of multiple levels of detail and the generation of distant view groups.
[0084] In this embodiment, by obtaining the basic spline configured by the user in the virtual scene and the input track attribute information, wherein the virtual scene is configured with a scene model; based on the basic spline and the preset ray inspection tool, multiple rays are emitted to the virtual scene to determine the scene model of the virtual scene where the ray collides with the ray; the track generation information of the location where the collision event occurs in the virtual scene is calculated according to the ray where the collision event occurs, the scene model and the track attribute information; the track model is edited based on all the track generation information and the track attribute information in the virtual scene to obtain the track model. In this method, the user only needs to add the basic spline in the virtual scene and input the track attribute information to automatically generate the corresponding track model without manual editing, thereby improving the generation efficiency of the track model.
[0085] The above describes the method for generating the track model in the embodiment of the present invention. The following describes the device for generating the track model in the embodiment of the present invention. Figure 5 In one embodiment of the present invention, a device for generating a track model includes:
[0086] An acquisition module 501 is used to acquire basic spline and track attribute information configured in a virtual scene, wherein a scene model is configured in the virtual scene;
[0087] A ray checking module 502 is used to emit one or more rays in the virtual scene based on the basic spline to determine the rays that have a collision event with the scene model in the virtual scene;
[0088] A calculation module 503, configured to calculate the orbit generation information of the position where the collision event occurs in the virtual scene according to the ray where the collision event occurs and the orbit attribute information;
[0089] The model editing module 504 is used to generate a track model based on the track generation information and the track attribute information.
[0090] In an embodiment of the present invention, the device for generating the track model runs the above-mentioned method for generating the track model, and the device for generating the track model obtains the basic splines configured by the user in the virtual scene and the input track attribute information, wherein the virtual scene is configured with a scene model; based on the basic splines and a preset ray inspection tool, multiple rays are emitted to the virtual scene to determine the scene model of the virtual scene where the ray collides with the ray; the track generation information of the location where the collision event occurs in the virtual scene is calculated according to the ray where the collision event occurs, the scene model and the track attribute information; the track model is edited based on all the track generation information and the track attribute information in the virtual scene to obtain the track model. In this method, the user only needs to add the basic splines in the virtual scene and input the track attribute information to automatically generate the corresponding track model, without the need for manual editing, thereby improving the generation efficiency of the track model.
[0091] See also Figure 6 , a second embodiment of the device for generating a track model in an embodiment of the present invention includes:
[0092] An acquisition module 501 is used to acquire basic spline and track attribute information configured in a virtual scene, wherein a scene model is configured in the virtual scene;
[0093] A ray checking module 502 is used to emit one or more rays in the virtual scene based on the basic spline to determine the rays that have a collision event with the scene model in the virtual scene;
[0094] A calculation module 503, configured to calculate the orbit generation information of the position where the collision event occurs in the virtual scene according to the ray where the collision event occurs and the orbit attribute information;
[0095] The model editing module 504 is used to generate a track model based on the track generation information and the track attribute information.
[0096] Specifically, the radiation inspection module 502 specifically includes:
[0097] A feature point sampling unit 5021 is used to perform feature point sampling on the basic spline to obtain one or more feature points on the basic spline;
[0098] The ray emitting unit 5022 is used to emit one or more rays in the virtual scene according to one or more feature points, and determine the ray that collides with the scene model in the virtual scene.
[0099] Specifically, the ray emitting unit 5022 is specifically used for:
[0100] Determining at least one direction vector preset in the world coordinate system of the virtual scene;
[0101] Based on the direction vector, one or more rays are emitted in the virtual scene using the plurality of feature points as ray starting points;
[0102] A ray that collides with a scene model in the virtual scene is determined.
[0103] Specifically, the track model generation device further includes a model filtering module 505, and the model filtering module 505 is specifically used for:
[0104] Determine the model category of the scene model with which the ray has a collision event;
[0105] According to the model category, determining whether the scene model having a collision event with the ray will block the track model;
[0106] If not, the corresponding scene model that collides with the ray is filtered, so that the ray passes through the filtered scene model and is re-emitted to the virtual scene.
[0107] Specifically, the calculation module 503 specifically includes:
[0108] The ray information acquisition unit 5031 is used to acquire the ray information of the ray where the collision event occurs, and determine the position where the collision event occurs in the corresponding virtual scene;
[0109] The information calculation unit 5032 is used to calculate the orbit generation information of the position where the collision event occurs in the virtual scene according to the ray information and the orbit attribute information.
[0110] Specifically, the ray information includes the ray length, the track attribute information includes the track adjustment value, and the track generation information includes the light rail ground contact type; the information calculation unit 5033 is specifically used to:
[0111] Determining whether the ray length is less than the track adjustment value;
[0112] If yes, then the light rail ground contact type at the location where the collision event occurs in the corresponding virtual scene is light rail ground contact;
[0113] If not, the light rail ground contact type at the location where the collision event occurs in the corresponding virtual scene is that the light rail is not ground contact.
[0114] Specifically, the track attribute information includes the negative filling length of the support column, and the track generation information also includes the number of support column groups; the information calculation unit 5033 is also specifically used to:
[0115] If the ground-attached type of the light rail at the location where the collision event occurs in the virtual scene is that the light rail does not touch the ground, subtract the negative filling length of the support column from the ray length to obtain a subtraction result;
[0116] Dividing the subtraction result by the unit length of the support column to obtain the number of support column components at the position where the collision event occurs in the corresponding virtual scene;
[0117] If the light rail ground contact type at the location where the collision event occurs in the virtual scene is light rail ground contact, the number of support column groups is set to zero.
[0118] Specifically, the model editing module 504 specifically includes:
[0119] A spline adjustment unit 5041 is used to adjust the basic spline based on the track generation information and the track attribute information to obtain a light rail spline;
[0120] A point subdivision unit 5042 is used to perform point subdivision on the light rail spline and calculate the distance value between each point on the light rail spline and the scene model directly below;
[0121] A track form determination unit 5043 is used to determine the track form corresponding to each point on the light rail spline according to the distance value;
[0122] The light rail editing unit 5044 is used to edit the light rail spline into a track model according to the track form corresponding to each point on the light rail spline to obtain a track model.
[0123] Specifically, the track form includes a single track component, a transition component and a guardrail track component; the track form judgment unit 5043 is specifically used to:
[0124] Obtain a first distance value between a first point on the light rail spline and a scene model directly below the first point and an end distance value between a last point on the light rail spline and a scene model directly below the last first point;
[0125] Setting the track form corresponding to the distance value of the first distance value or the end distance value that is less than the preset floating threshold value as a single track component;
[0126] Setting the track form corresponding to the distance value greater than or equal to the floating threshold value among the first distance value or the end distance value as a guardrail track component;
[0127] Traversing the remaining points on the light rail spline except the first point and the last point, and determining whether the distance value corresponding to each remaining point is less than the floating threshold;
[0128] If so, determine whether the distance values of the two points before and after the corresponding remaining point are both less than the floating threshold;
[0129] If both the front and rear points are smaller than the floating threshold, the track form of the corresponding remaining points is set to a single track component;
[0130] If the two front and rear points are both smaller than the floating threshold, the track form of the corresponding remaining points is set as a transfer component;
[0131] If not, the track form of the corresponding remaining points is set to the guardrail track component.
[0132] Specifically, the track model generation device further includes a collision-free module 506, and the collision-free module 506 is used to:
[0133] If no collision event occurs when one or more rays are emitted in the virtual scene and the scene model in the virtual scene, the basic spline is used as the light rail spline, and the track form corresponding to each point on the light rail spline is set as a single track component.
[0134] Specifically, the track model generation device further includes a model cutting module 507, and the model cutting module 507 is specifically used for:
[0135] Acquiring a curve structure of the track model;
[0136] Resampling the curve structure based on a preset cutting length;
[0137] Generate a collision box according to the resampled curve structure, and segment the track model based on the collision box to obtain light rail segments;
[0138] Perform axis regression on the light rail segment, and record the original position information of the light rail segment in the world coordinate system.
[0139] Specifically, the track model generation device further includes a model splicing module 508, and the model splicing module 508 is specifically used for:
[0140] The light rail segments are spliced according to the original position information, and the track model is reproduced in the virtual scene.
[0141] Based on the previous embodiment, this embodiment describes in detail the specific functions of each module and the unit composition of some modules. Through the above modules and the units in the modules, the user only needs to add basic splines in the virtual scene and input track attribute information to automatically generate the corresponding track model without manual editing, thereby improving the generation efficiency of the track model.
[0142] above Figure 5 and Figure 6 The generation device of the medium track model in the embodiment of the present invention is described in detail from the perspective of modular functional entities, and the generation device of the track model in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0143] Figure 7 7 is a schematic diagram of the structure of a track model generation device provided by an embodiment of the present invention. The track model generation device 700 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 710 (for example, one or more processors) and a memory 720, and one or more storage media 730 (for example, one or more mass storage devices) storing application programs 733 or data 732. Among them, the memory 720 and the storage medium 730 can be short-term storage or permanent storage. The program stored in the storage medium 730 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the track model generation device 700. Furthermore, the processor 710 can be configured to communicate with the storage medium 730, and execute a series of instruction operations in the storage medium 730 on the track model generation device 700 to implement the steps of the above-mentioned track model generation method.
[0144] The track model generation device 700 may also include one or more power supplies 740, one or more wired or wireless network interfaces 750, one or more input and output interfaces 760, and / or one or more operating systems 731, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 7 The structure of the track model generation device shown does not constitute a limitation on the track model generation device provided by the present invention, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0145] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the method for generating a track model.
[0146] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device, or unit can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0147] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0148] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating a track model, It is characterized in that The method for generating the track model comprises: Acquire basic spline and track attribute information configured in a virtual scene, wherein a scene model is configured in the virtual scene; Based on the basic spline, one or more rays are emitted in the virtual scene to determine the rays that collide with the scene model in the virtual scene; Calculating the orbit generation information of the position where the collision event occurs in the virtual scene according to the ray where the collision event occurs and the orbit attribute information; generating a track model based on the track generation information and the track attribute information; The step of emitting one or more rays in the virtual scene based on the basic spline to determine the ray that collides with the scene model in the virtual scene comprises: sampling feature points on the basic spline to obtain one or more feature points on the basic spline; emitting one or more rays in the virtual scene based on one or more feature points to determine the ray that collides with the scene model in the virtual scene; The method of calculating the track generation information of the position where the collision event occurs in the virtual scene based on the ray where the collision event occurs and the track attribute information includes: obtaining ray information of the ray where the collision event occurs, and determining the corresponding position where the collision event occurs in the virtual scene; calculating the track generation information of the position where the collision event occurs in the virtual scene based on the ray information and the track attribute information; the ray information includes a ray length, the track attribute information includes a track adjustment value, and the track generation information includes a light rail ground-attaching type.
2. The method for generating a track model according to claim 1, It is characterized in that The step of emitting one or more rays in the virtual scene according to one or more feature points and determining the ray that collides with the scene model in the virtual scene comprises: Determining at least one direction vector preset in the world coordinate system of the virtual scene; Based on the direction vector, one or more rays are emitted in the virtual scene using the plurality of feature points as ray starting points; A ray that collides with a scene model in the virtual scene is determined.
3. The method for generating a track model according to claim 2, It is characterized in that After determining the ray that collides with the scene model in the virtual scene, the method further includes: Determine the model category of the scene model with which the ray has a collision event; According to the model category, determining whether the scene model having a collision event with the ray will block the track model; If not, the corresponding scene model that collides with the ray is filtered, so that the ray passes through the filtered scene model and is re-emitted to the virtual scene.
4. The method for generating a track model according to claim 1, It is characterized in that The calculating, according to the ray information and the track attribute information, the track generation information of the position where the collision event occurs in the virtual scene comprises: Determining whether the ray length is less than the track adjustment value; If yes, then the light rail ground contact type at the location where the collision event occurs in the corresponding virtual scene is light rail ground contact; If not, the light rail ground contact type at the location where the collision event occurs in the corresponding virtual scene is that the light rail is not ground contact.
5. The method for generating a track model according to claim 4, It is characterized in that The track attribute information includes the negative filling length of the support column and the unit length of the support column, and the track generation information also includes the number of support column groups; The calculating, according to the ray information and the track attribute information, track generation information of the position where the collision event occurs in the virtual scene further comprises: If the ground-attached type of the light rail at the location where the collision event occurs in the virtual scene is that the light rail does not touch the ground, subtract the negative filling length of the support column from the ray length to obtain a subtraction result; Dividing the subtraction result by the unit length of the support column to obtain the number of support column components at the position where the collision event occurs in the corresponding virtual scene; If the light rail ground contact type at the location where the collision event occurs in the virtual scene is light rail ground contact, the number of support column groups is set to zero.
6. The method for generating a track model according to claim 2, It is characterized in that Generating a track model based on the track generation information and the track attribute information includes: Adjusting the basic spline based on the track generation information and the track attribute information to obtain a light rail spline; Subdividing the light rail spline into points, and calculating the distance value between each point on the light rail spline and the scene model directly below; Determine the track form corresponding to each point on the light rail spline according to the distance value; A track model is automatically generated for the light rail spline according to the track form corresponding to each point on the light rail spline to obtain a corresponding track model.
7. The method for generating a track model according to claim 6, It is characterized in that The track form includes a single track component, a transition component and a guardrail track component; The method of determining the track form corresponding to each point on the light rail spline according to the distance value includes: Obtain a first distance value between a first point on the light rail spline and a scene model directly below the first point and an ending distance value between a last point on the light rail spline and a scene model directly below the last first point; Setting the track form corresponding to the distance value of the first distance value or the end distance value that is less than the preset floating threshold value as a single track component; Setting the track form corresponding to the distance value greater than or equal to the floating threshold value among the first distance value or the end distance value as a guardrail track component; Traversing the remaining points on the light rail spline except the first point and the last point, and determining whether the distance value corresponding to each remaining point is less than the floating threshold; If so, determine whether the distance values of the two points before and after the corresponding remaining point are both less than the floating threshold; If both the front and rear points are smaller than the floating threshold, the track form of the corresponding remaining points is set to a single track component; If the two front and rear points are both smaller than the floating threshold, the track form of the corresponding remaining points is set as a transfer component; If not, the track form of the corresponding remaining points is set to the guardrail track component.
8. The method for generating a track model according to claim 7, It is characterized in that After emitting one or more rays in the virtual scene by using the plurality of feature points as ray starting points based on the direction vector, the method further includes: If no collision event occurs when one or more rays are emitted in the virtual scene and the scene model in the virtual scene, the basic spline is used as the light rail spline, and the track form corresponding to each point on the light rail spline is set as a single track component.
9. The method for generating a track model according to claim 1, It is characterized in that After the track model is generated based on the track generation information and the track attribute information, the method further includes: Acquiring a curve structure of the track model; Resampling the curve structure based on a preset cutting length; Generate a collision box according to the resampled curve structure, and segment the track model based on the collision box to obtain light rail segments; Perform axis regression on the light rail segment, and record the original position information of the light rail segment in the world coordinate system.
10. The method for generating a track model according to claim 9, It is characterized in that After performing axis center regression on the light rail segment and recording the original position information of the light rail segment, the method further includes: The light rail segments are spliced according to the original position information, and the track model is reproduced in the virtual scene.
11. A device for generating a track model, It is characterized in that The generating device of the track model comprises: An acquisition module, used to acquire basic spline and track attribute information configured in a virtual scene, wherein a scene model is configured in the virtual scene; A ray checking module, configured to emit one or more rays in the virtual scene based on the basic spline, and determine the rays that collide with the scene model in the virtual scene; A calculation module, used for calculating the orbit generation information of the position where the collision event occurs in the virtual scene according to the ray where the collision event occurs and the orbit attribute information; A model editing module, used for generating a track model based on the track generation information and the track attribute information; The ray inspection module specifically includes: a feature point sampling unit, used to perform feature point sampling on the basic spline to obtain one or more feature points on the basic spline; a ray emission unit, used to emit one or more rays in the virtual scene according to one or more feature points, and determine the ray that collides with the scene model in the virtual scene; The calculation module specifically includes: a ray information acquisition unit, which is used to acquire ray information of the ray where the collision event occurs, and determine the position where the collision event occurs in the corresponding virtual scene; an information calculation unit, which is used to calculate the track generation information of the position where the collision event occurs in the virtual scene according to the ray information and the track attribute information; the ray information includes the ray length, the track attribute information includes the track adjustment value, and the track generation information includes the light rail ground-attaching type.
12. A device for generating a track model, It is characterized in that The track model generation device includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor calls the instructions in the memory to enable the track model generation device to perform the steps of the track model generation method as described in any one of claims 1-10.
13. A computer-readable storage medium having stored thereon instructions, It is characterized in that When the instructions are executed by the processor, the steps of the method for generating a track model as described in any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Method and device to control object in virtual scene to move
CN108245890A
Large-scale virtual crowd simulation system
CN109727519A