Virtual road generation method, device, computer program product and electronic device
By acquiring and configuring the segmented parameters of the road control curve, and selecting and adjusting candidate road model units for splicing, the problems of low efficiency and poor controllability in virtual road generation are solved, and efficient and flexible virtual road generation is achieved.
Patent Information
- Application Number
- CN202510255746.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-04
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-03-04
AI Technical Summary
Existing virtual road generation methods are inefficient and lack controllability, flexibility, and versatility, making them particularly difficult to apply in large-scale game projects.
By acquiring road control curves, configuring control parameters segment by segment, selecting and adjusting candidate road model units, and splicing them according to the curve segment positions, a virtual road matching the control curve is generated.
It improves the controllability, flexibility, and diversity of virtual road generation, enhances generation efficiency, and is suitable for large-scale game projects.
Smart Images

Figure CN119868941B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of games, and in particular, to a virtual road generation method, a virtual road generation apparatus, a computer program product and an electronic device. BACKGROUND
[0002] In a game scene, various scene areas are usually connected by virtual roads, and the quality of the virtual roads as areas where a game character of a player will frequently tread will directly affect the game experience of the player.
[0003] In related technologies, virtual roads are usually generated in the following two ways: one is to manually place a required prefabricated road model in a game scene through artistic scene editing to generate a virtual road, which requires a large amount of manpower and time cost, has low generation efficiency, and is not suitable for large-size game projects; the other is to draw a road curve of a specific shape, and generate a road model according to the drawn road curve, which improves the efficiency compared to the first way, but the artistic effect that can be achieved is usually simple, and a large amount of development cost will be additionally generated once the demand changes, and controllability, flexibility and diversity are poor.
[0004] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present disclosure, and therefore can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY
[0005] The present disclosure provides a virtual road generation method, a virtual road generation apparatus, a computer program product and an electronic device to at least partially solve the problems of poor controllability, flexibility and diversity in related art virtual road generation.
[0006] According to a first aspect of the present disclosure, a virtual road generation method is provided, the method comprising: obtaining a road control curve, the road control curve being composed of a plurality of curve segments; each of the curve segments being configured with a segment control parameter; determining, according to the segment control parameter corresponding to each of the curve segments, a target road model unit corresponding to each of the curve segments from candidate road model units, and adjusting the target road model unit corresponding to each of the curve segments; and splicing the target road model unit corresponding to each of the curve segments according to the position of each of the curve segments in the road control curve, to obtain a virtual road matching the road control curve.
[0007] According to a second aspect of the present disclosure, a virtual road generation apparatus is provided, the apparatus comprising: a control curve acquisition module configured to acquire a road control curve, the road control curve being composed of a plurality of curve segments; each of the curve segments being configured with a segment control parameter; a model unit determination module configured to determine, according to the segment control parameter corresponding to each of the curve segments, a target road model unit corresponding to each of the curve segments from a candidate road model unit, and adjust the target road model unit corresponding to each of the curve segments; and a road model generation module configured to splice the target road model unit corresponding to each of the curve segments according to the position of each of the curve segments in the road control curve, to obtain a virtual road matching the road control curve.
[0008] According to a third aspect of the present disclosure, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the virtual road generation method of the first aspect and possible implementation manners thereof.
[0009] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory configured to store executable instructions of the processor; wherein the processor is configured to execute the executable instructions to perform the virtual road generation method of the first aspect and possible implementation manners thereof.
[0010] The technical solution of the present disclosure has the following beneficial effects:
[0011] In the virtual road generation process, the road control curve is acquired, the road control curve being composed of a plurality of curve segments; each of the curve segments is configured with a segment control parameter; according to the segment control parameter corresponding to each of the curve segments, a target road model unit corresponding to each of the curve segments is determined from a candidate road model unit, and the target road model unit corresponding to each of the curve segments is adjusted; the target road model unit corresponding to each of the curve segments is spliced according to the position of each of the curve segments in the road control curve, to obtain a virtual road matching the road control curve. On the one hand, in the present disclosure, the road control curve is composed of a plurality of curve segments and each of the curve segments is configured with a segment control parameter, so that the user only needs to adjust the segment control parameter to meet various road production requirements, thereby enhancing the controllability, flexibility and diversity of road model generation to a certain extent. On the other hand, in the present disclosure, the corresponding road model component unit is selected from the candidate road model unit according to the segment control parameter corresponding to each of the curve segments in the road control curve, and is adjusted and spliced, without starting from zero to make a model, thereby improving the generation efficiency of the virtual road and ensuring the generation quality of the virtual road, and the present disclosure can be well applied to a game project with a large size. BRIEF DESCRIPTION OF DRAWINGS
[0012] Figure 1 a flow chart illustrating a virtual road generation method in the present exemplary embodiment;
[0013] Figure 2 a flow chart illustrating an adjustment of a target road model unit from a curve segment level in the present exemplary embodiment;
[0014] Figure 3 a flow chart illustrating an adjustment of an included angle in the present exemplary embodiment;
[0015] Figure 4 a flow chart illustrating a virtual road generation method based on a road control curve control in the present exemplary embodiment;
[0016] Figure 5 a structural block diagram of a virtual road generation apparatus in the present exemplary embodiment;
[0017] Figure 6 an electronic device for implementing the virtual road generation method described above in the present exemplary embodiment. DETAILED DESCRIPTION
[0018] Example embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings.
[0019] The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this application, illustrate certain non-limiting embodiments of the present disclosure. In the drawings, the same reference numerals are used to represent similar components and / or features in various embodiments. The drawings are in simplified form and are not to precise scale. Note that for the purposes of clarity, not every component can be shown in the drawings and some components can be shown in generalized form. Some embodiments are shown in block diagram form. Some embodiments are shown in schematic form. In some instances, detailed instrumentation, control signals, and / or control circuits have not been shown in full detail in order to avoid obscuring the present disclosure. It should be appreciated that the use of any of the following terms is not intended to limit that term to a corresponding term in the description, claims, and / or drawings. As used herein, the following terms have the following meanings. Like reference numerals can be used to denote like elements throughout the accompanying drawings and the description.
[0020] In the related art, a virtual road is generated by manually placing a required prefabricated road model in a game scene through an art scene edit. This method requires a large amount of manpower and time cost, and has a low generation efficiency, which is not suitable for a larger size volume game project.
[0021] In the related art, a road model is generated by drawing a road curve of a specific shape, and using a programmed road model generation algorithm according to the drawn road curve. In this way, the attributes that can be carried by the road curve are limited, the artistic effects that can be achieved are simple, and a large amount of development cost is additionally generated once the requirements change, and controllability, flexibility and diversity are poor.
[0022] In view of one or more of the above problems, the exemplary embodiments of the present disclosure provide a virtual road generation method, a virtual road generation device, a computer program product and an electronic device.
[0023] In an optional embodiment, referring to Figure 1 As shown in the flowchart of the virtual road generation method, the method specifically includes the following steps S110 to S130:
[0024] In step S110, a road control curve is obtained, the road control curve being composed of a plurality of curve segments; each curve segment is respectively configured with a segment control parameter;
[0025] In step S120, according to the segment control parameter corresponding to each curve segment, a target road model unit corresponding to each curve segment is determined from a candidate road model unit, and the target road model unit corresponding to each curve segment is adjusted;
[0026] In step S130, according to the position of each curve segment in the road control curve, the target road model unit corresponding to each curve segment is spliced to obtain a virtual road matching the road control curve.
[0027] Figure 1 In the method shown, the road control curve is composed of a plurality of curve segments and each curve segment is respectively configured with a segment control parameter, so that the user only needs to adjust the segment control parameter to meet various road production requirements, and the controllability, flexibility and diversity of road model generation can be enhanced to a certain extent; by using the segment control parameter corresponding to each curve segment in the road control curve, the corresponding road model component unit is selected from the candidate road model unit and adjusted for splicing, without starting from zero for model production, which not only improves the generation efficiency of the virtual road but also ensures the generation quality of the virtual road, and can be well applied to a game project with a large size.
[0028] Each step in Figure 1 will be described in detail below.
[0029] In step S110, a road control curve is obtained, the road control curve being composed of a plurality of curve segments; each curve segment is respectively configured with a segment control parameter.
[0030] The road control curve refers to a curve used to control the type and form of virtual road generation. The segment control parameter refers to a control parameter used to control the type and form of the road model at a predefined curve segment level, which can include but is not limited to road type, road height, road width, road length, and the like. The attribute parameter value can be flexibly edited by the user according to the requirements, and the present disclosure does not make specific limitations.
[0031] Optionally, the road control curve can be composed of multiple curve segments, and each curve segment can be composed of at least two control points. Taking a curve segment composed of two control points as an example, when five control points are provided on a road control curve without branching, four curve segments can be formed.
[0032] In some embodiments, the road control curve composed of multiple curve segments can be edited by a curve editing tool for use. For example, the road control curve can be obtained by a curve editing tool in a game engine, and a specific preset format (for example, a json format) is used as a carrier for storage to make the road control curve. When the road control curve made by the game engine is obtained by a three-dimensional computer graphics software (for example, Houdini), the stored file in the specific preset format can be converted into a usable curve format in the three-dimensional computer graphics software, so as to identify various curve data associated with the road control curve, such as road control parameters at the overall level, road control parameters at the segment level (i.e., segment control parameters), road control parameters at the control point level (i.e., node control parameters), and the like. It should be noted that the types of road control parameters at different levels can be preset or added by the user, and the present disclosure does not make limitations in this regard.
[0033] In an optional embodiment, after obtaining the road control curve, the following step can be further performed: smoothing each curve segment in the road control curve to obtain adjusted curve segments.
[0034] For example, whether the height transition of each curve segment and the adjacent curve segment in the road control curve exceeds a preset height transition threshold, i.e., the height rise or fall value within a unit length exceeds a preset height difference value, can be calculated. If it exceeds, the curve part exceeding the preset height transition threshold can be subjected to height smoothing processing. Through height smoothing processing, the height transition can be dispersed to a larger range for transition, so that the generated virtual road is smoother.
[0035] Exemplarily, whether the turning angle of each curve segment and the adjacent curve segment in the road control curve exceeds a preset threshold of the turning angle can be calculated, and if the preset threshold of the turning angle is exceeded, the curve segment exceeding the preset threshold of the turning angle can be subjected to the turning angle smoothing processing. Through the turning angle smoothing processing, the turning angle can be dispersed to a larger range for transition, so that the generated virtual road is smoother. Furthermore, through the turning angle smoothing processing on the road control curve, the different degrees of wrinkle interlacing after the application of the road model unit in the area with the excessively large turning angle can be avoided, and the performance effect of the virtual road can be improved.
[0036] In step S120, the target road model unit corresponding to each curve segment is determined from the candidate road model units according to the segment control parameter corresponding to each curve segment, and the target road model unit corresponding to each curve segment is adjusted.
[0037] The candidate road model unit refers to a pre-created road splicing component. Various road splicing components that can be used to generate a virtual road in a game scene, i.e., the candidate road model unit, can be pre-made, and these road splicing components are stored separately in a preset format (for example, fbx format) for use.
[0038] Exemplarily, the candidate road model unit can include but is not limited to a model unit for generating a straight road and its variants, a model unit for generating a crossing angle of a specific angle, etc., which are not specifically limited in the present disclosure.
[0039] Exemplarily, the candidate road model unit can also include model units with different numbers of lanes, such as 8-lane, 6-lane, 4-lane, etc., which are not specifically limited in the present disclosure.
[0040] Exemplarily, the candidate road model unit can also include but is not limited to ordinary roads, tunnels, viaducts, ramps, etc., which are not specifically limited in the present disclosure.
[0041] It should be noted that in actual applications, the road model unit can be divided into different road types according to actual needs for user selection and configuration.
[0042] Optionally, the created candidate road model units can be managed in a warehouse for subsequent use. For example, the warehouse management can be implemented by using an asset warehouse panel developed in the Unreal Engine. Specifically, to facilitate management, the road model units can be exported in a specific preset format (e.g., fbx format) to the corresponding path while exporting the configuration file (e.g., json file) of the road model units to the corresponding path. Optionally, the warehouse-managed road model units can be normalized and scaled for subsequent use. The disclosure generates the road model units, i.e., candidate road model units, required for the complete virtual road through warehouse management, which improves the convenience of managing the number and types of model assets. When more road model unit variants are needed, the data warehouse of the model units and the export of the model units can be completed by adding a new form bar to the component model warehouse interface.
[0043] Optionally, a road type parameter can be defined in the segment control parameter, so as to determine the target road model unit corresponding to each curve segment from the candidate road model units based on the road type parameter corresponding to each curve segment.
[0044] wherein the target road model unit refers to the model unit extracted from the candidate road model units and matched with the segment control parameter of the curve segment.
[0045] For example, when adjusting the target road model unit corresponding to each curve segment, the target road model unit corresponding to each curve segment can be adjusted in terms of deformation, rotation, scaling, etc. based on each curve segment, so as to flexibly control the presentation effect of the target road model through the curve segment.
[0046] Optionally, a road form parameter can also be defined in the segment control parameter, so as to adjust the target road model unit corresponding to each curve segment from the curve segment level.
[0047] In an optional embodiment, the segment control parameter includes a road type parameter and a road form parameter, and the above-mentioned determination of the target road model unit corresponding to each curve segment from the candidate road model units based on the segment control parameter corresponding to each curve segment and the adjustment of the target road model unit corresponding to each curve segment can be implemented by the steps shown in Figure 2 .
[0048] Step S210: determining the target road model unit corresponding to each curve segment from the candidate road model units based on the road type parameter corresponding to each curve segment;
[0049] Step S220: adjusting the target road model unit corresponding to each curve segment based on the road form parameter corresponding to each curve segment.
[0050] The road type parameter refers to a configuration parameter for a road model unit type. For example, one of a straight road, a road with a cross, one of an 8-lane road, a 6-lane road, and a 4-lane road, one of a general road, a tunnel, an elevated road, and a ramp, and the like.
[0051] For example, the road type parameter corresponding to each curve segment can be read and compared with the configuration file of the candidate road model unit to be stored, so that the target road model unit matching the road type parameter of each curve segment is determined.
[0052] After the target road model unit matching the road type parameter of each curve segment is determined, the target road model unit can be further adjusted to improve the splicing effect between the target road model units.
[0053] The road shape parameter refers to a control parameter that can affect the shape of the road, such as the width, length, height, and curvature of the road. The target road model unit corresponding to each curve segment is adjusted according to the road shape parameter corresponding to each curve segment, so that the target road model unit can better adapt to the road control curve.
[0054] For example, the target road model unit corresponding to each curve segment can be scaled according to the road width parameter and / or the road length attribute of each curve segment.
[0055] For example, the target road model unit corresponding to each curve segment can be deformed according to the road height parameter and / or the road curvature parameter of each curve segment.
[0056] Figure 2 The step in the above embodiment realizes the adjustment of the target road model unit from the curve segment level, and can improve the flexibility and freedom of user editing.
[0057] In an optional embodiment, each curve segment is composed of at least two control points, each control point is configured with a node control parameter, and the target road model unit corresponding to each curve segment is adjusted by the following step: adjusting the target road model unit corresponding to each curve segment according to the node control parameter corresponding to each control point.
[0058] The node control parameter refers to a control parameter defined in advance at the node level for controlling the shape of the road model.
[0059] Optionally, a road width parameter, a road height parameter, a road curvature parameter, etc. can be defined in the node control parameter, so as to adjust the target road model unit corresponding to each curve segment from the node level, so as to improve the editing accuracy of the virtual road. It should be noted that in actual application, some road control parameters can be set at the node level, the curve segment level, or the whole level. Different levels of setting will result in different performance accuracy of the virtual road. For example, the road width parameter, the road height parameter, the road curvature parameter, etc. can be customized according to actual needs, and the present disclosure does not make specific limitations. The user can customize the road control parameters at different levels to achieve higher controllability of the generation of the virtual road.
[0060] Optionally, the target road model unit corresponding to each curve segment can be scaled according to the road width parameter corresponding to each control point.
[0061] Optionally, the target road model unit corresponding to each curve segment can be deformed according to the road height parameter and / or the road curvature parameter corresponding to each control point.
[0062] In an optional embodiment, the above adjustment of the target road model unit corresponding to each curve segment can also be achieved by the following steps: obtaining an overall control parameter defined for the road control curve, and adjusting the target road model unit corresponding to each curve segment according to the overall control parameter.
[0063] The overall control parameter refers to a control parameter defined at the overall level for controlling the shape of the road model. For example, the overall control parameter can define the road material, such as asphalt road, concrete road, etc., which is not limited in the present disclosure.
[0064] In some embodiments, the material of the target road model unit can be adjusted according to the road material parameter.
[0065] Adjusting the target road model unit by the control parameters at different levels can ensure the generation quality of the virtual road to a certain extent while ensuring the convenience of user editing.
[0066] In an optional embodiment, after the road control curve is obtained, the following steps can be further performed: determining a curve intersection point between each curve segment, and judging whether an included angle between the curve segments connected with the curve intersection point satisfies a preset condition; if not, adjusting the included angle between the curve segments connected with the curve intersection point so as to make the included angle satisfy the preset condition.
[0067] For example, the curve intersection point refers to a control point connected with at least three curve segments, i.e. a point where there is a fork in the road control curve, and is a subset of control points.
[0068] The preset condition refers to a condition preset for adjusting the curve intersection angle. By setting the preset condition, the curve intersection angle can be normalized to determine a target road model unit that fits well from the candidate road model units.
[0069] In an optional embodiment, whether the included angle between the curve segments connected with the curve intersection point satisfies the preset condition can be determined by judging whether the included angle between the curve segments connected with the curve intersection point belongs to a subset of a preset included angle set.
[0070] The preset included angle set refers to a set of one or more normalized included angles, such as a 30-degree included angle, a 45-degree included angle, a 90-degree included angle, etc., which can correspond to the road model unit related to the intersection angle in the candidate road model unit to normalize the fork included angle and increase the fitting degree between the road model unit and the curve.
[0071] For example, whether the included angle between the curve segments connected with the curve intersection point belongs to a subset of a preset included angle set can be determined. If yes, it is considered that the preset condition is satisfied; if no, it is considered that the preset condition is not satisfied.
[0072] If the included angle between the curve segments connected with the curve intersection point satisfies the preset condition, the included angle between the curve segments connected with the curve intersection point can not be adjusted.
[0073] If the included angle between the curve segments connected with the curve intersection point does not satisfy the preset condition, the included angle between the curve segments connected with the curve intersection point can be adjusted.
[0074] For example, as shown in FIG. 4, a flowchart for adjusting the included angle is provided, which can include the following steps: Figure 3
[0075] Step S301, determining the curve intersection points between the curve segments;
[0076] Step S302, judging whether the included angle between the curve segments connected with the curve intersection point belongs to a subset of a preset included angle set; if yes, executing step S303, if no, executing step S304;
[0077] Step S303, not adjusting the included angle between the curve segments connected with the curve intersection point;
[0078] Step S304, adjusting the included angle between the curve segments connected with the curve intersection point to make the included angle belong to a subset of a preset included angle set.
[0079] In an optional implementation, the adjustment of the included angle between the curve segments connected with the curve intersection point to meet the preset condition can be achieved by the following steps: determining the included angle difference between the included angle between the curve segments connected with the curve intersection point and each included angle in the preset included angle set; determining a target included angle from the preset included angle set according to the included angle difference; and adjusting the included angle between the curve segments connected with the curve intersection point according to the target included angle.
[0080] For example, the included angle difference between the included angle between the curve segments connected with the curve intersection point and each included angle in the preset included angle set can be determined, the included angle with the smallest included angle difference in the preset included angle set can be selected as the target included angle, and the included angle between the curve segments connected with the curve intersection point can be adjusted to the target included angle to standardize the fork included angle.
[0081] In an optional implementation, the adjustment of the target road model unit corresponding to the curve segments connected with the curve intersection point according to the intersection control parameter can be achieved by the following steps: adjusting the target road model unit corresponding to the curve segments connected with the curve intersection point according to the intersection control parameter.
[0082] The intersection control parameter refers to a parameter set at the curve intersection point level for controlling the connection of the fork road, which can realize flexible editing of the fork road and further enhance the controllability of road generation. For example, the intersection control parameter can define a width control parameter, a rotation control parameter, and the like.
[0083] In an optional implementation, the adjustment of the target road model unit corresponding to the curve segments connected with the curve intersection point according to the intersection control parameter can be achieved by the following steps: performing scaling processing on the target road model unit corresponding to the curve segments connected with the curve intersection point according to the width control parameter in the intersection control parameter; and / or performing rotation processing on the target road model unit corresponding to the curve segments connected with the curve intersection point according to the rotation control parameter in the intersection control parameter.
[0084] For example, the scaling processing on the target road model unit corresponding to the curve segments connected with the curve intersection point according to the width control parameter in the intersection control parameter can be overall scaling of the target road model unit, or can be scaling of only the connection end of the target road model unit, which is not limited in the present disclosure.
[0085] Exemplarily, when the target road model unit corresponding to the curve segment connected with the intersection point of the curve is rotated according to the rotation control parameter in the intersection control parameter, the orientation of the target road model unit is adjusted, and different placement scenarios of the target road model unit can be flexibly met.
[0086] In step S130, the target road model units corresponding to the curve segments are spliced according to the positions of the curve segments in the road control curve, and a virtual road matching the road control curve is obtained.
[0087] Specifically, the target road model units corresponding to the curve segments can be spliced in sequence according to the positions of the curve segments in the road control curve, and a virtual road matching the road control curve is obtained.
[0088] In an optional embodiment, the connection ends of the target road model units connected with each other can be deformed or scaled according to the road shape parameters corresponding to the curve segments connected with each other and / or the node control parameters of the connection control points corresponding to the curve segments connected with each other, so as to realize seamless and smooth connection between the model units and enhance the presentation effect of the virtual road.
[0089] Exemplarily, as shown in Figure 4 A flowchart for generating a virtual road based on a road control curve is provided, and the flowchart can include the following steps:
[0090] In step S401, a road control curve is obtained, and the road control curve is configured with overall control parameters; the road control curve is composed of a plurality of curve segments, and each curve segment is configured with segment control parameters; each curve segment is composed of at least two control points, and each control point is configured with node control parameters;
[0091] In step S402, the target road model units corresponding to the curve segments are determined from the candidate road model units according to the road type parameters in the segment control parameters corresponding to the curve segments;
[0092] In step S403, the target road model units corresponding to the curve segments are adjusted according to the overall control parameters, the node control parameters of the control points, and the road shape parameters in the segment control parameters corresponding to the curve segments.
[0093] In step S404, the target road model units corresponding to the curve segments are spliced according to the positions of the curve segments in the road control curve, and a virtual road matching the road control curve is obtained.
[0094] Figure 4In the illustrated step, by dividing different levels, the attribute configuration of the road control curve is subdivided, so that the control accuracy of the virtual road reaches each curve segment or even each control point, instead of the entire curve, without relying on the fixed value of the internal algorithm of the tool, and the diversification and controllability of the virtual road performance can be improved.
[0095] The exemplary embodiments of the present disclosure also provide a virtual road generation device, which refers to Figure 5 As shown, the virtual road generation device 500 can include the following program modules:
[0096] The control curve acquisition module 510 is configured to acquire a road control curve, and the road control curve is composed of a plurality of curve segments, and each curve segment is configured with a segment control parameter;
[0097] The model unit determination module 520 is configured to determine a target road model unit corresponding to each curve segment from the candidate road model units according to the segment control parameter corresponding to each curve segment, and adjust the target road model unit corresponding to each curve segment.
[0098] The road model generation module 530 is configured to splice the target road model units corresponding to each curve segment according to the positions of each curve segment in the road control curve, to obtain a virtual road matching the road control curve.
[0099] In an optional embodiment, based on the foregoing scheme, after acquiring the road control curve, the virtual road generation device 500 can further include a curve smoothing processing module configured to perform smoothing processing on each curve segment in the road control curve to obtain adjusted each curve segment.
[0100] In an optional embodiment, based on the foregoing scheme, the segment control parameter includes a road type parameter and a road form parameter, and the model unit determination module 520 includes a model unit matching module configured to determine the target road model unit corresponding to each curve segment from the candidate road model units according to the road type parameter corresponding to each curve segment, and a model unit adjustment module configured to adjust the target road model unit corresponding to each curve segment according to the road form parameter corresponding to each curve segment.
[0101] In an optional embodiment, based on the foregoing scheme, each curve segment is composed of at least two control points, each control point is configured with a node control parameter, and the model unit adjustment module is further configured to adjust the target road model unit corresponding to each curve segment according to the node control parameter corresponding to each control point.
[0102] In an alternative implementation, based on the foregoing scheme, the model unit adjustment module is further configured to obtain an overall control parameter defined for the road control curve, and adjust the target road model unit corresponding to each curve segment according to the overall control parameter.
[0103] In an alternative implementation, based on the foregoing scheme, after the road control curve is obtained, the virtual road generation apparatus 500 can further include an included angle determination module configured to determine a curve intersection point between each curve segment, and determine whether an included angle between the curve segments connected with the curve intersection point satisfies a preset condition; and an included angle adjustment module configured to adjust the included angle between the curve segments connected with the curve intersection point if the preset condition is not satisfied.
[0104] In an alternative implementation, based on the foregoing scheme, the included angle determination module can be configured to determine whether the included angle between the curve segments connected with the curve intersection point belongs to a subset of a preset included angle set.
[0105] In an alternative implementation, based on the foregoing scheme, the included angle adjustment module can be configured to determine an included angle difference between the included angle between the curve segments connected with the curve intersection point and each included angle in the preset included angle set; determine a target included angle from the preset included angle set according to the included angle difference; and adjust the included angle between the curve segments connected with the curve intersection point according to the target included angle.
[0106] In an alternative implementation, based on the foregoing scheme, the curve intersection point is provided with an intersection control parameter, and the model unit adjustment module is further configured to adjust the target road model unit corresponding to the curve segments connected with the curve intersection point according to the intersection control parameter.
[0107] In an alternative implementation, based on the foregoing scheme, the model unit adjustment module can be configured to perform scaling processing on the target road model unit corresponding to the curve segments connected with the curve intersection point according to a width control parameter in the intersection control parameter; and / or perform rotation processing on the target road model unit corresponding to the curve segments connected with the curve intersection point according to a rotation control parameter in the intersection control parameter.
[0108] The specific details of each part of the above apparatus have been described in detail in the method part implementation, and the undisclosed details can be referred to the implementation content of the method part, and thus will not be described again.
[0109] The exemplary implementation of the present disclosure also provides a computer program product. The computer program product includes a computer program which, when executed by a processor, implements the virtual road generation method described above.
[0110] In an embodiment, the computer program product can be a tangible product that contains the computer program, such as a computer-readable storage medium storing the computer program. The computer-readable storage medium can be a storage medium based on electric, magnetic, optical, electromagnetic, infrared, etc. signals, including but not limited to random access memory (RAM), read only memory (ROM), magnetic tape, floppy disk, Flash (Flash), mechanical hard disk (HDD), solid state disk (SSD), etc. For example, the computer program product can be implemented as a non-volatile storage medium storing the computer program, such as a read only memory, a Nand Flash, etc.
[0111] In an embodiment, the computer program product can be an intangible product containing the computer program. For example, the computer program product can be implemented as a virtual digital product, such as an executable file, an installation package, etc. digital file storing the computer program.
[0112] The code of the computer program can be written in one or more programming languages. Programming languages such as C, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (for example, through an Internet connection provided by an operator).
[0113] The computer program can be carried or transmitted by electronic, magnetic, optical, electromagnetic, infrared, etc. signals. The electronic device can convert the signal carrying the computer program into a digital signal, and then run the computer program. When the computer program runs on the electronic device, its code is used to make the electronic device execute (more specifically, can make the processor of the electronic device execute) the method steps of various exemplary embodiments of the present disclosure. For example, it can include the following steps:
[0114] Obtaining a road control curve composed of a plurality of curve segments, each curve segment being configured with a segment control parameter;
[0115] According to the segment control parameter corresponding to each curve segment, determining the target road model unit corresponding to each curve segment from the candidate road model unit, and adjusting the target road model unit corresponding to each curve segment;
[0116] According to positions of the curve segments in the road control curve, the target road model units corresponding to the curve segments are spliced to obtain a virtual road matching the road control curve.
[0117] In an alternative implementation, based on the foregoing scheme, after the road control curve is obtained, the following step can be further performed: smoothing each curve segment in the road control curve to obtain an adjusted curve segment.
[0118] In an alternative implementation, based on the foregoing scheme, the segment control parameter includes a road type parameter and a road form parameter, the target road model unit corresponding to each curve segment is determined from the candidate road model units according to the segment control parameter corresponding to each curve segment, and the target road model unit corresponding to each curve segment is adjusted, which can be achieved by the following steps: the target road model unit corresponding to each curve segment is determined from the candidate road model units according to the road type parameter corresponding to each curve segment; and the target road model unit corresponding to each curve segment is adjusted according to the road form parameter corresponding to each curve segment.
[0119] In an alternative implementation, based on the foregoing scheme, each curve segment is composed of at least two control points, each control point is configured with a node control parameter, and the target road model unit corresponding to each curve segment is adjusted, which can be achieved by the following steps: the target road model unit corresponding to each curve segment is adjusted according to the node control parameter corresponding to each control point.
[0120] In an alternative implementation, based on the foregoing scheme, the target road model unit corresponding to each curve segment is adjusted, which can be achieved by the following steps: an overall control parameter defined for the road control curve is obtained, and the target road model unit corresponding to each curve segment is adjusted according to the overall control parameter.
[0121] In an alternative implementation, based on the foregoing scheme, after the road control curve is obtained, the following step can be further performed: determining a curve intersection point between the curve segments, and judging whether an included angle between the curve segments connected with the curve intersection point satisfies a preset condition; if not, adjusting the included angle between the curve segments connected with the curve intersection point to make the included angle satisfy the preset condition.
[0122] In an alternative implementation, based on the foregoing scheme, whether the included angle between the curve segments connected with the curve intersection point satisfies the preset condition can be judged by the following steps: judging whether the included angle between the curve segments connected with the curve intersection point belongs to a subset of a preset included angle set.
[0123] In one optional implementation, based on the aforementioned scheme, adjusting the included angles between curve segments connected to the curve intersection point to make the included angles meet preset conditions can be achieved through the following steps: determining the angle difference between the included angles between the curve segments connected to the curve intersection point and the included angles in the preset included angle set; determining the target included angle from the preset included angle set based on the included angle difference; and adjusting the included angles between the curve segments connected to the curve intersection point based on the target included angle.
[0124] In an optional implementation, based on the aforementioned scheme, the curve intersection point is configured with intersection control parameters, and the target road model unit corresponding to each curve segment is adjusted. This can be achieved through the following steps: according to the intersection control parameters, the target road model unit corresponding to the curve segment connected to the curve intersection point is adjusted.
[0125] In an optional implementation, based on the aforementioned scheme, the target road model unit corresponding to the curve segment connected to the curve intersection point is adjusted according to the intersection control parameters. This can be achieved through the following steps: scaling the target road model unit corresponding to the curve segment connected to the curve intersection point according to the width control parameter in the intersection control parameters; and / or rotating the target road model unit corresponding to the curve segment connected to the curve intersection point according to the rotation control parameter in the intersection control parameters.
[0126] In the above steps, the road control curve is composed of multiple curve segments, each of which is configured with segment control parameters. This allows users to meet diverse road creation needs simply by adjusting the segment control parameters, thereby enhancing the controllability, flexibility, and diversity of road model generation to a certain extent. By using the segment control parameters corresponding to each curve segment in the road control curve, the corresponding road model component units are selected from the candidate road model units and then spliced after adjustment. This eliminates the need to start model creation from scratch, improving the efficiency of virtual road generation and ensuring the quality of virtual road generation. This approach is well-suited for large-scale game projects.
[0127] An exemplary embodiment of this disclosure also provides an electronic device capable of implementing the above-described virtual road generation method. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as program code. The processor executes the executable instructions to perform the method of this exemplary embodiment. Furthermore, the electronic device may also include a display for displaying a graphical user interface.
[0128] The following is for reference. Figure 6 The electronic device is illustrated by way of a general-purpose computing device. It should be understood that... Figure 6The electronic device 600 shown is merely one example and should not limit the scope of functionality or use of the present embodiments.
[0129] As shown in Figure 6 The electronic device 600 can include a processor 610, a memory 620, a bus 630, an I / O (input / output) interface 640, a network adapter 650, a display 660.
[0130] The memory 620 can include a volatile memory, such as a RAM 621, a cache unit 622, and can also include a non-volatile memory, such as a ROM 623. The memory 620 can also include one or more program modules 624, which include, but are not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination of which can include implementation of a network environment. For example, the program modules 624 can include the various modules in the above-described apparatus.
[0131] The processor 610 can include one or more processing units, such as: an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor, and / or a NPU (Neural-Network Processing Unit), etc.
[0132] The processor 610 can be configured to execute executable instructions stored in the memory 620, such as to perform any one or more of the method steps in the present example embodiments.
[0133] For example, the processor 610 can perform the following steps:
[0134] Obtaining a road control curve, the road control curve being composed of a plurality of curve segments, each curve segment being configured with a segment control parameter;
[0135] According to the segment control parameter corresponding to each curve segment, determining a target road model unit corresponding to each curve segment from a candidate road model unit, and adjusting the target road model unit corresponding to each curve segment;
[0136] According to the position of each curve segment in the road control curve, splicing the target road model unit corresponding to each curve segment to obtain a virtual road matching the road control curve.
[0137] In an optional implementation, based on the foregoing scheme, after the road control curve is obtained, the following step can be further performed: smoothing each curve segment in the road control curve to obtain an adjusted each curve segment.
[0138] In an optional implementation, based on the foregoing scheme, the segment control parameter includes a road type parameter and a road shape parameter, and the target road model unit corresponding to each curve segment is determined from the candidate road model units according to the segment control parameter corresponding to each curve segment, and the target road model unit corresponding to each curve segment is adjusted, which can be achieved by the following steps: the target road model unit corresponding to each curve segment is determined from the candidate road model units according to the road type parameter corresponding to each curve segment; and the target road model unit corresponding to each curve segment is adjusted according to the road shape parameter corresponding to each curve segment.
[0139] In an optional implementation, based on the foregoing scheme, each curve segment is composed of at least two control points, each control point is configured with a node control parameter, and the target road model unit corresponding to each curve segment is adjusted, which can be achieved by the following steps: the target road model unit corresponding to each curve segment is adjusted according to the node control parameter corresponding to each control point.
[0140] In an optional implementation, based on the foregoing scheme, the target road model unit corresponding to each curve segment is adjusted, which can be achieved by the following steps: an overall control parameter defined for the road control curve is obtained, and the target road model unit corresponding to each curve segment is adjusted according to the overall control parameter.
[0141] In an optional implementation, based on the foregoing scheme, after the road control curve is obtained, the following step can be further performed: determining a curve intersection point between each curve segment, and judging whether an included angle between the curve segments connected with the curve intersection point satisfies a preset condition; if not, adjusting the included angle between the curve segments connected with the curve intersection point to make the included angle satisfy the preset condition.
[0142] In an optional implementation, based on the foregoing scheme, whether the included angle between the curve segments connected with the curve intersection point satisfies the preset condition can be achieved by the following steps: judging whether the included angle between the curve segments connected with the curve intersection point belongs to a subset of a preset included angle set.
[0143] In an optional implementation, based on the foregoing scheme, the angle between the curve segments connected with the curve intersection point is adjusted to meet the preset condition, which can be achieved by the following steps: determining the angle difference between the angle between the curve segments connected with the curve intersection point and each angle in the preset angle set; determining the target angle from the preset angle set according to the angle difference; and adjusting the angle between the curve segments connected with the curve intersection point according to the target angle.
[0144] In an optional implementation, based on the foregoing scheme, the curve intersection point is configured with intersection control parameters, and the target road model unit corresponding to each curve segment is adjusted, which can be achieved by the following steps: adjusting the target road model unit corresponding to the curve segment connected with the curve intersection point according to the intersection control parameters.
[0145] In an optional implementation, based on the foregoing scheme, the target road model unit corresponding to the curve segment connected with the curve intersection point is adjusted according to the intersection control parameters, which can be achieved by the following steps: performing scaling processing on the target road model unit corresponding to the curve segment connected with the curve intersection point according to the width control parameter in the intersection control parameters; and / or performing rotation processing on the target road model unit corresponding to the curve segment connected with the curve intersection point according to the rotation control parameter in the intersection control parameters.
[0146] In the above steps, the road control curve is composed of multiple curve segments, and each curve segment is configured with a segment control parameter, so that the user only needs to adjust the segment control parameter to meet various road production requirements, thereby enhancing the controllability, flexibility and diversity of the road model generation to a certain extent; the corresponding road model component unit is selected from the candidate road model unit and adjusted and spliced through the segment control parameter of each curve segment in the road control curve, without starting from zero to make a model, which not only improves the generation efficiency of the virtual road but also guarantees the generation quality of the virtual road, and can be better applied to a game project with a large size.
[0147] The bus 630 is used to realize the connection between different components of the electronic device 600, and can include a data bus, an address bus and a control bus.
[0148] The electronic device 600 can communicate with one or more external devices 700 (such as a keyboard, a mouse, an external controller, etc.) through the I / O interface 640.
[0149] The electronic device 600 can communicate with one or more networks through the network adapter 650, for example, the network adapter 650 can provide a mobile communication solution such as 3G / 4G / 5G, or provide a wireless communication solution such as a wireless local area network, Bluetooth, near field communication, etc. The network adapter 650 can communicate with other modules of the electronic device 600 through the bus 630.
[0150] The electronic device 600 can display a graphical user interface, etc. through the display 660.
[0151] Although Figure 6 Other hardware and / or software modules can also be provided in the electronic device 600, which are not shown in the above description, including but not limited to: a display, microcode, device drivers, redundant processors, external disk drive arrays, RAID (Redundant Arrays of Independent Disks) systems, tape drives, and data backup storage systems, etc.
[0152] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, such a division is not mandatory. Indeed, according to the exemplary embodiments of the present disclosure, the features and functionalities of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functionalities of one module or unit described above can be further divided into embodied by a plurality of modules or units.
[0153] Those skilled in the art can understand that various aspects of the present disclosure can be implemented as a system, a method or a program product. Therefore, various aspects of the present disclosure can be embodied as a complete hardware embodiment, a complete software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects, which can be collectively referred to as "circuitry", "module" or "system" here. Those skilled in the art will easily think of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or conventional techniques in the art that are not disclosed by the present disclosure. The specification and embodiments are only considered as exemplary, and the true scope and spirit of the present disclosure are indicated by the claims.
[0154] It should be understood that the present disclosure is not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is only limited by the appended claims.
Claims
1. A virtual road generation method characterized by comprising: The method comprises: acquiring a road control curve composed of a plurality of curve segments, each of which is configured with a segment control parameter; determining a curve intersection point between each of the curve segments and judging whether an included angle between the curve segments connected with the curve intersection point meets a preset condition; if not, adjusting the included angle between the curve segments connected with the curve intersection point so as to make the included angle meet the preset condition; determining a target road model unit corresponding to each of the curve segments from candidate road model units according to the segment control parameter corresponding to each of the curve segments, and adjusting the target road model unit corresponding to each of the curve segments; splicing the target road model unit corresponding to each of the curve segments according to a position of each of the curve segments in the road control curve to obtain a virtual road matched with the road control curve.
2. The method of claim 1, wherein, After acquiring the road control curve, the method further comprises: performing smoothing processing on each of the curve segments in the road control curve to obtain adjusted curve segments.
3. The method of claim 1, wherein, The segment control parameter comprises a road type parameter and a road form parameter, and the determining of the target road model unit corresponding to each of the curve segments from the candidate road model units according to the segment control parameter corresponding to each of the curve segments and the adjusting of the target road model unit corresponding to each of the curve segments comprise: determining the target road model unit corresponding to each of the curve segments from the candidate road model units according to the road type parameter corresponding to each of the curve segments; adjusting the target road model unit corresponding to each of the curve segments according to the road form parameter corresponding to each of the curve segments.
4. The method of claim 1, wherein, Each of the curve segments is composed of at least two control points, each of the control points is configured with a node control parameter, and the adjusting of the target road model unit corresponding to each of the curve segments further comprises: adjusting the target road model unit corresponding to each of the curve segments according to the node control parameter corresponding to each of the control points.
5. The method of claim 1, wherein, The adjusting of the target road model unit corresponding to each of the curve segments further comprises: acquiring an overall control parameter defined for the road control curve, and adjusting the target road model unit corresponding to each of the curve segments according to the overall control parameter.
6. The method of claim 1, wherein, The judging of whether the included angle between the curve segments connected with the curve intersection point meets the preset condition comprises: judging whether the included angle between the curve segments connected with the curve intersection point belongs to a subset of a preset included angle set.
7. The method of claim 6, wherein, The adjusting of the included angle between the curve segments connected with the curve intersection point so as to make the included angle meet the preset condition comprises: determining an included angle difference between the included angle between the curve segments connected with the curve intersection point and each of the included angles in the preset included angle set; determining a target included angle from the preset included angle set according to the included angle difference; adjusting the included angle between the curve segments connected with the curve intersection point according to the target included angle.
8. The method of claim 1, wherein, The curve intersection point is configured with an intersection control parameter, and the adjusting of the target road model unit corresponding to each of the curve segments comprises: According to the intersection control parameter, a target road model unit corresponding to a curve segment connected with the curve intersection point is adjusted.
9. The method of claim 8, wherein, The adjusting of the target road model unit corresponding to the curve segment connected with the curve intersection point according to the intersection control parameter comprises: According to a width control parameter in the intersection control parameter, the target road model unit corresponding to the curve segment connected with the curve intersection point is scaled; and / or According to a rotation control parameter in the intersection control parameter, the target road model unit corresponding to the curve segment connected with the curve intersection point is rotated.
10. A virtual road generating apparatus characterized by comprising: The device comprises: A control curve acquisition module is configured to acquire a road control curve, wherein the road control curve is composed of a plurality of curve segments, and each curve segment is configured with a segment control parameter; An included angle judgment module is configured to determine a curve intersection point between each curve segment, and determine whether an included angle between curve segments connected with the curve intersection point satisfies a preset condition; An included angle adjustment module is configured to adjust the included angle between the curve segments connected with the curve intersection point, so that the included angle satisfies the preset condition, if the included angle does not satisfy the preset condition; A model unit determination module is configured to determine a target road model unit corresponding to each curve segment from candidate road model units according to a segment control parameter corresponding to each curve segment, and adjust the target road model unit corresponding to each curve segment; A road model generation module is configured to splice the target road model unit corresponding to each curve segment according to a position of each curve segment in the road control curve, so as to obtain a virtual road matching the road control curve.
11. A computer program product comprising a computer program, characterized in that, The computer program is executed by a processor to implement the method in any one of claims 1 to 9.
12. An electronic device, comprising: Comprise: A processor; And A memory for storing executable instructions of the processor; Wherein the processor is configured to implement the method in any one of claims 1 to 9 by executing the executable instructions.
Citation Information
Patent Citations
Modeling method of complex road
CN102831261A
Dynamic model configuration method and device, terminal equipment and storage medium
CN117379795A