CN112215968A - Model paste processing method and device, storage medium and electronic equipment - Google Patents
Model paste processing method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN112215968A CN112215968A CN202011181734.6A CN202011181734A CN112215968A CN 112215968 A CN112215968 A CN 112215968A CN 202011181734 A CN202011181734 A CN 202011181734A CN 112215968 A CN112215968 A CN 112215968A
- Authority
- CN
- China
- Prior art keywords
- distance
- point
- model
- reference point
- sampling point
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000003672 processing method Methods 0.000 title abstract description 12
- 238000005070 sampling Methods 0.000 claims abstract description 146
- 238000000034 method Methods 0.000 claims abstract description 46
- 238000012545 processing Methods 0.000 claims abstract description 22
- 238000013507 mapping Methods 0.000 claims description 11
- 238000001514 detection method Methods 0.000 claims description 5
- 238000004590 computer program Methods 0.000 claims description 2
- 230000000694 effects Effects 0.000 abstract description 10
- 238000004088 simulation Methods 0.000 abstract description 3
- 239000000523 sample Substances 0.000 description 30
- 238000010586 diagram Methods 0.000 description 10
- 210000000988 bone and bone Anatomy 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004575 stone Substances 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 230000002411 adverse Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Processing Or Creating Images (AREA)
Abstract
The disclosure provides a model paste processing method and device, a storage medium and electronic equipment, and relates to the technical field of computers. The model paste processing method comprises the following steps: acquiring a terrain height value of a reference point of a target area in a scene; weighting the terrain height value of each reference point according to the distance between a sampling point in the model to be attached to the ground and each reference point to obtain the height value of the sampling point; and attaching the model to be attached to the ground to the target area according to the height value of the sampling point. The method and the device can achieve the simulation effect of model ground pasting, simplify the processing flow of model ground pasting, and reduce resource consumption.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a model paste processing method, a model paste processing apparatus, a computer-readable storage medium, and an electronic device.
Background
The model-attached means that a planar model is attached to a surface of an area having an undulation state in a scene. In a conventional three-dimensional rendering pipeline, a model is fixed before being sent into the pipeline for processing, and when the fluctuation state of the ground changes, the model cannot be attached to the ground, so that the problem of picture distortion is caused.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a model paste processing method, device, computer readable storage medium and electronic device, so as to improve the problem of image distortion caused by the fact that a model cannot be pasted with the ground at least to a certain extent.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to a first aspect of the present disclosure, there is provided a model tile processing method, comprising: acquiring a terrain height value of a reference point of a target area in a scene; weighting the terrain height value of each reference point according to the distance between a sampling point in the model to be attached to the ground and each reference point to obtain the height value of the sampling point; and attaching the model to be attached to the ground to the target area according to the height value of the sampling point.
In an exemplary embodiment of the present disclosure, a distance between a sampling point in the model to be attached to the ground and each of the reference points is determined by: acquiring position coordinates of sampling points in the model to be attached to the ground and the reference points in the same coordinate system; and determining the distance between the position coordinates of the sampling points and the position coordinates of the reference points.
In an exemplary embodiment of the present disclosure, the method further comprises: setting a bounding box of the model to be attached to the ground; determining a relative coordinate system by taking the size of the bounding box as a unit coordinate; the acquiring of the position coordinates of the sampling points in the model to be attached to the ground and the reference points in the same coordinate system includes: mapping the model to be attached to the ground into the bounding box, and determining the position coordinates of the sampling points in the relative coordinate system; and mapping each datum point into the bounding box, and determining the position coordinates of each datum point in the relative coordinate system.
In an exemplary embodiment of the present disclosure, the coordinate system is a planar coordinate system.
In an exemplary embodiment of the present disclosure, the weighting the terrain height value of each reference point according to the distance between the sampling point in the model to be attached to the ground and each reference point to obtain the height value of the sampling point includes: determining the weight value of each reference point relative to the sampling point according to the distance between the sampling point and each reference point; and weighting the terrain height value of each reference point by using the weight value of each reference point relative to the sampling point to obtain the height value of the sampling point.
In an exemplary embodiment of the present disclosure, the determining a weight value of each reference point relative to each sampling point according to a distance between the sampling point and the reference point includes: and determining the weight value of any reference point relative to the sampling point according to the reference distance and the distance from the sampling point to the reference point.
In an exemplary embodiment of the present disclosure, the determining a weight value of any one reference point with respect to any one of the reference points according to a reference distance and a distance from the sampling point to the any one reference point includes determining a distance from the sampling point to the any one reference point as a first distance; determining a second distance according to the first distance and a scaling coefficient; and determining the weight value of any reference point relative to the sampling point according to the reference distance and the second distance.
In an exemplary embodiment of the present disclosure, the scaling factor is determined by: and determining the scaling coefficient according to the number of the reference points.
In an exemplary embodiment of the present disclosure, the determining a second distance according to the first distance and a scaling factor includes: determining a product of the first distance and the scaling factor as the second distance.
In an exemplary embodiment of the present disclosure, includes: and dividing the scene into a plurality of sub-regions, and taking each sub-region as the target region.
In an exemplary embodiment of the present disclosure, the method further comprises: the reference points are arranged at equal intervals in the target region.
According to a second aspect of the present disclosure, there is provided a model patch processing apparatus comprising: the system comprises a reference point height value acquisition module, a target area detection module and a target area detection module, wherein the reference point height value acquisition module is used for acquiring the terrain height value of a reference point of a target area in a scene; the sampling point height value acquisition module is used for weighting the terrain height value of each reference point according to the distance between the sampling point in the model to be attached to the ground and each reference point to obtain the height value of the sampling point; and the ground pasting module is used for pasting the model to be pasted to the target area according to the height value of the sampling point.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the above-described model tile processing method.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above model tile processing method via execution of the executable instructions.
The technical scheme of the disclosure has the following beneficial effects:
weighting the terrain height value of each reference point in the target area according to the distance between the sampling point in the model to be attached to the ground and each reference point in the target area to obtain the height value of the sampling point in the model to be attached to the ground, and attaching the model to be attached to the target area according to the height value of the sampling point. Therefore, by simply weighting the datum points, the terrain height value representing any point in the target area can be simplified, the height value of the sampling point is set, the model to be attached to the ground can be accurately attached to the target area, the ground-attaching simulation effect of the model is achieved, the processing flow is simplified, bones do not need to be set, the bone-attaching operation is carried out, extra models do not need to be added, the consumption of resources such as internal memory is reduced, and the efficiency is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is apparent that the drawings in the following description are only some embodiments of the present disclosure, and that other drawings can be obtained from those drawings without inventive effort for a person skilled in the art.
FIG. 1 illustrates a flow chart of a model tile processing method in the present exemplary embodiment;
FIG. 2 shows an exemplary illustration of a probe placed at a fiducial point in this exemplary embodiment;
FIG. 3 illustrates an exemplary view of one of the exemplary embodiments of attaching a probe to a target area;
FIG. 4 is a diagram illustrating an example of a datum height value in the exemplary embodiment;
FIG. 5 illustrates a flow chart of a method of distance determination in the present exemplary embodiment;
fig. 6 shows a flowchart of a position coordinate acquisition method in the present exemplary embodiment;
FIG. 7 illustrates an exemplary diagram of a flat panel facet model in the present exemplary embodiment;
FIG. 8 illustrates an exemplary mapping of a flat patch into a bounding box in this exemplary embodiment;
fig. 9 is a flowchart showing a method of acquiring a height value of a sampling point in the present exemplary embodiment;
fig. 10 shows a flowchart of a weight value determination method in the present exemplary embodiment;
FIG. 11 illustrates an exemplary illustration of a model being fitted to a target area in the present exemplary embodiment;
fig. 12 to 20 are diagrams showing an example of a method of acquiring a height value of a one-dimensional model sampling point in the present exemplary embodiment;
FIG. 21 is a diagram showing an example of a scene in which a model is to be attached to the ground in the present exemplary embodiment;
FIG. 22 is a diagram illustrating an example of a model after being attached to the ground in the exemplary embodiment;
FIG. 23 is a view showing an example of a scene in which another model is to be attached to the ground in the present exemplary embodiment;
FIG. 24 is a diagram showing an example of a scene after another model is attached to the ground in the present exemplary embodiment;
FIG. 25 is a block diagram showing the configuration of a model patch processing apparatus in the present exemplary embodiment;
fig. 26 shows an electronic device for implementing the above method in the present exemplary embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Herein, "first", "second", etc. are labels for specific objects, and do not limit the number or order of the objects.
In one scheme of the related art, a skeleton covering technology is adopted to realize model ground pasting, and the method specifically comprises the following steps: and binding the model to be ground-attached to a plurality of bones, and determining the position of each bone in the target area by using the bones as probes, thereby realizing ground-attachment of the model. However, the scheme requires bone binding operation, the process is complicated, the implementation cost of the model attaching to the ground is high, and the time consumption is long.
In another related art, the model is attached to the ground by re-making a model adapted to the changes of the surface relief, for example, in a scene, leaves falling on a tree are attached to the surface of the relief, and a set of model adapted to the changes of the surface relief is usually made for the falling leaves according to the changes of the surface relief so as to attach the surface. However, this solution increases the operation flow, and additional model fabrication brings about an increase in memory consumption.
In view of one or more of the above problems, exemplary embodiments of the present disclosure provide a model tile processing method.
Fig. 1 shows a schematic flow of the model patch processing method in the present exemplary embodiment, including the following steps S110 to S130:
step S110, a terrain height value of a reference point of a target area in a scene is acquired.
And step S120, weighting the terrain height value of each reference point according to the distance between the sampling point in the model to be attached to the ground and each reference point to obtain the height value of the sampling point.
And step S130, attaching the model to be attached to the ground to the target area according to the height value of the sampling point.
Weighting the terrain height value of each reference point in the target area according to the distance between the sampling point in the model to be attached to the ground and each reference point in the target area to obtain the height value of the sampling point in the model to be attached to the ground, and attaching the model to be attached to the target area according to the height value of the sampling point. Therefore, by simply weighting the datum points, the terrain height value representing any point in the target area can be simplified, the height value of the sampling point is set, the model to be attached to the ground can be accurately attached to the target area, the ground-attaching simulation effect of the model is achieved, the processing flow is simplified, bones do not need to be set, the bone-attaching operation is carried out, extra models do not need to be added, the consumption of resources such as internal memory is reduced, and the efficiency is improved.
Each step in fig. 1 will be described in detail below.
In step S110, a terrain height value of a reference point of a target area in a scene is acquired.
The scene may be a virtual scene with a topographic relief state, such as a game scene, a map scene, and the like.
The target area can be any area needing to be attached to the ground model in the scene, for example, a forest path covering fallen leaves in the game scene, a stone pier for placing game props, a ground for displaying a skill range indication ring when the game character starts skills, and the like. In an alternative embodiment, the target area may be a unit of model-attaching the scene, for example, the scene is divided into a plurality of sub-areas, and each sub-area is used as the target area. The method is equivalent to the step of carrying out 'block' ground pasting processing on the whole scene, so that the problems of inaccurate ground pasting and adverse effects on the final ground pasting effect caused by overlarge scene area are avoided.
The reference points are points set in the target area, and determine position points of the target area, at which a terrain height value needs to be acquired. The terrain height value may be considered a value that measures terrain relief.
In an alternative embodiment, the terrain height value of the reference point may be obtained by: providing a plurality of probes; placing the probe at the position of the reference point and attaching the probe to the target area; and acquiring the height value of the probe to serve as the terrain height value of the reference point. Further, depending on the program system, the topographic height value of the reference point may be acquired by using a height map determination method or a radial collision body detection method. For example, the plane coordinates of a certain reference point in the scene are acquired, the plane coordinates are mapped into a height map of the scene, and the topographic height value of the corresponding position is read from the height map.
As shown in fig. 2, 16 reference points are provided, which are respectively identified by the numbers 0 to 15; the coordinates 0, -1, -2 in the figure are the coordinate dimensions of the target region, and thus the coordinates of the probe can be set and placed at the position of the reference point. As shown in fig. 3, the target region has a surface having a height-like shape, and the height value of the probe (i.e., the height value of the probe tip) is read by moving the probe in the height direction so as to be in contact with the surface of the target region, i.e., the height value of the ground of the reference point. FIG. 4 shows the height values of the probes identified from 0 to 15 in the target area of FIG. 3, which are also topographical height values for 16 fiducial points.
In an alternative embodiment, the reference points may be arranged at equal intervals in the target region. For example, the datum points are uniformly arranged in an array mode, and the datum points are arranged at equal intervals, so that when the ground attaching module is attached, the attaching effect of each part of the ground attaching module is uniform, the attaching degree of each part of the ground attaching module is prevented from being different, and the ground attaching effect finally presented is influenced.
In an alternative embodiment, the reference points may also be arranged at unequal intervals in the target region. For example, in a portion where the terrain is flat, the number of reference points is reduced by providing a large interval, and in a portion where the terrain is severely fluctuated, the number of reference points is increased by providing a small interval.
With reference to fig. 1, in step S120, the terrain height value of each reference point is weighted according to the distance between the sampling point in the model to be attached to the ground and each reference point, so as to obtain the height value of the sampling point.
The sampling points are points obtained by sampling from the model to be attached to the ground, and the effect of approximate attachment of the model to be attached to the ground is achieved through sampling. The model to be attached to the ground can be fallen leaves covering a forest path, can be a game prop placed on a stone pier, and can also be an indication ring for displaying a skill range under feet when a game character starts the skill, and the specific type of the model to be attached to the ground can be determined according to the actual situation, and is not limited specifically here.
In an alternative embodiment, referring to fig. 5, the distance between the sampling point in the model to be attached to the ground and each reference point can be determined by the following steps S510 and S520:
step S510, obtaining position coordinates of the sampling point and each reference point in the model to be attached to the ground in the same coordinate system.
The position coordinates of the sampling points in the model to be attached to the ground and the position coordinates of the reference points are based on the same coordinate system, and the measurement standard is unified. In addition, the coordinate system can be normalized to obtain a relative position coordinate value, so that the distance between the sampling point and the reference point can be calculated subsequently.
In an alternative embodiment, a bounding box of the model to be ground-attached is provided; the relative coordinate system is determined in coordinates in units of the dimensions of the bounding box. The bounding box may be scaled to unit size, for example: the bounding box is scaled to the [0, 1] interval. A method for acquiring position coordinates of a sampling point and each reference point in the same coordinate system in a model to be attached to the ground, as shown in fig. 6, includes the following steps S610 to S620:
and step S610, mapping the model to be attached to the ground into the bounding box, and determining the position coordinates of the sampling point in the relative coordinate system.
The to-be-pasted model may be scaled to unit size, as shown in fig. 7 for a flat patch model, where the numbers 0 and 1 represent the dimensional metric of the flat patch model. The flat panel patches are mapped into bounding boxes as shown in fig. 8. By determining the position coordinates of the sampling point, a referenceable relative coordinate value is provided for the subsequent determination of the distance between the sampling point and the reference point.
And step S620, mapping each reference point into the bounding box, and determining the position coordinates of each reference point in the relative coordinate system.
And mapping the reference points in the target area into the bounding box, and providing a referable relative coordinate value for subsequently determining the distance between the sampling point and the reference point by determining the position coordinates of each reference point. The execution sequence of step S610 and step S620 is not limited.
In an alternative embodiment, the coordinate system is a planar coordinate system.
The coordinate system is a coordinate system used to determine the relative position coordinates of the sample point and the reference point. The planar coordinate system may include two axes, an x-axis and a y-axis. The coordinates of the position of the sampling point in the relative coordinate system can be represented as MP (wx, wy), where wx and wy represent the coordinates of the sampling point in the x-axis and y-axis directions, respectively. The position coordinates of the reference point in the relative coordinate system may be represented as PP (px, py), where px and py represent the coordinates of the reference point in the x-axis and y-axis directions, respectively. And a plane coordinate system is adopted, so that the distance between the sampling point and the reference point is determined more simply and conveniently.
Step S520, determining a distance between the position coordinates of the sampling point and the position coordinates of each reference point.
For example, the distance between the reference point and the sampling point is obtained by calculating d ═ abs (MP-PP), where MP is the position coordinate value of the sampling point, PP is the position coordinate value of the reference point, abs is an absolute value function, and d is the distance between the sampling point and the reference point.
In an alternative embodiment, as shown in fig. 9, the height value of the sampling point may be obtained by weighting the terrain height value of each reference point according to the distance between the sampling point in the model to be attached to the ground and each reference point through the following steps S910 to S920:
step S910, determining the weight value of each reference point relative to the sampling point according to the distance between the sampling point and each reference point;
the weight value of the sampling point is related to the distance between the sampling point and each reference point, when the distance between the sampling point and each reference point is larger, the weight value of each reference point relative to the sampling point is set to be smaller, and when the distance between the sampling point and each reference point is smaller, the weight value of each reference point relative to the sampling point is set to be larger.
In an alternative embodiment, determining the weight value of each reference point relative to the sampling point according to the distance between the sampling point and each reference point includes: and determining the weight value of the reference point relative to the sampling point according to the reference distance and the distance from the sampling point to any reference point.
The reference distance may be set according to a maximum distance between the sampling point and each reference point, and may be set to a maximum distance value of the bounding box when mapping the reference point in the model to be attached or the target region into the bounding box, for example, may be set to 1 when scaling the bounding box to the [0, 1] interval. The weight value of any reference point relative to the sampling point can be obtained by subtracting the distance from the sampling point to the reference point from the reference distance. For example, the weight value of the reference point relative to the sampling point is obtained by calculating d ═ abs (MP-PP) and w ═ c-d, where MP is the position coordinate value of the sampling point, PP is the position coordinate value of the reference point, abs is an absolute value function, d is the distance between the sampling point and the reference point, c is a reference distance, and w is the weight value of the reference point relative to the sampling point. The weight value is determined by using the reference distance, and the size of the weight value is controlled.
In the present exemplary embodiment, the weight value of a reference point with respect to a sampling point is determined according to the reference distance and the distance from the sampling point to any reference point. How to determine the weight values is explained below:
in an alternative embodiment, as shown in fig. 10, the weight value of any reference point relative to the sampling point may be determined through the following steps S1010 to S1030:
step S1010, determining a distance between the sampling point and any reference point as a first distance.
In step S1020, a second distance is determined according to the first distance and the scaling factor.
In an alternative embodiment, the scaling factor is determined according to the number of reference points.
The scaling factor may be determined by the number of reference points set, and may be set to the number of reference points minus 1. Further, the number of reference points in different arrangement directions minus 1 may be used as the scaling factor of the reference points in each arrangement direction, for example, the reference points are arranged in a 4 × 3 array, that is, the number of reference points in the x-axis direction is 4, the number of reference points in the y-axis direction is 3, the scaling factor in the x-axis direction may be set to 3, and the scaling factor in the y-axis direction may be set to 2.
In an alternative embodiment, the method for determining the second distance according to the first distance and the scaling factor includes: the product of the first distance and the scaling factor is determined as the second distance.
Step S1030, determining a weight value of the reference point relative to the sampling point according to the reference distance and the second distance.
In the process, the weight value is controlled by introducing the scaling coefficient, so that the overlarge influence range of the weight is avoided.
Continuing with fig. 9, in step S920, the terrain height values of the reference points are weighted by using the weight values of the reference points relative to the sampling points, so as to obtain the height values of the sampling points.
For example, four reference points are provided, the weight values of the four reference points with respect to the sampling points are w1, w2, w3 and w4, respectively, and the terrain height values of the four reference points are h1, h2, h3 and h4, respectively, and the height value of the sampling point can be obtained by calculating w1 × h1+ w2 × h2+ w3 × h3+ w4 × h 4. The height values of the sampling points are obtained through weighting, and the operation is simple and easy to complete.
With continued reference to fig. 1, in step S130, the model to be attached to the ground is attached to the target area according to the height values of the sampling points.
Fig. 11 is an exemplary diagram of fitting a flat panel dough model into a target area, with the center light region of the diagram being the fitted flat panel dough model.
In the present exemplary embodiment, when the model to be attached to the ground is a one-dimensional model, the method of obtaining the height value of the sampling point is as shown in fig. 12 to 20:
as shown in fig. 12, in the x-axis direction, there are four probe points, which are named probe point 1, probe point 2, probe point 3, and probe point 4 from left to right in sequence, and assuming that the position coordinate of probe point 2 is 0.33 and the vertical axis is a weight, in order to avoid an excessive influence of the weight, the distance from the sample point to the probe point is multiplied by a scaling coefficient, so as to obtain the result shown in fig. 13, where the scaling coefficient is obtained by subtracting 1 from the number of probe points, that is, the scaling coefficient is 3. The result shown in fig. 13 was truncated to take a value in the range of [0, 1] to obtain the result shown in fig. 14. The same operation is performed for each probe point, resulting in weight data as shown in fig. 15. Next, the weighted data obtained in fig. 15 is multiplied by the height value of each probe point to obtain the weighted height value of each probe point relative to the sampling point, as shown in fig. 16 to 19, fig. 16 shows the weighted height value of probe point 1 relative to the sampling point, fig. 17 shows the weighted height value of probe point 2 relative to the sampling point, fig. 18 shows the weighted height value of probe point 3 relative to the sampling point, and fig. 19 shows the weighted height value of probe point 4 relative to the sampling point. The weighted height values of the respective probe points with respect to the sampling points are summed to obtain the height values of the sampling points, as shown in fig. 20.
In the present exemplary embodiment, an example of practical application is shown in fig. 21 to 24. Fig. 21 is a view of a scene in which a model is to be applied to the ground, wherein the leaves of the scene are sketched as a model to be applied to the ground, the branches and the ground of the tree are used as target areas, and fig. 22 is an effect display after model application processing is performed in the scene of fig. 21. Fig. 23 is another view of a scene in which the model is to be applied to the ground, wherein two sides of the road are used as target areas, and fig. 24 is an effect display after the leaf model is applied to the ground in the scene of fig. 23.
Exemplary embodiments of the present disclosure also provide a model patch processing apparatus, as shown in fig. 25, the model patch processing apparatus 2500 may include:
a reference point height value obtaining module 2510, configured to obtain a terrain height value of a reference point of a target area in a scene;
the sampling point height value acquisition module 2520 is configured to weight the terrain height value of each reference point according to a distance between the sampling point in the model to be attached to the ground and each reference point, so as to obtain a height value of the sampling point;
and the ground pasting module 2530 is used for pasting the model to be pasted to the target area according to the height value of the sampling point.
In an alternative embodiment, the sampling point height value obtaining module 2520 includes:
the position coordinate acquisition module is used for acquiring the position coordinates of the sampling points and the reference points in the model to be attached to the ground in the same coordinate system;
and the distance determining module is used for determining the distance between the position coordinates of the sampling points and the position coordinates of the reference points.
In an alternative embodiment, the position coordinate obtaining module includes: setting a bounding box of the model to be adhered to the ground; the relative coordinate system is determined in coordinates in units of the dimensions of the bounding box. A location coordinate acquisition module configured to:
mapping the model to be attached to the ground into the bounding box, and determining the position coordinates of the sampling point in a relative coordinate system;
and mapping each datum point into the bounding box, and determining the position coordinates of each datum point in the relative coordinate system.
In an alternative embodiment, the coordinate system in the position coordinate acquisition module is set to a planar coordinate system.
In an alternative embodiment, the sampling point height value obtaining module 2520 includes:
a weight value determination module: the weighting value of each reference point relative to the sampling point is determined according to the distance between the sampling point and each reference point;
a sampling point height value obtaining submodule: and the weighting module is used for weighting the terrain height value of each reference point by using the weight value of each reference point relative to the sampling point to obtain the height value of the sampling point.
In an optional implementation, the weight value determining module includes:
and the first weight value determining submodule is used for determining the weight value of any reference point relative to the sampling point according to the reference distance and the distance from the sampling point to any reference point.
In an optional embodiment, the first weight value determining sub-module includes:
the first distance determining module is used for determining the distance from the sampling point to any reference point as a first distance;
the second distance determining module is used for determining a second distance according to the first distance and the scaling coefficient;
and the second weight value determining submodule is used for determining the weight value of any reference point relative to the sampling point according to the reference distance and the second distance.
In an alternative embodiment, the scaling factor in the second distance determining module is determined by:
the scaling factor is determined according to the number of reference points.
In an alternative embodiment, the second distance determination module is configured to:
the product of the first distance and the scaling factor is determined as the second distance.
In an alternative embodiment, the model patch processing apparatus 2500 further includes a target area dividing module: the method is used for dividing a scene into a plurality of sub-areas, and each sub-area is respectively used as a target area.
In an alternative embodiment, the model patch processing apparatus 2500 further includes a reference point setting module: for placing the reference points at equal intervals in the target area.
The specific details of each part in the model patch processing apparatus 2500 are already described in detail in the method part embodiments, and details that are not disclosed may refer to the method part embodiments, and thus are not described again.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing an electronic device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the electronic device. The program product may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The exemplary embodiment of the present disclosure also provides an electronic device capable of implementing the above method. An electronic device 2600 according to such an exemplary embodiment of the present disclosure is described below with reference to fig. 26. The electronic device 2600 shown in fig. 26 is only an example and should not bring any limitation to the function and the scope of use of the embodiments of the present disclosure.
As shown in fig. 26, electronic device 2600 may take the form of a general purpose computing device. Components of electronic device 2600 may include, but are not limited to: at least one processing unit 2610, at least one storage unit 2620, a bus 2630 that couples various system components including the storage unit 2620 and the processing unit 2610, and a display unit 2640.
The storage unit 2620 stores program code that may be executed by the processing unit 2610 such that the processing unit 2610 performs the steps according to various exemplary embodiments of the present disclosure as described in the "exemplary methods" section above in this specification. For example, the processing unit 2610 may perform any one or more of the method steps of fig. 1, 5, 6, 9, and 10.
The storage unit 2620 may include readable media in the form of volatile storage units such as a random access memory unit (RAM)2621 and/or a cache storage unit 2622, and may further include a read only memory unit (ROM) 2623.
The storage unit 2620 may also include a program/utility 2624 having a set (at least one) of program modules 2625, such program modules 2625 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the exemplary embodiments of the present disclosure.
Furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit, according to exemplary embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements 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 to be limited only by the following claims.
Claims (14)
1. A method for model tile processing, comprising:
acquiring a terrain height value of a reference point of a target area in a scene;
weighting the terrain height value of each reference point according to the distance between a sampling point in the model to be attached to the ground and each reference point to obtain the height value of the sampling point;
and attaching the model to be attached to the ground to the target area according to the height value of the sampling point.
2. The method of claim 1, wherein the distance between the sampling point in the model to be attached to the ground and each reference point is determined by:
acquiring position coordinates of sampling points in the model to be attached to the ground and the reference points in the same coordinate system;
and determining the distance between the position coordinates of the sampling points and the position coordinates of the reference points.
3. The method of claim 2, further comprising:
setting a bounding box of the model to be attached to the ground;
determining a relative coordinate system by taking the size of the bounding box as a unit coordinate;
the acquiring of the position coordinates of the sampling points in the model to be attached to the ground and the reference points in the same coordinate system includes:
mapping the model to be attached to the ground into the bounding box, and determining the position coordinates of the sampling points in the relative coordinate system;
and mapping each datum point into the bounding box, and determining the position coordinates of each datum point in the relative coordinate system.
4. The method of claim 2, comprising:
the coordinate system is a plane coordinate system.
5. The method according to claim 1, wherein the weighting the terrain height value of each reference point according to the distance between the sampling point in the model to be attached to the ground and each reference point to obtain the height value of the sampling point comprises:
determining the weight value of each reference point relative to the sampling point according to the distance between the sampling point and each reference point;
and weighting the terrain height value of each reference point by using the weight value of each reference point relative to the sampling point to obtain the height value of the sampling point.
6. The method of claim 5, wherein determining the weight value of each reference point relative to the sampling point according to the distance between the sampling point and each reference point comprises:
and determining the weight value of any reference point relative to the sampling point according to the reference distance and the distance from the sampling point to the reference point.
7. The method of claim 6, wherein determining the weight value of any reference point relative to any sampling point according to the distance between the reference distance and the sampling point to the reference point comprises:
determining the distance from the sampling point to any reference point as a first distance;
determining a second distance according to the first distance and a scaling coefficient;
and determining the weight value of any reference point relative to the sampling point according to the reference distance and the second distance.
8. The method of claim 7, wherein the scaling factor is determined by:
and determining the scaling coefficient according to the number of the reference points.
9. The method of claim 7, wherein determining the second distance based on the first distance and a scaling factor comprises:
determining a product of the first distance and the scaling factor as the second distance.
10. The method of claim 1, comprising:
and dividing the scene into a plurality of sub-regions, and taking each sub-region as the target region.
11. The method of claim 1, further comprising:
the reference points are arranged at equal intervals in the target region.
12. A model tile handling apparatus, comprising:
the system comprises a reference point height value acquisition module, a target area detection module and a target area detection module, wherein the reference point height value acquisition module is used for acquiring the terrain height value of a reference point of a target area in a scene;
the sampling point height value acquisition module is used for weighting the terrain height value of each reference point according to the distance between the sampling point in the model to be attached to the ground and each reference point to obtain the height value of the sampling point;
and the ground pasting module is used for pasting the model to be pasted to the target area according to the height value of the sampling point.
13. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 11.
14. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1 to 11 via execution of the executable instructions.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011181734.6A CN112215968B (en) | 2020-10-29 | 2020-10-29 | Model paste processing method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011181734.6A CN112215968B (en) | 2020-10-29 | 2020-10-29 | Model paste processing method and device, storage medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112215968A true CN112215968A (en) | 2021-01-12 |
CN112215968B CN112215968B (en) | 2024-07-16 |
Family
ID=74057471
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011181734.6A Active CN112215968B (en) | 2020-10-29 | 2020-10-29 | Model paste processing method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112215968B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10207356A (en) * | 1997-01-20 | 1998-08-07 | Nissan Motor Co Ltd | Navigation system and medium which stores navigation program using the system |
JPH10207351A (en) * | 1997-01-20 | 1998-08-07 | Nissan Motor Co Ltd | Navigation system and medium which stores navigation program using the system |
US20030022715A1 (en) * | 2001-07-30 | 2003-01-30 | Namco Ltd. | Image generation method, program, and information storage medium |
CN105678840A (en) * | 2014-11-18 | 2016-06-15 | 江苏京安拓达软件科技有限公司 | Rapid generation custom road implement method on the basis of three-dimensional terrain software system |
CN108245893A (en) * | 2018-02-09 | 2018-07-06 | 腾讯科技(深圳)有限公司 | The attitude determination method of virtual objects, device and medium in three-dimensional virtual environment |
CN111127576A (en) * | 2019-12-18 | 2020-05-08 | 北京像素软件科技股份有限公司 | Game picture rendering method and device and electronic equipment |
-
2020
- 2020-10-29 CN CN202011181734.6A patent/CN112215968B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10207356A (en) * | 1997-01-20 | 1998-08-07 | Nissan Motor Co Ltd | Navigation system and medium which stores navigation program using the system |
JPH10207351A (en) * | 1997-01-20 | 1998-08-07 | Nissan Motor Co Ltd | Navigation system and medium which stores navigation program using the system |
US20030022715A1 (en) * | 2001-07-30 | 2003-01-30 | Namco Ltd. | Image generation method, program, and information storage medium |
CN105678840A (en) * | 2014-11-18 | 2016-06-15 | 江苏京安拓达软件科技有限公司 | Rapid generation custom road implement method on the basis of three-dimensional terrain software system |
CN108245893A (en) * | 2018-02-09 | 2018-07-06 | 腾讯科技(深圳)有限公司 | The attitude determination method of virtual objects, device and medium in three-dimensional virtual environment |
CN111127576A (en) * | 2019-12-18 | 2020-05-08 | 北京像素软件科技股份有限公司 | Game picture rendering method and device and electronic equipment |
Non-Patent Citations (1)
Title |
---|
王家润;孙禹楠;尹辉;杨志龙;: "军事目标关系的拟合地势及双重保凸可视建模", 计算机工程与应用, vol. 56, no. 05, pages 270 - 278 * |
Also Published As
Publication number | Publication date |
---|---|
CN112215968B (en) | 2024-07-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108732582B (en) | Vehicle positioning method and device | |
CN109190573B (en) | Ground detection method applied to unmanned vehicle, electronic equipment and vehicle | |
JP3910582B2 (en) | Three-dimensional structure shape automatic generation apparatus, automatic generation method, program thereof, and recording medium recording the program | |
JP2020035448A (en) | Method, apparatus, device, storage medium for generating three-dimensional scene map | |
CN110686704A (en) | Pose calibration method, system and medium for laser radar and combined inertial navigation | |
CN110764111A (en) | Conversion method, device, system and medium of radar coordinates and geodetic coordinates | |
CN110478898B (en) | Configuration method and device of virtual scene in game, storage medium and electronic equipment | |
CN113487717B (en) | Picture processing method and device, computer readable storage medium and electronic equipment | |
CN113077548A (en) | Collision detection method, device, equipment and storage medium for object | |
CN110555352B (en) | Interest point identification method, device, server and storage medium | |
CN112023400A (en) | Height map generation method, device, equipment and storage medium | |
CN111159451B (en) | Power line point cloud dynamic monomer method based on spatial database | |
CN110110696B (en) | Method and apparatus for processing information | |
CN111659123A (en) | Navigation data processing method and device, storage medium and electronic equipment | |
US20140325477A1 (en) | Method and system for visualization of large codebases | |
CN114049403A (en) | Multi-angle three-dimensional face reconstruction method and device and storage medium | |
CN113761618A (en) | 3D simulation road network automation construction method and system based on real data | |
JP6995912B2 (en) | Topographic map output device, topographic map output method and program | |
CN112215968B (en) | Model paste processing method and device, storage medium and electronic equipment | |
CN110853098A (en) | Robot positioning method, device, equipment and storage medium | |
CN109241059A (en) | A kind of building method of point cloud data, device, electronic equipment and storage medium | |
US20210348938A1 (en) | Sensor calibration for space translation | |
JP6893307B1 (en) | Topographic map output device, topographic map output method and program | |
CN111870954A (en) | Height map generation method, device, equipment and storage medium | |
CN110335205B (en) | Landform smoothing method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |