Mountain range scene generation method and device, storage medium and electronic equipment
By generating mountain directional straight lines and target mountain trend charts, the mountain model is automatically configured, which solves the problems of long generation time and unstable quality caused by manual configuration and adjustment in the existing technology, and realizes fully automatic mountain scene generation with good visual effects.
Patent Information
- Application Number
- CN202411156735.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2025-01-21
AI Technical Summary
When generating mountain scenes, the prior art relies on manual configuration and adjustment of mountain models, resulting in long generation time and unstable quality.
By generating multiple mountain directional straight lines, including horizontal and vertical straight lines, a target mountain trend map is generated based on these straight lines, which contains multiple mountain curves. Then configure the mountain model on each mountain curve to generate a mountain scene.
It realizes fully automatic mountain scene generation, with rich and reasonable generation results and good visual effects, avoiding the long generation time and unstable quality problems caused by manual intervention.
Smart Images

Figure CN119338961A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, storage medium and electronic device for generating a mountain scene. Background Art
[0002] In some computer scenes, it is necessary to generate mountain scenes. There are many peaks in the mountain scenes, and the mountains are required to be real and natural. In order to obtain such mountain scenes, related technologies rely more on manually configuring many peak models in the terrain scene map, and rely on manually adjusting the positions and orientations of many peak models to obtain the mountain scenes, which leads to a long generation time of the mountain scenes, and the generation quality is greatly affected by artificial factors, and the generation quality is unstable. Summary of the invention
[0003] The present disclosure provides a mountain scene generation method, device, storage medium and electronic device to solve at least one problem in the related art. The technical solution of the present disclosure is as follows:
[0004] According to a first aspect of an embodiment of the present disclosure, a method for generating a mountain scene is provided, comprising:
[0005] Generate a plurality of mountain range orientation lines in the space where the terrain scene graph is located, wherein the plurality of mountain range orientation lines include horizontal mountain range orientation lines and vertical mountain range orientation lines;
[0006] Based on the multiple mountain directional straight lines, a target mountain trend map is generated, wherein the target mountain trend map includes multiple mountain curves for characterizing the mountain trend, wherein the multiple mountain curves include horizontal mountain curves, vertical mountain curves and oblique mountain curves, wherein the oblique mountain curves are obtained by copying and angularly shifting the corresponding vertical mountain curves;
[0007] By configuring at least one mountain peak model on each of the mountain curves, a mountain scene in the terrain scene map is generated.
[0008] In an exemplary embodiment, generating a plurality of mountain directional straight lines in the space where the terrain scene graph is located includes:
[0009] Obtaining the horizontal mountain range interval parameter, the number of horizontal mountain ranges, the width of the terrain scene graph, the length of the terrain scene graph, and the number of vertical mountain ranges;
[0010] Determining a starting point of each transverse mountain range based on the transverse mountain range interval parameter and the number of transverse mountain ranges;
[0011] Generate a corresponding transverse mountain range orientation straight line along the starting point of each transverse mountain range, wherein the length of the transverse mountain range orientation straight line is the width of the terrain scene graph;
[0012] Determine the starting point of each vertical mountain range based on the number of the vertical mountain ranges and the width of the terrain scene graph;
[0013] A corresponding vertical mountain orientation line is generated along the starting point of each vertical mountain range, the length of the vertical mountain orientation line is obtained based on the length of the terrain scene graph, and the slopes of the vertical mountain orientation lines distributed in the width direction increase or decrease.
[0014] In an exemplary embodiment, generating a target mountain range trend map based on the plurality of mountain range directional straight lines includes:
[0015] Each of the horizontal mountain range directional straight lines and each of the vertical mountain range directional straight lines is subjected to curve processing to obtain corresponding horizontal mountain range curves and vertical mountain range curves; the curve processing includes: dividing the corresponding mountain range directional straight line into a plurality of line segments; performing fractal processing based on multiple recursions on each of the line segments to obtain a plurality of broken lines; fitting each of the broken lines to obtain a corresponding mountain range curve, wherein the mountain range curve includes a curve segment corresponding to each of the broken lines;
[0016] In each of the vertical mountain range curves, a plurality of reference mountain range curves are determined;
[0017] By sequentially copying and angularly shifting each of the reference mountain curves, a corresponding oblique mountain curve is generated, and the degree of angular shift of the generated oblique mountain curve increases sequentially;
[0018] The target mountain range trend graph is generated based on the horizontal mountain range curve, the vertical mountain range curve and the oblique mountain range curve.
[0019] In an exemplary embodiment, generating the target mountain range trend map based on the horizontal mountain range curve, the vertical mountain range curve, and the oblique mountain range curve includes:
[0020] By performing optimization processing on any of the vertical mountain range curves based on the intersection situation, a first mountain range trend graph is obtained;
[0021] The second mountain range trend map is obtained by performing optimization processing based on Perlin noise on each mountain range curve in the first mountain range trend map;
[0022] Performing mountain range deletion processing on the second mountain range trend map to obtain a third mountain range trend map;
[0023] The third mountain range trend map is processed by mountain range length planning to obtain the target mountain range trend map.
[0024] In an exemplary embodiment, the first mountain range trend graph is obtained by performing an optimization process based on the intersection of any of the vertical mountain range curves, including:
[0025] For any of the vertical mountain curves, if the vertical mountain curve intersects with any of the oblique mountain curves, determine the intersection point, and delete the curve segment of the vertical mountain curve where the intersection point is located;
[0026] If any of the vertical mountain range curves has been deleted at least once, multiple curves formed by curve segments that have not been deleted in the vertical mountain range curve are fitted respectively, and the vertical mountain range curve is replaced by the multiple mountain range curves obtained by fitting;
[0027] The first mountain range trend graph is obtained based on the result obtained by the replacement operation, the oblique mountain range curve and the transverse mountain range curve.
[0028] In an exemplary embodiment, the second mountain range trend map is obtained by performing Perlin noise-based optimization processing on each mountain range curve in the first mountain range trend map, including performing the following operations on each mountain range curve:
[0029] Resampling the mountain curve to obtain a plurality of sampling curves, each of the sampling curves including a plurality of preset points;
[0030] Determine the noise value corresponding to each of the preset points based on the Perlin noise algorithm;
[0031] Based on a preset noise threshold, binarization processing is performed on the noise value corresponding to each of the preset points;
[0032] If the noise values corresponding to any two preset points are both the first preset values and the distance between them is less than the distance threshold, the sampling curves between the two preset points are connected, and the noise values corresponding to all the preset points between the two preset points are set to the first preset value;
[0033] The preset point corresponding to the noise value being the second preset value and the corresponding sampling curve are deleted.
[0034] In an exemplary embodiment, performing a mountain range deletion process on the second mountain range trend map to obtain a third mountain range trend map includes:
[0035] The length of the longest mountain curve in the second mountain trend graph is determined as the target length;
[0036] determining a plurality of target mountain range curves among the mountain range curves;
[0037] For any of the target mountain curves, determine a corresponding first random parameter based on the starting position of the target mountain curve and a global random number; if a target parameter determined based on the first random parameter, the length of the target mountain curve and the target length is less than a preset rejection rate, delete the target mountain curve;
[0038] Based on the target mountain range curve that has not been deleted, the third mountain range trend graph is obtained.
[0039] In an exemplary embodiment, performing mountain range length planning processing on the third mountain range trend map to obtain the target mountain range trend map further includes:
[0040] For any mountain curve in the third mountain trend graph whose length is greater than the first length, a portion of the mountain curve exceeding the first length is deleted by a second length to obtain a deleted mountain curve, until the length of any deleted mountain curve obtained based on the mountain curve is less than the first length.
[0041] In an exemplary embodiment, performing mountain range length planning processing on the third mountain range trend map to obtain the target mountain range trend map further includes:
[0042] Determining a preset mountain curve among the mountain curves;
[0043] Extracting all target preset points in a preset segment on the preset mountain curve;
[0044] Sequentially connect the target preset points to obtain multiple broken lines;
[0045] The vertex of the maximum angle formed by adjacent broken lines is determined as a branch point;
[0046] A branch mountain curve is generated at the branch point.
[0047] In an exemplary embodiment, determining a preset mountain curve among the mountain curves includes:
[0048] Determine a mountain curve whose length is greater than a first length threshold as the preset mountain curve;
[0049] Determine a mountain curve whose length is greater than a second length threshold and less than the first length threshold as a candidate mountain curve, wherein the second length threshold is less than the first length threshold;
[0050] Determine a corresponding second random parameter based on the starting point position of the candidate mountain curve and the global random number;
[0051] When the second random parameter is greater than a random parameter threshold, the candidate mountain range curve is determined as the preset mountain range curve.
[0052] In an exemplary embodiment, the generating of the mountain scene in the terrain scene graph by configuring at least one mountain peak model on each mountain curve includes performing the following operations on any mountain curve:
[0053] Configure a main peak model at a target point in the mountain curve;
[0054] In the portion of the mountain range curve not covered by the main peak model, other peak models are configured until the mountain range curve is completely covered;
[0055] Based on the positional relationship between the mountain curve and the logical center in the mountain scene, height scaling is performed on the main peak model and the other mountain peak models;
[0056] According to the height scaling result, the length and width of the main peak model and the other peak models are adjusted to obtain the mountain scene.
[0057] In an exemplary embodiment, before configuring the main peak model at the target point in the mountain curve, the method further includes:
[0058] In the case where the mountain curve has a branch mountain curve, determining the corresponding branch point as the target point;
[0059] In the case that the mountain curve does not have a branch mountain curve, the golden section point of the mountain curve is determined as the target point.
[0060] According to a second aspect of an embodiment of the present disclosure, there is provided a device for generating a mountain scene, comprising:
[0061] An orientation module is configured to generate a plurality of mountain orientation lines in a space where a terrain scene graph is located, wherein the plurality of mountain orientation lines include a horizontal mountain orientation line and a vertical mountain orientation line;
[0062] A trend generation module is configured to generate a target mountain trend map based on the plurality of mountain directional straight lines, wherein the target mountain trend map includes a plurality of mountain curves for characterizing the mountain trend, wherein the plurality of mountain curves include a horizontal mountain curve, a vertical mountain curve and an oblique mountain curve, wherein the oblique mountain curve is obtained by copying and angularly shifting the corresponding vertical mountain curve;
[0063] The scene generation module is configured to generate a mountain scene in the terrain scene map by configuring at least one peak model on each of the mountain curves.
[0064] In an exemplary embodiment, the orientation module is configured to perform:
[0065] Obtaining the horizontal mountain range interval parameter, the number of horizontal mountain ranges, the width of the terrain scene graph, the length of the terrain scene graph, and the number of vertical mountain ranges;
[0066] Determining a starting point of each transverse mountain range based on the transverse mountain range interval parameter and the number of transverse mountain ranges;
[0067] Generate a corresponding transverse mountain range orientation straight line along the starting point of each transverse mountain range, wherein the length of the transverse mountain range orientation straight line is the width of the terrain scene graph;
[0068] Determine the starting point of each vertical mountain range based on the number of the vertical mountain ranges and the width of the terrain scene graph;
[0069] A corresponding vertical mountain orientation line is generated along the starting point of each vertical mountain range, the length of the vertical mountain orientation line is obtained based on the length of the terrain scene graph, and the slopes of the vertical mountain orientation lines distributed in the width direction increase or decrease.
[0070] In an exemplary embodiment, the trend generation module is configured to execute:
[0071] Each of the horizontal mountain range directional straight lines and each of the vertical mountain range directional straight lines is subjected to curve processing to obtain corresponding horizontal mountain range curves and vertical mountain range curves; the curve processing includes: dividing the corresponding mountain range directional straight line into a plurality of line segments; performing fractal processing based on multiple recursions on each of the line segments to obtain a plurality of broken lines; fitting each of the broken lines to obtain a corresponding mountain range curve, wherein the mountain range curve includes a curve segment corresponding to each of the broken lines;
[0072] In each of the vertical mountain range curves, a plurality of reference mountain range curves are determined;
[0073] By sequentially copying and angularly shifting each of the reference mountain curves, a corresponding oblique mountain curve is generated, and the degree of angular shift of the generated oblique mountain curve increases sequentially;
[0074] The target mountain range trend graph is generated based on the horizontal mountain range curve, the vertical mountain range curve and the oblique mountain range curve.
[0075] In an exemplary embodiment, the trend generation module is configured to execute:
[0076] By performing optimization processing on any of the vertical mountain range curves based on the intersection situation, a first mountain range trend graph is obtained;
[0077] The second mountain range trend map is obtained by performing optimization processing based on Perlin noise on each mountain range curve in the first mountain range trend map;
[0078] Performing mountain range deletion processing on the second mountain range trend map to obtain a third mountain range trend map;
[0079] The third mountain range trend map is processed by mountain range length planning to obtain the target mountain range trend map.
[0080] In an exemplary embodiment, the trend generation module is configured to execute:
[0081] For any of the vertical mountain curves, if the vertical mountain curve intersects with any of the oblique mountain curves, determine the intersection point, and delete the curve segment of the vertical mountain curve where the intersection point is located;
[0082] If any of the vertical mountain range curves has been deleted at least once, multiple curves formed by curve segments that have not been deleted in the vertical mountain range curve are fitted respectively, and the vertical mountain range curve is replaced by the multiple mountain range curves obtained by fitting;
[0083] The first mountain range trend graph is obtained based on the result obtained by the replacement operation, the oblique mountain range curve and the transverse mountain range curve.
[0084] In an exemplary embodiment, the trend generation module is configured to perform the following operations for each mountain curve:
[0085] Resampling the mountain curve to obtain a plurality of sampling curves, each of the sampling curves including a plurality of preset points;
[0086] Determine the noise value corresponding to each of the preset points based on the Perlin noise algorithm;
[0087] Based on a preset noise threshold, binarization processing is performed on the noise value corresponding to each of the preset points;
[0088] If the noise values corresponding to any two preset points are both the first preset values and the distance between them is less than the distance threshold, the sampling curves between the two preset points are connected, and the noise values corresponding to all the preset points between the two preset points are set to the first preset value;
[0089] The preset point corresponding to the noise value being the second preset value and the corresponding sampling curve are deleted.
[0090] In an exemplary embodiment, the trend generation module is configured to execute:
[0091] The length of the longest mountain curve in the second mountain trend graph is determined as the target length;
[0092] determining a plurality of target mountain range curves among the mountain range curves;
[0093] For any of the target mountain curves, determine a corresponding first random parameter based on the starting position of the target mountain curve and a global random number; if a target parameter determined based on the first random parameter, the length of the target mountain curve and the target length is less than a preset rejection rate, delete the target mountain curve;
[0094] Based on the target mountain range curve that has not been deleted, the third mountain range trend graph is obtained.
[0095] In an exemplary embodiment, the trend generation module is configured to execute:
[0096] For any mountain curve in the third mountain trend graph whose length is greater than the first length, a portion of the mountain curve exceeding the first length is deleted by a second length to obtain a deleted mountain curve, until the length of any deleted mountain curve obtained based on the mountain curve is less than the first length.
[0097] In an exemplary embodiment, the trend generation module is configured to execute:
[0098] Determining a preset mountain curve among the mountain curves;
[0099] Extracting all target preset points in a preset segment on the preset mountain curve;
[0100] Sequentially connect the target preset points to obtain multiple broken lines;
[0101] The vertex of the maximum angle formed by adjacent broken lines is determined as a branch point;
[0102] A branch mountain curve is generated at the branch point.
[0103] In an exemplary embodiment, the trend generation module is configured to execute:
[0104] Determine a mountain curve whose length is greater than a first length threshold as the preset mountain curve;
[0105] Determine a mountain curve whose length is greater than a second length threshold and less than the first length threshold as a candidate mountain curve, wherein the second length threshold is less than the first length threshold;
[0106] Determine a corresponding second random parameter based on the starting point position of the candidate mountain curve and the global random number;
[0107] When the second random parameter is greater than a random parameter threshold, the candidate mountain range curve is determined as the preset mountain range curve.
[0108] In an exemplary embodiment, the scene generation module is configured to perform the following operations for any mountain curve:
[0109] Configure a main peak model at a target point in the mountain curve;
[0110] In the portion of the mountain range curve not covered by the main peak model, other peak models are configured until the mountain range curve is completely covered;
[0111] Based on the positional relationship between the mountain curve and the logical center in the mountain scene, height scaling is performed on the main peak model and the other mountain peak models;
[0112] According to the height scaling result, the length and width of the main peak model and the other peak models are adjusted to obtain the mountain scene.
[0113] In an exemplary embodiment, the scene generation module is configured to determine the corresponding branch point as the target point when there is a branch mountain curve in the mountain curve;
[0114] In the case that the mountain curve does not have a branch mountain curve, the golden section point of the mountain curve is determined as the target point.
[0115] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0116] processor;
[0117] a memory for storing instructions executable by the processor;
[0118] The processor is configured to execute the instructions to implement the mountain scene generation method as described in any of the above embodiments.
[0119] According to a fourth aspect of an embodiment of the present disclosure, a computer storage medium is provided. When instructions in the computer storage medium are executed by a processor of an electronic device, the electronic device executes the mountain scene generation method described in any one of the above embodiments.
[0120] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the method for generating a mountain scene described in any one of the above embodiments is implemented.
[0121] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0122] The embodiment of the present disclosure automatically generates mountain orientation lines that describe the direction of the mountain, and automatically generates a target mountain trend map based on these mountain orientation lines. The target mountain trend map includes multiple mountain curves for characterizing the trend of the mountain, so as to achieve the purpose of automatically generating a mountain scene based on the target mountain trend map by laying out peak models in each mountain curve. Compared with the solution of manually generating mountain scenes in the related art, the present disclosure realizes fully automatic mountain scene generation, and the generated results are rich and reasonable with good visual effects.
[0123] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0124] The drawings herein are incorporated into the specification and constitute a part of the present disclosure, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0125] Figure 1 The figure is a flow chart of a method for generating a mountain scene according to an exemplary embodiment.
[0126] Figure 2 The figure is a flow chart of a method for generating a mountain directional straight line according to an exemplary embodiment.
[0127] Figure 3 is a schematic diagram of a method for configuring a mountain model according to an exemplary embodiment.
[0128] Figure 4 The figure is a schematic diagram of a mountain scene according to an exemplary embodiment.
[0129] Figure 5 The process of the target mountain trend chart generation method according to an exemplary embodiment is shown as follows Figure 1 .
[0130] Figure 6 It is a schematic diagram showing the effect of curve processing according to an exemplary embodiment.
[0131] Figure 7 The process of the target mountain trend chart generation method according to an exemplary embodiment is shown as follows Figure 2 .
[0132] Figure 8 It is a schematic diagram showing the effect of optimization processing based on intersection conditions according to an exemplary embodiment.
[0133] Fig. 9 is a schematic diagram of a second mountain range trend chart according to an exemplary embodiment;
[0134] Fig.10 is a schematic diagram of a third mountain range trend chart according to an exemplary embodiment;
[0135] Fig.11 is a schematic diagram showing a mountain range deletion effect according to an exemplary embodiment;
[0136] Fig.12 is a schematic diagram of a target mountain range trend chart according to an exemplary embodiment;
[0137] Fig.13 is a block diagram of a device for generating a mountain scene according to an exemplary embodiment;
[0138] Fig.14 A structural frame of a computer device according to an exemplary embodiment is shown Figure 1 ;
[0139] Fig.15 A structural frame of a computer device according to an exemplary embodiment is shown Figure 2 . DETAILED DESCRIPTION
[0140] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0141] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure 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 of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0142] Figure 1It is a flowchart of a mountain scene generation method according to an exemplary embodiment. The mountain scene generation method can be applied to an electronic device, which can be implemented by a server or a terminal alone, or can be implemented by a terminal and a server in collaboration. The terminal can be, but is not limited to, a physical device such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart wearable device, a digital assistant, an augmented reality device, a virtual reality device, and can also include software such as an application running in the physical device. The server can be, but is not limited to, an independent server, or a server cluster or distributed system composed of multiple physical servers, or one or more of a cloud server that provides cloud services, cloud databases, cloud computing, cloud, cloud storage, network services, cloud communications, intermediate services, domain name services, security services, and basic cloud computing services such as big data and artificial intelligence platforms. Reference Figure 1 As shown, the method includes the following steps.
[0143] In step S101, a plurality of mountain range orientation lines are generated in the space where the terrain scene graph is located, and the plurality of mountain range orientation lines include horizontal mountain range orientation lines and vertical mountain range orientation lines.
[0144] The space where the terrain scene graph is located is used to generate multiple mountain directional lines. The terrain scene graph in the space constrains the size of the mountain scene that is finally formed, and the mountain scene is formed in the terrain scene graph. The present disclosure first orients the mountain range, generates horizontal mountain directional lines and vertical mountain directional lines, and then obtains multiple mountain directional lines in the terrain scene graph. The present disclosure only requires the generation of several mountain directional lines, and does not limit the specific generation method, for example, it can be set randomly.
[0145] Figure 2 The method for generating a plurality of mountain directional straight lines in the space where the terrain scene graph is located comprises:
[0146] In step S201, the horizontal mountain range interval parameter, the number of horizontal mountain ranges, the width of the terrain scene graph, the length of the terrain scene graph, and the number of vertical mountain ranges are obtained.
[0147] The present disclosure can set the number of vertical mountains to be greater than 3, and use HorCount to identify the number of horizontal mountains, which is an integer greater than 1, and use VerCount to identify the number of vertical mountains, which is an integer greater than 3. The horizontal mountain interval parameter is identified by S, which can be randomly aligned for reasonable setting, and the width and length of the terrain scene map are identified by W and L respectively. The lengths of S, W, and L can all be meters.
[0148] The lower left corner of the terrain scene graph is the origin, the positive direction of the X axis is to the right, and the positive direction of the Z axis is upward. The upper right corner of the terrain scene graph is recorded as Tpos.
[0149] In step S202, based on the transverse mountain range interval parameter and the number of transverse mountain ranges, the starting point of each transverse mountain range is determined; along the starting point of each transverse mountain range, a corresponding transverse mountain range orientation line is generated, and the length of the transverse mountain range orientation line is the width of the terrain scene graph.
[0150] In the present disclosure, a transverse mountain range orientation straight line may be generated at the position Tpos+(S,zi*S) along the negative direction of the X-axis, the length of the transverse mountain range orientation straight line is W, and zi takes a value from 1 to HorCount.
[0151] In step S203, based on the number of vertical mountains and the width of the terrain scene graph, the starting point of each vertical mountain range is determined; along the starting point of each vertical mountain range, a corresponding vertical mountain range orientation straight line is generated, and the length of the vertical mountain range orientation straight line is obtained based on the length of the terrain scene graph, and the slopes of the vertical mountain range orientation straight lines distributed in the width direction increase or decrease.
[0152] In the present disclosure, a vertical mountain orientation line can be generated at the position Tpos+(1-xi*in,0) along the direction indicated by the vector (-xi*Xdir,-1), and the length of the vertical mountain orientation line is initially determined to be L, xi takes values from 1 to VerCount, in=W / (VerCount-2), and Xdir is a custom vertical offset angle. In one embodiment, if there is no horizontal mountain orientation line above the vertical mountain orientation line, the length of the vertical mountain orientation line can be increased by HorCount*S, and the starting point can be offset upward by (0, HorCount*S).
[0153] In one embodiment, the offset direction can be set starting from the first vertical mountain orientation line, with an offset range of [-45, 45] degrees, negative numbers offset to the right, positive numbers offset to the left, and the offset angle of each vertical mountain orientation line is larger than the previous one.
[0154] The disclosed method for generating directional straight lines for protecting mountain ranges can automatically generate horizontal and vertical directional straight lines for mountain ranges, and ensure that the positions of the horizontal and vertical directional straight lines for mountain ranges are reasonable and the layout effect is good, thereby ensuring the mountain layout effect of the mountain scene.
[0155] In step S102, a target mountain trend map is generated based on the multiple mountain directional straight lines. The target mountain trend map includes multiple mountain curves for characterizing the mountain trend. The multiple mountain curves include horizontal mountain curves, vertical mountain curves and oblique mountain curves. The oblique mountain curves are obtained by copying and angularly offsetting the corresponding vertical mountain curves.
[0156] In the present disclosure, by curve-processing both the horizontal mountain range oriented straight line and the vertical mountain range oriented straight line, the horizontal mountain range curve and the vertical mountain range curve can be obtained, and the corresponding oblique mountain range curve can be obtained by copying and angularly offsetting the vertical mountain range curve, thereby forming a mountain range curve including multiple trends, so that the mountain range trends in the target mountain range trend map are rich. The present disclosure does not limit the specific generation method of the target mountain range trend map. The target mountain range trend map finally generated by the present disclosure may include a horizontal mountain range curve, a vertical mountain range curve and an oblique mountain range curve, and any mountain range curve may have a branch mountain range curve. The present disclosure details an exemplary target mountain range trend map generation method later, which will not be repeated here.
[0157] In step S103, a mountain scene in the terrain scene map is generated by configuring at least one mountain peak model on each mountain curve.
[0158] The present disclosure automatically generates mountain orientation lines that describe the direction of the mountain range, and automatically generates a target mountain trend map based on these mountain orientation lines. The target mountain trend map includes multiple mountain curves for characterizing the mountain trend, so as to achieve the purpose of automatically generating a mountain scene based on the target mountain trend map by laying out peak models in each mountain curve. Compared with the solution of manually generating mountain scenes in the related art, the present disclosure realizes fully automatic mountain scene generation, and the generated results are rich and reasonable with good visual effects.
[0159] The mountain curves in the target mountain trend map of the present disclosure that fall into the terrain scene map can be configured with a peak model to obtain the mountain scene of the terrain scene map. The present disclosure does not limit the configuration method of the peak model, and various peak models can be stored in the mountain model library, and the peak model is selected in the mountain model library to implement step S103. Figure 3 The method for configuring a mountain model according to an exemplary embodiment is shown in FIG. 1 . The method for configuring at least one mountain model on each mountain curve to generate a mountain scene in the terrain scene graph includes performing the following operations on any mountain curve:
[0160] First, a main peak model is configured at the target point in the mountain curve. The present disclosure does not limit the target point selection method, and the target point can be selected randomly, or when there is a branch mountain curve in the mountain curve, the corresponding branch point can be determined as the target point; when there is no branch mountain curve in the mountain curve, the golden section point of the mountain curve can be determined as the target point. The present disclosure proposes a method for determining the main peak position, so that the main peak meets the visual requirements and improves the visual effect of the mountain scene.
[0161] Then, other peak models are configured in the portion of the mountain curve that is not covered by the main peak model until the mountain curve is completely covered.
[0162] Next, based on the positional relationship between the mountain curve and the logical center in the mountain scene, the main peak model and the other peak models are height-scaled. The logical center refers to a position in the terrain scene map, which is a known position. From the perspective of artistic effect, the height of the mountain follows the principle of large in the distance and small near. At the same time, the height of the mountain body conforms to the natural law of decreasing from the middle to both sides. The so-called large in the distance and small near means that the farther away from the logical center, the larger the peak, and vice versa. Of course, in some embodiments, the specific method of height scaling is not limited, and random scaling is also possible.
[0163] Finally, according to the height scaling result, the length and width of the main peak model and the other peak models are adjusted to obtain the mountain scene. Since the height is adjusted, the length and width can be adaptively adjusted, which is needless to say.
[0164] When the trend is determined, the present disclosure can arrange the peak model on the mountain curve to form a continuous mountain range. The present disclosure constrains the layout of the peak model so that the arranged mountain scene conforms to the characteristics and visual requirements of the natural mountains.
[0165] The mountain scene generation method proposed in the present disclosure can be implemented in Houdini, which is a three-dimensional computer graphics software. The mountain scene generation method implemented in Houdini can save the mountain scene as an HDA file. HDA is Houdini Digital Asset, which is a digital asset generated by Houdini and can be used on other platforms. The mountain scene can be rendered by importing HDA into Unity. Unity is a game development engine that can complete three-dimensional effect rendering. Figure 4 The figure is a schematic diagram of a mountain scene according to an exemplary embodiment. Figure 4 This is the rendering effect of the HDA generated by Houdini and imported into Unity. Figure 4It can be seen that the mountain scene generated by the present invention has a unified art style, the generated effect is real and natural, and a good visualization effect is achieved.
[0166] Figure 5 The process of the target mountain trend chart generation method according to an exemplary embodiment is shown as follows Figure 1 The step of generating a target mountain range trend chart based on the plurality of mountain range directional straight lines includes:
[0167] In step S501, each of the horizontal mountain range orientation lines and each of the vertical mountain range orientation lines is subjected to curve processing to obtain corresponding horizontal mountain range curves and vertical mountain range curves; the curve processing includes: dividing the corresponding mountain range orientation line into a plurality of line segments; performing fractal processing based on multiple recursions on each of the line segments to obtain a plurality of broken lines; fitting each of the broken lines to obtain a corresponding mountain range curve, wherein the mountain range curve includes a curve segment corresponding to each of the broken lines.
[0168] In the present disclosure, each of the horizontal mountain directional straight lines and each of the vertical mountain directional straight lines can be generated in Houdini. Specifically, they can be generated using Houdini's built-in interface Line, which can be used to generate a straight line or curve of a fixed length at a fixed position. Furthermore, Houdini's built-in interface Line can be used to divide the mountain directional straight line into M line segments, where M is an integer greater than 1. Houdini's built-in interface Fractal is used to perform multiple recursive fractal processing. Fractal is a Houdini fractal algorithm interface that can create fractal geometries that appear to have random deviations and are subdivided along specific directions based on ordinary geometries. Finally, Houdini's built-in interface Curve is used to generate mountain curves. Curve can be used to generate Nurbs curves. Nurbs curves (Non-Uniform Rational B-Splines) are a curve representation method widely used in the field of computer graphics.
[0169] Figure 6 It is a schematic diagram showing the effect of curve processing according to an exemplary embodiment. Figure 6 The left picture shows a straight line generated using Line, which is evenly divided into multiple line segments. Figure 6 The middle figure shows that Fractal is used to recursively subdivide each line segment twice, so that the line segment becomes a polyline with 4 segments. Figure 6 The right picture uses the Curve node to generate a 4th-order Nur bs curve based on the broken line, which can be used as a mountain curve.
[0170] In step S502, a plurality of reference mountain curves are determined in each of the vertical mountain curves; corresponding oblique mountain curves are generated by sequentially copying and angularly shifting each of the reference mountain curves, and the angular shift degrees of the generated oblique mountain curves are sequentially increased.
[0171] The present disclosure does not limit the specific method for generating the oblique mountain curve, nor does it limit the method for determining the reference mountain curve. For example, the reference mountain curve can be determined randomly. How to determine the reference mountain curve does not constitute an implementation obstacle and can be determined arbitrarily.
[0172] In an exemplary embodiment, for each oblique mountain curve, a point of the mountain curve may be randomly selected, and the latter half of the mountain curve after this point may be offset so that the absolute value of the offset angle is larger than that of the former half of the oblique mountain curve.
[0173] In step S503, the target mountain range trend graph is generated based on the horizontal mountain range curve, the vertical mountain range curve and the oblique mountain range curve.
[0174] By curve-processing the mountain directional straight line, the corresponding mountain curve is obtained, and the oblique mountain curve is generated based on the vertical mountain curve, thereby further enriching the mountain trend, and obtaining a target mountain trend map including three mountain trends: horizontal, oblique and vertical, which improves the richness and realism of the mountain trend of the target mountain trend map.
[0175] Figure 7 The process of the target mountain trend chart generation method according to an exemplary embodiment is shown as follows Figure 2 The step of generating the target mountain range trend chart based on the horizontal mountain range curve, the vertical mountain range curve and the oblique mountain range curve includes:
[0176] In step S701, a first mountain range trend graph is obtained by performing optimization processing on any of the vertical mountain range curves based on the intersection condition.
[0177] In the present disclosure, the first mountain trend map is obtained by optimizing any of the vertical mountain curves based on the intersection situation, including: for any of the vertical mountain curves, if the vertical mountain curve intersects with any of the oblique mountain curves, determine the intersection position, and delete the curve segment where the intersection position is located in the vertical mountain curve; if any of the vertical mountain curves has been deleted at least once, fit the multiple curves formed by the undeleted curve segments in the vertical mountain curve respectively, and replace the vertical mountain curve with the multiple mountain curves obtained by fitting; based on the result of the replacement operation, the oblique mountain curve and the horizontal mountain curve, the first mountain trend map is obtained. This fitting can also be implemented using the aforementioned Houdini built-in interface Curve, needless to say.
[0178] Figure 8 is a schematic diagram of an optimization processing effect based on intersection conditions according to an exemplary embodiment. The schematic diagram is obtained by setting HorCount=2, VerCount=12, Xdir=0.044 to obtain a horizontal mountain range curve, a vertical mountain range curve and an oblique mountain range curve, and then deleting the vertical mountain range curve intersecting with the oblique mountain range curve according to the aforementioned curve segment based on the intersection position. Figure 8 The box in indicates the range of the terrain scene map. Obviously, the intersection of the oblique mountain curve and the vertical mountain curve may make the distribution of the mountain trend unreasonable. Automatically processing this situation and avoiding the intersection of mountains can improve the distribution rationality of the target mountain trend map.
[0179] In step S702, a second mountain range trend map is obtained by performing Perlin noise-based optimization processing on each mountain range curve in the first mountain range trend map.
[0180] In the present disclosure, the second mountain trend map is obtained by performing Perlin noise-based optimization processing on each mountain curve in the first mountain trend map, including performing the following operations for each mountain curve: resampling the mountain curve to obtain multiple sampling curves, each of which includes multiple preset points; determining the noise value corresponding to each preset point based on the Perlin noise algorithm; binarizing the noise value corresponding to each preset point based on a preset noise threshold; if the noise value corresponding to any two preset points is the first preset value, and the spacing is less than the spacing threshold, the sampling curves between the two preset points are connected, and the noise values corresponding to all preset points between the two preset points are set to the first preset value; delete the preset point whose corresponding noise value is the second preset value and its corresponding sampling curve. The preset point is the point used by Curve for fitting when fitting the curve through Curve, and is a known point in the corresponding fitting result, which will not be elaborated.
[0181] In an exemplary embodiment, Fig. 9 This is a schematic diagram of a second mountain trend chart according to an exemplary embodiment. In this example, Houdini's built-in interface Resample can be used to resample the mountain curve to obtain sample curves with an average length of 1 meter. Houdini's built-in interface Attribnoise interface is used, and the Perlin noise algorithm is selected to set a noise value NoiseValue for each preset point. The noise threshold NoiseThreshold is set according to the actual situation. If NoiseValue is less than NoiseThreshold, it is set to the first preset value 1, otherwise it is set to the second preset value 0. Fig. 9(1) A black curve segment is used to represent a sampling curve corresponding to a preset point where the noise value is a first preset value 1, and a gray curve segment is used to represent a sampling curve corresponding to a preset point where the noise value is a second preset value 0.
[0182] For the same mountain curve, connect the points whose NoiseValue is 1 and whose distance is no more than CureveN meters along the middle sampling curve. After connection, the noise value corresponding to the preset point in the middle is set to the first preset value 1. Repeat this step until all processing is completed. Fig. 9 (2) shows that some adjacent black curve segments are connected to form a long black curve segment, thus reflecting the effect of the connection operation. Finally, the points with NoiseValue equal to the second preset value 0 and the related sampling curves are deleted. Fig. 9 (3) shows the second mountain range trend graph obtained after the deletion, and each curve in the second mountain range trend graph is a mountain range curve.
[0183] The present disclosure performs a noise threshold-based interruption process on each mountain curve based on Perlin noise, thereby obtaining mountain curves of varying lengths, making the target mountain trend map more varied.
[0184] In step S703, a mountain range deletion process is performed on the second mountain range trend map to obtain a third mountain range trend map.
[0185] In an exemplary embodiment, the second mountain range trend map is subjected to mountain range deletion processing to obtain a third mountain range trend map, including: determining the length of the longest mountain range curve in the second mountain range trend map as a target length; determining multiple target mountain range curves in each of the mountain range curves; for any of the target mountain range curves, determining a corresponding first random parameter based on a starting point position of the target mountain range curve and a global random number; when a target parameter determined based on the first random parameter, the length of the target mountain range curve, and the target length is less than a preset rejection rate, deleting the target mountain range curve; and obtaining the third mountain range trend map based on the target mountain range curves that have not been deleted.
[0186] For example, Fig.10 FIG. 1 is a schematic diagram of a third mountain range trend chart according to an exemplary embodiment. Fig. 9The longest curve length among all the mountain curves in (3) is recorded as MaxCurveLen, that is, the target length. The present disclosure does not limit the method for determining the target mountain curve. For example, several target mountain curves can be randomly determined. The length of each target mountain curve is recorded as curveLen. Based on the starting position of the target mountain curve and the global random number seed, the built-in random number generation interface of Houdini is called to obtain a first random parameter rd located in [0,1]. If rd*curveLen / MaxCurveLen is greater than or equal to CurveThreshold (preset rejection rate), the target mountain curve is retained, otherwise the target mountain curve is deleted. CurveThreshold can be set according to the actual situation, thereby obtaining Fig.10 The third mountain range chart is shown.
[0187] The present invention obtains mountain curves with different spacings and variable position relationships by automatically screening mountain curves and performing reasonable mountain deletion on the screened mountain curves, thereby making the target mountain trend map more varied.
[0188] In step S704, the third mountain range trend map is processed for mountain length planning to obtain the target mountain range trend map.
[0189] In one embodiment, the performing mountain length planning processing on the third mountain range trend map to obtain the target mountain range trend map further includes: for any mountain curve in the third mountain range trend map whose length is greater than a first length, deducting a portion of the mountain curve that exceeds the first length by a second length to obtain a deleted mountain curve, until the length of any deleted mountain curve obtained based on the mountain curve is less than the first length. Fig.11 FIG. 1 is a schematic diagram showing a mountain range deletion effect according to an exemplary embodiment. Fig.10 The mountain curves whose length exceeds the first length are truncated to obtain Fig.11 The present disclosure does not limit the first length and the second length, and they can be set according to actual conditions. By cutting the mountain curve, the length of the longest mountain curve is constrained, so that the length of the mountain curve is reasonable.
[0190] In one embodiment, the performing of mountain length planning processing on the third mountain trend map to obtain the target mountain trend map further includes: determining a preset mountain curve in each mountain curve; extracting all target preset points in a preset segment on the preset mountain curve; sequentially connecting each of the target preset points to obtain a plurality of broken lines; determining the angle vertex of the maximum angle formed by adjacent broken lines as a branch point; and generating a branch mountain curve at the branch point.
[0191] The present disclosure does not limit the method for determining the preset mountain curve. The preset mountain curve is a mountain curve that can generate a branch mountain curve. In an exemplary embodiment, the determination of the preset mountain curve in each mountain curve includes: determining a mountain curve whose length is greater than a first length threshold as the preset mountain curve; determining a mountain curve whose length is greater than a second length threshold and less than the first length threshold as an alternative mountain curve, and the second length threshold is less than the first length threshold; determining the corresponding second random parameter based on the starting position of the alternative mountain curve and the global random number; and determining the alternative mountain curve as the preset mountain curve when the second random parameter is greater than the random parameter threshold. The present disclosure does not limit the first length threshold, the second length threshold and the random parameter threshold, and can be freely set according to actual conditions. The second random parameter acquisition method is based on the same inventive concept as the aforementioned first random parameter acquisition method, and the global random number used is also the same, and the global random number can be set at will. The present disclosure provides an automatic selection method for a preset mountain curve suitable for generating a branch mountain curve, which can screen out a preset mountain curve suitable for generating a branch mountain curve, and avoid the unreality caused by generating a branch mountain curve in a mountain curve that is not suitable for generating a branch mountain curve.
[0192] In an exemplary embodiment, the middle part of the preset mountain curve can be selected as the preset segment. The present disclosure does not limit the selection method of the preset segment and does not constitute an implementation obstacle. Traverse each preset point in the preset segment and find the preset point corresponding to the maximum corner as the branch point P1. P0 and P2 are before and after P1 respectively. If the vector formed by P1P2 is on one side of the vector formed by P0P1, the branch is generated on the other side of the vector formed by P0P1, and can be randomly offset by [branchAngleMin, branchAngleMax] degrees. The branch length can also be set arbitrarily, for example, the same as the curve segment formed by P1P2. BranchAngleMin and branchAngleMax can be set arbitrarily, that is, the size of the offset interval can be set arbitrarily. Fig.12 It is a schematic diagram of a target mountain range trend chart according to an exemplary embodiment. Fig.12 This is a schematic diagram of the effect of forming a branch mountain curve in the remaining preset curve segments after deleting the curves with a ratio of 0.604 at the beginning and the end for each preset mountain curve. The schematic diagram of the effect corresponds to branchAngleMin=20 and branchAngleMin=40. The present invention automatically selects mountain curves suitable for generating branch mountain curves to form branch mountain curves. Mountain branch is a common mountain form in nature. By forming a branch mountain curve, the target mountain trend map is more in line with the mountain form in nature and more realistic.
[0193] from Fig.12 It can be seen that the present disclosure automatically performs multiple optimizations, deletions and length planning on each mountain curve, so that the generated target mountain trend map is realistic and the mountain trend distribution is reasonable.
[0194] Fig.13 is a block diagram of a device for generating a mountain scene according to an exemplary embodiment. Fig.13 , the device comprises:
[0195] The orientation module 1301 is configured to generate a plurality of mountain orientation lines in the space where the terrain scene graph is located, wherein the plurality of mountain orientation lines include horizontal mountain orientation lines and vertical mountain orientation lines;
[0196] The trend generation module 1302 is configured to generate a target mountain trend map based on the plurality of mountain directional straight lines, wherein the target mountain trend map includes a plurality of mountain curves for representing the mountain trend, wherein the plurality of mountain curves include a horizontal mountain curve, a vertical mountain curve and an oblique mountain curve, wherein the oblique mountain curve is obtained by copying and angularly shifting the corresponding vertical mountain curve;
[0197] The scene generation module 1303 is configured to generate a mountain scene in the terrain scene map by configuring at least one mountain peak model on each of the mountain curves.
[0198] In an exemplary embodiment, the orientation module 1301 is configured to perform:
[0199] Obtaining the horizontal mountain range interval parameter, the number of horizontal mountain ranges, the width of the terrain scene graph, the length of the terrain scene graph, and the number of vertical mountain ranges;
[0200] Determining a starting point of each transverse mountain range based on the transverse mountain range interval parameter and the number of transverse mountain ranges;
[0201] Generate a corresponding transverse mountain range orientation straight line along the starting point of each transverse mountain range, wherein the length of the transverse mountain range orientation straight line is the width of the terrain scene graph;
[0202] Determine the starting point of each vertical mountain range based on the number of the vertical mountain ranges and the width of the terrain scene graph;
[0203] A corresponding vertical mountain orientation line is generated along the starting point of each vertical mountain range, the length of the vertical mountain orientation line is obtained based on the length of the terrain scene graph, and the slopes of the vertical mountain orientation lines distributed in the width direction increase or decrease.
[0204] In an exemplary embodiment, the trend generation module 1302 is configured to execute:
[0205] Each of the horizontal mountain range directional straight lines and each of the vertical mountain range directional straight lines is subjected to curve processing to obtain corresponding horizontal mountain range curves and vertical mountain range curves; the curve processing includes: dividing the corresponding mountain range directional straight line into a plurality of line segments; performing fractal processing based on multiple recursions on each of the line segments to obtain a plurality of broken lines; fitting each of the broken lines to obtain a corresponding mountain range curve, wherein the mountain range curve includes a curve segment corresponding to each of the broken lines;
[0206] In each of the vertical mountain range curves, a plurality of reference mountain range curves are determined;
[0207] By sequentially copying and angularly shifting each of the reference mountain curves, a corresponding oblique mountain curve is generated, and the degree of angular shift of the generated oblique mountain curve increases sequentially;
[0208] The target mountain range trend graph is generated based on the horizontal mountain range curve, the vertical mountain range curve and the oblique mountain range curve.
[0209] In an exemplary embodiment, the trend generation module 1302 is configured to execute:
[0210] By performing optimization processing on any of the vertical mountain range curves based on the intersection situation, a first mountain range trend graph is obtained;
[0211] The second mountain range trend map is obtained by performing optimization processing based on Perlin noise on each mountain range curve in the first mountain range trend map;
[0212] Performing mountain range deletion processing on the second mountain range trend map to obtain a third mountain range trend map;
[0213] The third mountain range trend map is processed by mountain range length planning to obtain the target mountain range trend map.
[0214] In an exemplary embodiment, the trend generation module 1302 is configured to execute:
[0215] For any of the vertical mountain curves, if the vertical mountain curve intersects with any of the oblique mountain curves, determine the intersection point, and delete the curve segment of the vertical mountain curve where the intersection point is located;
[0216] If any of the vertical mountain range curves has been deleted at least once, multiple curves formed by curve segments that have not been deleted in the vertical mountain range curve are fitted respectively, and the vertical mountain range curve is replaced by the multiple mountain range curves obtained by fitting;
[0217] The first mountain range trend graph is obtained based on the result obtained by the replacement operation, the oblique mountain range curve and the transverse mountain range curve.
[0218] In an exemplary embodiment, the trend generation module 1302 is configured to perform the following operations for each mountain curve:
[0219] Resampling the mountain curve to obtain a plurality of sampling curves, each of the sampling curves including a plurality of preset points;
[0220] Determine the noise value corresponding to each of the preset points based on the Perlin noise algorithm;
[0221] Based on a preset noise threshold, binarization processing is performed on the noise value corresponding to each of the preset points;
[0222] If the noise values corresponding to any two preset points are both the first preset values and the distance between them is less than the distance threshold, the sampling curves between the two preset points are connected, and the noise values corresponding to all the preset points between the two preset points are set to the first preset value;
[0223] The preset point corresponding to the noise value being the second preset value and the corresponding sampling curve are deleted.
[0224] In an exemplary embodiment, the trend generation module 1302 is configured to execute:
[0225] The length of the longest mountain curve in the second mountain trend graph is determined as the target length;
[0226] determining a plurality of target mountain range curves among the mountain range curves;
[0227] For any of the target mountain curves, determine a corresponding first random parameter based on the starting position of the target mountain curve and a global random number; if a target parameter determined based on the first random parameter, the length of the target mountain curve and the target length is less than a preset rejection rate, delete the target mountain curve;
[0228] Based on the target mountain range curve that has not been deleted, the third mountain range trend graph is obtained.
[0229] In an exemplary embodiment, the trend generation module 1302 is configured to execute:
[0230] For any mountain curve in the third mountain trend graph whose length is greater than the first length, a portion of the mountain curve exceeding the first length is deleted by a second length to obtain a deleted mountain curve, until the length of any deleted mountain curve obtained based on the mountain curve is less than the first length.
[0231] In an exemplary embodiment, the trend generation module 1302 is configured to execute:
[0232] Determining a preset mountain curve among the mountain curves;
[0233] Extracting all target preset points in a preset segment on the preset mountain curve;
[0234] Sequentially connect the target preset points to obtain multiple broken lines;
[0235] The vertex of the maximum angle formed by adjacent broken lines is determined as a branch point;
[0236] A branch mountain curve is generated at the branch point.
[0237] In an exemplary embodiment, the trend generation module 1302 is configured to execute:
[0238] Determine a mountain curve whose length is greater than a first length threshold as the preset mountain curve;
[0239] Determine a mountain curve whose length is greater than a second length threshold and less than the first length threshold as a candidate mountain curve, wherein the second length threshold is less than the first length threshold;
[0240] Determine a corresponding second random parameter based on the starting point position of the candidate mountain curve and the global random number;
[0241] When the second random parameter is greater than a random parameter threshold, the candidate mountain range curve is determined as the preset mountain range curve.
[0242] In an exemplary implementation, the scene generation module 1303 is configured to perform the following operations for any mountain curve:
[0243] Configure a main peak model at a target point in the mountain curve;
[0244] In the portion of the mountain range curve not covered by the main peak model, other peak models are configured until the mountain range curve is completely covered;
[0245] Based on the positional relationship between the mountain curve and the logical center in the mountain scene, height scaling is performed on the main peak model and the other mountain peak models;
[0246] According to the height scaling result, the length and width of the main peak model and the other peak models are adjusted to obtain the mountain scene.
[0247] In an exemplary embodiment, the scene generation module 1303 is configured to determine the corresponding branch point as the target point when there is a branch mountain curve in the mountain curve;
[0248] In the case that the mountain curve does not have a branch mountain curve, the golden section point of the mountain curve is determined as the target point.
[0249] Regarding the device in the above embodiment, the specific manner of each step has been described in detail in the embodiment of the aforementioned method, and will not be elaborated here.
[0250] Please refer to Fig.14 , which shows a structural frame of a computer device provided by an exemplary embodiment of the present disclosure Figure 1 The computer device may be a terminal. The computer device is used to implement the mountain scene generation method provided in the above embodiment. Specifically:
[0251] Typically, the computer device 1400 includes a processor 1401 and a memory 1402 .
[0252] The processor 1401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In an exemplary embodiment, the processor 1401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In an exemplary embodiment, the processor 1401 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0253] The memory 1402 may include one or more computer-readable storage media, which may be non-transitory. The memory 1402 may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In an exemplary embodiment, the non-transitory computer-readable storage medium in the memory 1402 is used to store at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is configured to be executed by one or more processors to implement the above-mentioned mountain scene generation method.
[0254] In an exemplary embodiment, the computer device 1400 may further optionally include: a peripheral device interface 1403 and at least one peripheral device. The processor 1401, the memory 1402 and the peripheral device interface 1403 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1403 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1404, a touch display screen 1405, a camera assembly 1406, an audio circuit 1407, a positioning assembly 1408 and a power supply 1409.
[0255] Those skilled in the art will understand that Fig.14 The structure shown in the figure does not constitute a limitation on the computer device 1400, and the computer device 1400 may include more or less components than shown in the figure, or combine some components, or adopt a different arrangement of components.
[0256] Please refer to Fig.15 It shows a structural frame of a computer device provided by another exemplary embodiment of the present disclosure. Figure 2 The computer device may be a server for executing the above-mentioned mountain scene generation method. Specifically:
[0257] The computer device 1500 includes a central processing unit (CPU) 1501, a system memory 1504 including a random access memory (RAM) 1502 and a read only memory (ROM) 1503, and a system bus 1505 connecting the system memory 1504 and the central processing unit 1501. The computer device 1500 also includes a basic input / output system (I / O (Input / Output) system) 1506 that helps to transfer information between various components in the computer, and a large-capacity storage device 1507 for storing an operating system 1513, application programs 1514, and other program modules 1511.
[0258] The basic input / output system 1506 includes a display 1508 for displaying information and an input device 1509 such as a mouse and a keyboard for user inputting information. The display 1508 and the input device 1509 are connected to the central processing unit 1501 through an input / output controller 1510 connected to the system bus 1505. The basic input / output system 1506 may also include an input / output controller 1510 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1510 also provides output to a display screen, a printer, or other types of output devices.
[0259] The mass storage device 1507 is connected to the central processing unit 1501 through a mass storage controller (not shown) connected to the system bus 1505. The mass storage device 1507 and its associated computer readable media provide non-volatile storage for the computer device 1500. That is, the mass storage device 1507 may include a computer readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.
[0260] Without loss of generality, computer readable media may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other solid-state storage technologies, CD-ROM, DVD (Digital Video Disc) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that computer storage media are not limited to the above. The above-mentioned system memory 1504 and mass storage device 1507 can be collectively referred to as memory.
[0261] According to various embodiments of the present disclosure, the computer device 1500 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1500 can be connected to the network 1512 through the network interface unit 1511 connected to the system bus 1505, or the network interface unit 1511 can be used to connect to other types of networks or remote computer systems (not shown).
[0262] The memory also includes a computer program, which is stored in the memory and configured to be executed by one or more processors to implement the mountain scene generation method.
[0263] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one instruction, at least one program, a code set or an instruction set is stored. When the at least one instruction, the at least one program, the code set or the instruction set is executed by a processor, the mountain scene generation method is implemented.
[0264] Optionally, the computer readable storage medium may include: ROM (Read Only Memory), RAM (Random Access Memory), SSD (Solid State Drives) or optical disks, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0265] In an exemplary embodiment, a computer-readable storage medium including a program code is also provided, such as a memory including the program code, and the program code can be executed by a processor to complete the above-mentioned mountain scene generation method. Optionally, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact-disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0266] In an exemplary embodiment, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the above-mentioned mountain scene generation method is implemented.
[0267] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure 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 customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0268] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for generating a mountain scene, characterized in that: include: Generate a plurality of mountain range orientation lines in the space where the terrain scene graph is located, wherein the plurality of mountain range orientation lines include horizontal mountain range orientation lines and vertical mountain range orientation lines; Based on the multiple mountain directional straight lines, a target mountain trend map is generated, wherein the target mountain trend map includes multiple mountain curves for characterizing the mountain trend, wherein the multiple mountain curves include horizontal mountain curves, vertical mountain curves and oblique mountain curves, wherein the oblique mountain curves are obtained by copying and angularly shifting the corresponding vertical mountain curves; By configuring at least one mountain peak model on each of the mountain curves, a mountain scene in the terrain scene map is generated.
2. The method according to claim 1, characterized in that The step of generating a plurality of mountain directional straight lines in the space where the terrain scene graph is located includes: Obtaining the horizontal mountain range interval parameter, the number of horizontal mountain ranges, the width of the terrain scene graph, the length of the terrain scene graph, and the number of vertical mountain ranges; Determining a starting point of each transverse mountain range based on the transverse mountain range interval parameter and the number of transverse mountain ranges; Generate a corresponding transverse mountain range orientation straight line along the starting point of each transverse mountain range, wherein the length of the transverse mountain range orientation straight line is the width of the terrain scene graph; Determine the starting point of each vertical mountain range based on the number of the vertical mountain ranges and the width of the terrain scene graph; A corresponding vertical mountain orientation line is generated along the starting point of each vertical mountain range, the length of the vertical mountain orientation line is obtained based on the length of the terrain scene graph, and the slopes of the vertical mountain orientation lines distributed in the width direction increase or decrease.
3. The method according to claim 1, characterized in that The step of generating a target mountain range trend chart based on the plurality of mountain range directional straight lines comprises: Each of the horizontal mountain range directional straight lines and each of the vertical mountain range directional straight lines is subjected to curve processing to obtain corresponding horizontal mountain range curves and vertical mountain range curves; the curve processing includes: dividing the corresponding mountain range directional straight line into a plurality of line segments; performing fractal processing based on multiple recursions on each of the line segments to obtain a plurality of broken lines; fitting each of the broken lines to obtain a corresponding mountain range curve, wherein the mountain range curve includes a curve segment corresponding to each of the broken lines; In each of the vertical mountain range curves, determining a plurality of reference mountain range curves; By sequentially copying and angularly shifting each of the reference mountain curves, a corresponding oblique mountain curve is generated, and the degree of angular shift of the generated oblique mountain curve increases sequentially; The target mountain range trend graph is generated based on the horizontal mountain range curve, the vertical mountain range curve and the oblique mountain range curve.
4. The method according to claim 3, characterized in that The step of generating the target mountain range trend graph based on the horizontal mountain range curve, the vertical mountain range curve and the oblique mountain range curve comprises: By performing optimization processing on any of the vertical mountain range curves based on the intersection situation, a first mountain range trend graph is obtained; The second mountain range trend map is obtained by performing Perlin noise-based optimization processing on each mountain range curve in the first mountain range trend map; Performing mountain range deletion processing on the second mountain range trend map to obtain a third mountain range trend map; The third mountain range trend map is processed by mountain range length planning to obtain the target mountain range trend map.
5. The method according to claim 4, characterized in that The first mountain range trend chart is obtained by performing optimization processing on any of the vertical mountain range curves based on the intersection situation, including: For any of the vertical mountain curves, if the vertical mountain curve intersects with any of the oblique mountain curves, determine the intersection point, and delete the curve segment of the vertical mountain curve where the intersection point is located; If any of the vertical mountain range curves has been deleted at least once, multiple curves formed by curve segments that have not been deleted in the vertical mountain range curve are fitted respectively, and the vertical mountain range curve is replaced by the multiple mountain range curves obtained by fitting; The first mountain range trend graph is obtained based on the result obtained by the replacement operation, the oblique mountain range curve and the transverse mountain range curve.
6. The method according to claim 4, characterized in that The second mountain range trend map is obtained by performing Perlin noise-based optimization processing on each mountain range curve in the first mountain range trend map, including performing the following operations on each mountain range curve: Resampling the mountain curve to obtain a plurality of sampling curves, each of the sampling curves including a plurality of preset points; Determine the noise value corresponding to each of the preset points based on the Perlin noise algorithm; Based on a preset noise threshold, binarization processing is performed on the noise value corresponding to each of the preset points; If the noise values corresponding to any two preset points are both the first preset values and the distance between them is less than the distance threshold, the sampling curves between the two preset points are connected, and the noise values corresponding to all the preset points between the two preset points are set to the first preset value; The preset point corresponding to the noise value being the second preset value and the corresponding sampling curve are deleted.
7. The method according to claim 4, characterized in that The performing of mountain range deletion processing on the second mountain range trend map to obtain a third mountain range trend map includes: The length of the longest mountain curve in the second mountain trend graph is determined as the target length; determining a plurality of target mountain range curves among the mountain range curves; For any of the target mountain curves, determine a corresponding first random parameter based on the starting position of the target mountain curve and a global random number; if a target parameter determined based on the first random parameter, the length of the target mountain curve and the target length is less than a preset rejection rate, delete the target mountain curve; Based on the target mountain range curve that has not been deleted, the third mountain range trend graph is obtained.
8. The method according to claim 4, characterized in that The performing mountain range length planning processing on the third mountain range trend map to obtain the target mountain range trend map further includes: For any mountain curve in the third mountain trend graph whose length is greater than the first length, a portion of the mountain curve exceeding the first length is deleted by a second length to obtain a deleted mountain curve, until the length of any deleted mountain curve obtained based on the mountain curve is less than the first length.
9. The method according to claim 8, characterized in that The performing mountain range length planning processing on the third mountain range trend map to obtain the target mountain range trend map further includes: Determining a preset mountain curve among the mountain curves; Extracting all target preset points in a preset segment on the preset mountain curve; Sequentially connect the target preset points to obtain multiple broken lines; The vertex of the maximum angle formed by adjacent broken lines is determined as a branch point; A branch mountain curve is generated at the branch point.
10. The method according to claim 9, characterized in that The step of determining a preset mountain range curve from among the mountain range curves includes: Determine a mountain curve whose length is greater than a first length threshold as the preset mountain curve; Determine a mountain curve whose length is greater than a second length threshold and less than the first length threshold as a candidate mountain curve, wherein the second length threshold is less than the first length threshold; Determine a corresponding second random parameter based on the starting point position of the candidate mountain curve and the global random number; When the second random parameter is greater than a random parameter threshold, the candidate mountain range curve is determined as the preset mountain range curve.
11. The method according to claim 1, characterized in that: The generating of the mountain scene in the terrain scene graph by configuring at least one mountain peak model on each mountain curve includes performing the following operations on any mountain curve: Configure a main peak model at a target point in the mountain curve; In the portion of the mountain range curve not covered by the main peak model, other peak models are configured until the mountain range curve is completely covered; Based on the positional relationship between the mountain curve and the logical center in the mountain scene, height scaling is performed on the main peak model and the other mountain peak models; According to the height scaling result, the length and width of the main peak model and the other peak models are adjusted to obtain the mountain scene.
12. The method according to claim 11, characterized in that Before configuring the main peak model for the target point in the mountain curve, the method further includes: In the case where the mountain curve has a branch mountain curve, determining the corresponding branch point as the target point; In the case that the mountain curve does not have a branch mountain curve, the golden section point of the mountain curve is determined as the target point.
13. A mountain scene generation device, characterized in that: include: An orientation module is configured to generate a plurality of mountain orientation lines in a space where a terrain scene graph is located, wherein the plurality of mountain orientation lines include a horizontal mountain orientation line and a vertical mountain orientation line; A trend generation module is configured to generate a target mountain trend map based on the plurality of mountain directional straight lines, wherein the target mountain trend map includes a plurality of mountain curves for characterizing the mountain trend, wherein the plurality of mountain curves include a horizontal mountain curve, a vertical mountain curve and an oblique mountain curve, wherein the oblique mountain curve is obtained by copying and angularly shifting the corresponding vertical mountain curve; The scene generation module is configured to generate a mountain scene in the terrain scene map by configuring at least one peak model on each of the mountain curves.
14. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the mountain scene generation method as described in any one of claims 1-12.
15. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device executes the mountain scene generating method as described in any one of claims 1 to 12.
16. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method for generating a mountain scene according to any one of claims 1 to 12 is implemented.