CN112215968B - 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
- CN112215968B CN112215968B CN202011181734.6A CN202011181734A CN112215968B CN 112215968 B CN112215968 B CN 112215968B CN 202011181734 A CN202011181734 A CN 202011181734A CN 112215968 B CN112215968 B CN 112215968B
- Authority
- CN
- China
- Prior art keywords
- point
- distance
- model
- height value
- 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.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 13
- 238000005070 sampling Methods 0.000 claims abstract description 144
- 238000000034 method Methods 0.000 claims abstract description 44
- 238000012545 processing Methods 0.000 claims abstract description 21
- 238000013507 mapping Methods 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 3
- 230000000694 effects Effects 0.000 abstract description 9
- 238000004088 simulation Methods 0.000 abstract description 3
- 239000000523 sample Substances 0.000 description 28
- 238000010586 diagram Methods 0.000 description 10
- 210000000988 bone and bone Anatomy 0.000 description 8
- 230000008569 process Effects 0.000 description 7
- 238000012876 topography Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000006978 adaptation Effects 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
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000002708 enhancing effect Effects 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
- 230000002123 temporal effect Effects 0.000 description 1
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, a model paste processing 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 datum point of a target area in a scene; weighting the terrain height value of each datum point according to the distance between the sampling point in the model to be pasted and each datum point to obtain the height value of the sampling point; and pasting the to-be-pasted model to the target area according to the height value of the sampling point. The method and the device can realize the simulation effect of the model ground, simplify the processing flow of the model ground and reduce the resource consumption.
Description
Technical Field
The disclosure relates to the field of computer technology, and in particular relates to a model paste processing method, a model paste processing device, a computer readable storage medium and electronic equipment.
Background
Model grounding refers to bonding a planar model to the surface of an area with a high-low fluctuation state in a scene. In the conventional three-dimensional rendering pipeline, the form of the model is fixed before the model is 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 can be generated.
It should be noted that the information disclosed in the above background section is only for enhancing 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 disclosure provides a model pasting processing method, a device, a computer readable storage medium and electronic equipment, so as to at least improve the problem of picture distortion caused by incapability of pasting a model to the ground to a certain extent.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to a first aspect of the present disclosure, there is provided a model paste processing method including: acquiring a terrain height value of a datum point of a target area in a scene; weighting the terrain height value of each datum point according to the distance between the sampling point in the model to be pasted and each datum point to obtain the height value of the sampling point; and pasting the to-be-pasted model to the target area according to the height value of the sampling point.
In an exemplary embodiment of the present disclosure, the distance between the sampling point and each of the reference points in the model to be grounded is determined by: acquiring position coordinates of sampling points in the model to be pasted and the datum points in the same coordinate system; and determining the distance between the position coordinates of the sampling points and the position coordinates of the datum points.
In an exemplary embodiment of the present disclosure, the method further comprises: setting a bounding box of the model to be pasted; determining a relative coordinate system by taking the size of the bounding box as a unit coordinate; the obtaining the position coordinates of the sampling points and the reference points in the same coordinate system in the to-be-attached model includes: mapping the model to be pasted into the bounding box, and determining the position coordinates of the sampling points in the relative coordinate system; mapping each datum point into the bounding box, and determining the position coordinates of each datum point in the relative coordinate system.
In one exemplary embodiment of the present disclosure, the coordinate system is a planar coordinate system.
In an exemplary embodiment of the disclosure, the weighting the terrain height value of each reference point according to the distance between the sampling point and each reference point in the model to be pasted to obtain the height value of the sampling point includes: determining a weight value of each datum point relative to the sampling point according to the distance between the sampling point and each datum point; and weighting the terrain height value of each datum point by using the weight value of each datum point relative to the sampling point to obtain the height value of the sampling point.
In an exemplary embodiment of the disclosure, the 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 a weight value of any datum point relative to the sampling point according to the reference distance and the distance between the sampling point and any datum point.
In an exemplary embodiment of the disclosure, the determining a weight value of any reference point relative to the sampling point according to a reference distance and a distance between the sampling point and any reference point includes determining a distance between the sampling point and any reference point as a first distance; determining a second distance according to the first distance and the scaling factor; and determining the weight value of any datum 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: the scaling factor is determined based on the number of fiducial points.
In an exemplary embodiment of the disclosure, the 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.
In one exemplary embodiment of the present disclosure, there is provided: dividing the scene into a plurality of subareas, and taking each subarea as the target area.
In an exemplary embodiment of the present disclosure, the method further comprises: each of the reference points is disposed at equal intervals in the target area.
According to a second aspect of the present disclosure, there is provided a model paste processing apparatus including: the datum point height value acquisition module is used for acquiring a terrain height value of a datum point of a target area in the scene; the sampling point height value acquisition module is used for weighting the terrain height value of each datum point according to the distance between the sampling point in the model to be pasted and each datum point to obtain the height value of the sampling point; and the grounding module is used for attaching the to-be-attached model 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 paste 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-described model paste processing method via execution of the executable instructions.
The technical scheme of the present disclosure has the following beneficial effects:
And weighting the terrain height value of each datum point in the target area through the distance between the sampling point in the model to be pasted and each datum point in the target area to obtain the height value of the sampling point in the model to be pasted, and pasting the model to be pasted to the target area according to the height value of the sampling point. Therefore, the terrain height value of any point in the target area can be simplified and represented by simply weighting the datum points, so that the height value of the sampling point is set, the model to be pasted can be more accurately attached to the target area, the simulation effect of model grounding is realized, meanwhile, the processing flow is simplified, bones are not required to be arranged, the operation of binding the bones is not required to be carried out, additional models are not required to be added, and therefore the consumption of resources such as memory and the like 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 disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely some embodiments of the present disclosure and that other drawings may be derived from these drawings without undue effort.
Fig. 1 shows a flowchart of a model paste processing method in the present exemplary embodiment;
FIG. 2 shows an exemplary diagram of a probe placed at a datum point in the present exemplary embodiment;
FIG. 3 is a diagram showing an example of bonding a probe to a target area in the present exemplary embodiment;
Fig. 4 shows an exemplary map of reference point height values in the present exemplary embodiment;
Fig. 5 shows a flowchart of a distance determination method in the present exemplary embodiment;
fig. 6 shows a flowchart of a position coordinate acquisition method in the present exemplary embodiment;
fig. 7 shows an exemplary diagram of a flat panel patch model in the present exemplary embodiment;
FIG. 8 shows an exemplary diagram of a flat panel patch mapping into a bounding box in the present exemplary embodiment;
fig. 9 is a flowchart showing a height value acquisition method 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 is an exemplary diagram showing a model conforming to a target area in the present exemplary embodiment;
fig. 12 to 20 are diagrams showing an example of a method for acquiring a height value of a one-dimensional model sampling point in the present exemplary embodiment;
fig. 21 is a view showing an example of a scene in which a model is to be pasted in the present exemplary embodiment;
Fig. 22 is a view showing an example of a scene after model pasting in the present exemplary embodiment;
fig. 23 is a view showing another example of a scene where a model is to be pasted in the present exemplary embodiment;
Fig. 24 is a view showing another example of a scene after model pasting in the present exemplary embodiment;
fig. 25 is a block diagram showing a structure of a model paste 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 be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many 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 the 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 present disclosure. One skilled in the relevant art will recognize, however, that the aspects of the disclosure may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. 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 a repetitive description thereof 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 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 objects.
In one scheme of the related technology, the model ground pasting is realized by adopting a bone skin technology, and specifically comprises the following steps: binding the model to be grounded to a plurality of bones, and determining the position of each bone falling on a target area by taking the bones as probes, thereby realizing model grounding. However, the scheme needs to perform skeleton binding operation, the process is complicated, the realization cost of model grounding is high, and the time is long.
In another related art, model grounding is achieved by reproducing a model adapted to the fluctuation of the earth's surface, for example, in a scene, attaching leaves that fall on a tree to the fluctuating earth's surface, and it is also generally necessary to reproduce a set of models adapted to the fluctuation of the earth's surface for the fallen leaves according to the fluctuation of the earth's surface, so as to perform the earth's surface attachment. However, this solution increases the operation flow, and creating additional models brings about an increase in memory consumption.
In view of one or more of the problems described above, exemplary embodiments of the present disclosure provide a model paste processing method.
Fig. 1 shows a schematic flow of the model paste processing method in the present exemplary embodiment, including the following steps S110 to S130:
Step S110, obtaining a terrain height value of a reference point of a target area in a scene.
Step S120, weighting the terrain height value of each datum point according to the distance between the sampling point and each datum point in the model to be pasted to obtain the height value of the sampling point.
And step S130, pasting the model to be pasted to the target area according to the height value of the sampling point.
And weighting the terrain height value of each datum point in the target area through the distance between the sampling point in the model to be pasted and each datum point in the target area to obtain the height value of the sampling point in the model to be pasted, and pasting the model to be pasted to the target area according to the height value of the sampling point. Therefore, the terrain height value of any point in the target area can be simplified and represented by simply weighting the datum points, so that the height value of the sampling point is set, the model to be pasted can be more accurately attached to the target area, the simulation effect of model grounding is realized, meanwhile, the processing flow is simplified, bones are not required to be arranged, the operation of binding the bones is not required to be carried out, additional models are not required to be added, and therefore the consumption of resources such as memory and the like is reduced, and the efficiency is improved.
Each step in fig. 1 is specifically described below.
In step S110, a terrain height value of a reference point of a target area in a scene is acquired.
The above scene may be a virtual scene having a relief state of a topography, such as a game scene, a map scene, or the like.
The target area may be any area in the scene where a ground-engaging model is to be engaged, for example, a woodland road covering fallen leaves in a game scene, a stone pier for placing a game prop, a ground surface for displaying a skill range indicating ring when a game character starts skills, and the like. In an alternative embodiment, the target area may be a unit for model-grounding the scene, for example, dividing the scene into a plurality of sub-areas, and taking each sub-area as the target area. The method is equivalent to 'blocking' ground pasting treatment of the whole scene, and avoids the bad influence on the final ground pasting effect and the inaccurate pasting caused by the overlarge scene area.
The reference points are points set in the target area, and the position points in the target area, where the terrain height value needs to be acquired, are determined, and it should be noted that the number of the reference points in one target area is more than one and can be multiple. The terrain elevation value may be regarded as a value that measures the topography elevation.
In an alternative embodiment, the terrain height value of the datum point may be obtained by: providing a plurality of probes; placing the probe at the position of the datum point and attaching the probe to the target area; the height value of the probe is obtained as a topography height value of the reference point. Depending on the program system, the topographic elevation value of the reference point may be acquired using an elevation map determination method or a ray-impact body detection method. For example, a plane coordinate of a certain reference point in a scene is acquired, the plane coordinate is mapped to a height map of the scene, and a terrain height value of a corresponding position is read from the height map.
As shown in fig. 2, 16 reference points are set, identified with numerals 0 to 15, respectively; in the figure, 0, -1 and-2 are coordinate scales of the target area, so that the coordinates of the probe can be set and placed at the reference point. As shown in fig. 3, the target area has a surface with a height, and the probe is moved in the height direction to be attached to the surface of the target area, and the height value of the probe (i.e., the height value of the probe tip) is read, i.e., the topography height value of the reference point. Fig. 4 shows the height values of the probe in the target area of fig. 3, identified from 0 to 15, also the topography height values of 16 fiducial points.
In an alternative embodiment, the fiducial points may be equally spaced in the target area. For example, the datum points are uniformly distributed in an array mode, and the datum points are arranged at equal intervals, so that when the ground pasting module is attached, the attaching effect of each part of the ground pasting module is uniform, and the attaching degree of each part of the ground pasting module is prevented from being different, so that the finally presented ground pasting effect is influenced.
In an alternative embodiment, the reference points may also be arranged non-equally spaced in the target region. For example, in a portion where the terrain is flat, a large interval is provided so that the number of reference points is small, and in a portion where the terrain is severely fluctuated, a small interval is provided so that the number of reference points is large.
With continued 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 and each reference point in the model to be pasted, so as to obtain the height value of the sampling point.
The sampling point is a point obtained by sampling from the model to be pasted, and the effect of approximate pasting of the model to be pasted is achieved through sampling. The model to be attached can be fallen leaves covering Lin Jian paths, can be game props placed on stone piers, can also be an indication ring for displaying the skill range under the feet when the game characters start skills, and the specific type of the adopted model to be attached can be determined according to actual conditions without specific limitation.
In an alternative embodiment, referring to fig. 5, the distance between the sampling point and each reference point in the model to be attached may be determined by the following steps S510 and S520:
Step S510, obtaining the position coordinates of the sampling points and the datum points in the same coordinate system in the to-be-pasted model.
The position coordinates of the sampling points in the model to be pasted and the position coordinates of the datum 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 as to facilitate the subsequent calculation of the distance between the sampling point and the reference point.
In an alternative embodiment, a bounding box of the model to be pasted is provided; and determining a relative coordinate system by taking the size of the bounding box as a unit coordinate. The bounding box may be scaled to a unit size, for example: scaling the bounding box to the [0,1] interval. A method for obtaining the position coordinates of the sampling points and the reference points in the same coordinate system in the to-be-pasted model, as shown in fig. 6, includes the following steps S610 to S620:
In step S610, the model to be pasted is mapped into the bounding box, and the position coordinates of the sampling points in the relative coordinate system are determined.
The model to be tiled may be scaled to a unit size, such as a flat panel model as shown in fig. 7, where the numerals 0 and 1 represent the dimensional metric values of the flat panel model. The flat 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.
In step S620, each reference point is mapped into the bounding box, and the position coordinates of each reference point in the relative coordinate system are determined.
Mapping the fiducial points in the target region into the bounding box provides referenceable relative coordinate values for subsequent determination of the distance between the sampling point and the fiducial point by determining the position coordinates of each fiducial point. The execution order 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 used to determine the relative position coordinates of the sampling point and the reference point. The planar coordinate system may include two axes, an x-axis and a y-axis. The position coordinates of the sampling point in the relative coordinate system may be denoted as MP (wx, wy), where wx and wy denote 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 expressed as PP (px, py), where px and py represent the coordinates of the reference point in the x-axis and y-axis directions, respectively. The plane coordinate system is adopted, so that the distance between the sampling point and the reference point is simpler and more convenient to determine.
In step S520, a distance between the position coordinates of the sampling point and the position coordinates of each reference point is determined.
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 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 and each reference point in the model to be pasted in the following steps S910 to S920:
Step S910, determining a weight value of each datum point relative to the sampling point according to the distance between the sampling point and each datum point;
The weight value of the sampling point is related to the distance between the sampling point and each reference point, and the weight value of each reference point is set smaller with respect to the sampling point when the distance between the sampling point and each reference point is 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 datum point relative to the sampling point according to the reference distance and the distance between the sampling point and any datum point.
The reference distance may be set according to a maximum distance of the sampling point from 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 pasted or the target area into the bounding box, for example, may be set to 1 when scaling the bounding box to the [0,1] section. 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, a weight value between a reference point and a sampling point is obtained by calculating d=abs (MP-PP) and w=c-d, where MP is a position coordinate value of the sampling point, PP is a position coordinate value of the reference point, abs is an absolute function, d is a distance between the sampling point and the reference point, c is a reference distance, and w is a weight value between the reference point and the sampling point. And determining a weight value by utilizing the reference distance, and controlling the size of the weight value.
In the present exemplary embodiment, the weight value of the reference point with respect to the sampling point is determined according to the distance between the reference distance and the sampling point to any reference point. The following describes how the weight values are determined:
In an alternative embodiment, as shown in fig. 10, the weight value of any reference point with respect to the sampling point may be determined by the following steps S1010 to S1030:
in step S1010, a distance from the sampling point to any reference point is determined 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 based on the number of fiducial 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, according to the arrangement of the reference points, the number of reference points in different arrangement directions may be reduced by 1 as the scaling factor of the reference points in each arrangement direction, for example, the reference points may be arranged in a 4*3 array, i.e., 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, a method for determining a second distance from a first distance and a scaling factor includes: a product of the first distance and the scaling factor is determined as a second distance.
In step S1030, a weight value of the reference point with respect to the sampling point is determined according to the reference distance and the second distance.
In the process, the scaling coefficient is introduced to control the weight value, so that the influence range of the weight is prevented from being too large.
With continued reference to fig. 9, step S920 weights the terrain height values of the reference points with the weight values of the reference points with respect to the sampling points to obtain the height values of the sampling points.
For example, four reference points are set, the weight values of the four reference points relative to the sampling points are w1, w2, w3 and w4, and the terrain height values of the four reference points are h1, h2, h3 and h4, respectively, and the height value of the sampling points can be obtained by calculating w1×h1+w2×h2+w3×h3+w4×h 4. The height value of the sampling point is 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 pasted is pasted to the target area according to the height value of the sampling point.
FIG. 11 is an exemplary illustration of a flat panel sheet mold being attached to a target area, with a light center area of the illustration being the attached flat panel sheet mold.
In the present exemplary embodiment, when the model to be grounded is a one-dimensional model, a method for obtaining a height value of a sampling point is as shown in fig. 12 to 20:
As shown in fig. 12, there are four probe points in the x-axis direction, which are named probe point 1, probe point 2, probe point 3, and probe point 4 in this order from left to right, and assuming that the position coordinate of probe point 2 is 0.33 and the vertical axis is a weight, the distance from the sampling point to the probe point is multiplied by a scaling factor, which is the number of probe points minus 1, that is, a scaling factor of 3, in order to avoid the influence of the weight being excessive, to obtain the result shown in fig. 13. The result shown in FIG. 13 is subjected to a truncation operation, taking values 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 height values of the probe points with respect to the sampling points are obtained by multiplying the height values of the probe points by the weight data obtained in fig. 15, and as shown in fig. 16 to 19, fig. 16 shows the weighted height value of the probe point 1 with respect to the sampling point, fig. 17 shows the weighted height value of the probe point 2 with respect to the sampling point, fig. 18 shows the weighted height value of the probe point 3 with respect to the sampling point, and fig. 19 shows the weighted height value of the probe point 4 with respect to the sampling point. The weighted height values of each probe point with respect to the sampling point are added to obtain the height value of the sampling point, as shown in fig. 20.
In the present exemplary embodiment, practical examples are shown in fig. 21 to 24. Fig. 21 is a scene diagram of a model pasting operation, in which leaves sketched in the scene are used as models to be pasted, branches and the ground of a tree are used as target areas, and fig. 22 is an effect display after the model pasting process in the scene of fig. 21. Fig. 23 is another scene diagram of the to-be-model-grounded operation, in which two sides of the road are used as target areas, and fig. 24 is an effect display of the to-be-model-grounded leaf in the scene of fig. 23.
Exemplary embodiments of the present disclosure also provide a model paste processing apparatus, as shown in fig. 25, the model paste processing apparatus 2500 may include:
a reference point height value acquisition module 2510 for acquiring a terrain height value of a reference point of a target region in a scene;
The sampling point height value obtaining module 2520 is configured to weight the terrain height value of each reference point according to the distance between the sampling point and each reference point in the model to be pasted to obtain the height value of the sampling point;
and the pasting module 2530 is used for pasting the to-be-pasted model to the target area according to the height value of the sampling point.
In an alternative embodiment, the sampling point height value acquisition module 2520 includes:
The position coordinate acquisition module is used for acquiring position coordinates of the sampling points and the datum points in the to-be-attached model 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 datum points.
In an alternative embodiment, the location coordinate acquisition module includes: setting a bounding box of a model to be pasted; and determining a relative coordinate system by taking the size of the bounding box as a unit coordinate. A position coordinate acquisition module configured to:
mapping the model to be pasted into a bounding box, and determining the position coordinates of the sampling points in a relative coordinate system;
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 as a planar coordinate system.
In an alternative embodiment, the sampling point height value acquisition module 2520 includes:
weight value determining module: the weight value of each datum point relative to the sampling point is determined according to the distance between the sampling point and each datum point;
Sampling point height value acquisition submodule: the method is used for weighting the terrain height values of the datum points by using the weight values of the datum points relative to the sampling points to obtain the height values of the sampling points.
In an alternative embodiment, the weight value determining module includes:
And the first weight value determination submodule is used for determining the weight value of any datum point relative to the sampling point according to the distance between the reference distance and the sampling point and the distance between the reference distance and any datum point.
In an alternative 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 datum point to serve 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 datum 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 determination module is determined by:
the scaling factor is determined based on the number of fiducial points.
In an alternative embodiment, the second distance determination module is configured to:
a product of the first distance and the scaling factor is determined as a second distance.
In an alternative embodiment, the model patch processing device 2500 further includes a target area dividing module: for dividing the scene into a plurality of sub-regions, each sub-region being a target region.
In an alternative embodiment, the model paste processing apparatus 2500 further includes a reference point setting module: for equally spacing the fiducial points in the target area.
The specific details of each part of the model paste processing device 2500 are described in detail in the method part embodiments, and the details not disclosed can be referred to the method part embodiments, so that the details are not repeated.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the method described above in the present specification. In some possible implementations, aspects of the present disclosure may also be implemented in the form of a program product comprising program code for causing an electronic device to carry out the steps according to the various exemplary embodiments of the disclosure as described in the "exemplary methods" section of this specification, when the program product is run on an electronic device. The program product may employ a portable compact disc read-only memory (CD-ROM) and comprise 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. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 of 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, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, 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., connected via the Internet using an Internet service provider).
The exemplary embodiment of the disclosure also provides an electronic device capable of implementing the 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 merely an example and should not be construed to limit the functionality and scope of use of embodiments of the present disclosure in any way.
As shown in fig. 26, electronic device 2600 may be embodied in 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 connecting the different system components (including the storage unit 2620 and the processing unit 2610), and a display unit 2640.
The storage unit 2620 stores program codes that can be executed by the processing unit 2610, so that the processing unit 2610 performs the steps according to various exemplary embodiments of the present disclosure described in the above "exemplary method" section of the present 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 Random Access Memory (RAM) 2621 and/or cache memory unit 2622, and may further include Read Only Memory (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 or some combination of which may include an implementation of a network environment.
Bus 2630 may be a local bus representing one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a memory using any of a variety of bus architectures.
Electronic device 2600 can also communicate with one or more external devices 2700 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 2600, and/or any device (e.g., router, modem, etc.) that enables the electronic device 2600 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 2650. Also, electronic device 2600 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet, through network adapter 2660. As shown, network adapter 2660 communicates with other modules of electronic device 2600 over bus 2630. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with the electronic device 2600, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, 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 (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the exemplary embodiments of the present disclosure.
Furthermore, the above-described figures are only schematic illustrations of processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with exemplary embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Those skilled in the art will appreciate that the various aspects of the present disclosure may be implemented as a system, method, or program product. Accordingly, various aspects of the disclosure may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may 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 adaptations, 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 is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (11)
1. A model paste processing method, characterized by comprising:
Acquiring a terrain height value of a datum point of a target area in a scene;
Weighting the terrain height value of each datum point according to the distance between the sampling point in the model to be pasted and each datum point to obtain the height value of the sampling point;
attaching the to-be-attached model to the target area according to the height value of the sampling point;
the weighting the terrain height value of each datum point according to the distance between the sampling point and each datum point in the model to be pasted to obtain the height value of the sampling point comprises the following steps:
determining the distance from the sampling point to any datum point to serve as a first distance;
determining a second distance according to the first distance and the scaling factor;
Determining a weight value of any datum point relative to the sampling point according to the reference distance and the second distance;
And weighting the terrain height value of each datum point by using the weight value of each datum point relative to the sampling point to obtain 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 grounded and each reference point is determined by:
Acquiring position coordinates of sampling points in the model to be pasted and the datum points in the same coordinate system;
And determining the distance between the position coordinates of the sampling points and the position coordinates of the datum points.
3. The method according to claim 2, wherein the method further comprises:
setting a bounding box of the model to be pasted;
determining a relative coordinate system by taking the size of the bounding box as a unit coordinate;
The obtaining the position coordinates of the sampling points and the reference points in the same coordinate system in the to-be-attached model includes:
Mapping the model to be pasted into the bounding box, and determining the position coordinates of the sampling points in the relative coordinate system;
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 according to claim 2, characterized by comprising:
the coordinate system is a plane coordinate system.
5. The method of claim 1, wherein the scaling factor is determined by:
the scaling factor is determined based on the number of fiducial points.
6. The method of claim 1, wherein determining the second distance based on the first distance and a scaling factor comprises:
The product of the first distance and the scaling factor is determined as the second distance.
7. The method according to claim 1, characterized in that it comprises:
Dividing the scene into a plurality of subareas, and taking each subarea as the target area.
8. The method according to claim 1, wherein the method further comprises:
Each of the reference points is disposed at equal intervals in the target area.
9. A model paste processing apparatus, characterized by comprising:
The datum point height value acquisition module is used for acquiring a terrain height value of a datum point of a target area in the scene;
The sampling point height value acquisition module is used for weighting the terrain height value of each datum point according to the distance between the sampling point in the model to be pasted and each datum point to obtain the height value of the sampling point;
the ground pasting module is used for pasting the to-be-pasted model to the target area according to the height value of the sampling point;
The sampling point height value obtaining module is configured to:
determining the distance from the sampling point to any datum point to serve as a first distance;
determining a second distance according to the first distance and the scaling factor;
Determining a weight value of any datum point relative to the sampling point according to the reference distance and the second distance;
And weighting the terrain height value of each datum point by using the weight value of each datum point relative to the sampling point to obtain the height value of the sampling point.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method of any one of claims 1 to 8.
11. 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 one of claims 1 to 8 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 CN112215968A (en) | 2021-01-12 |
CN112215968B true 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 (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10207351A (en) * | 1997-01-20 | 1998-08-07 | Nissan Motor Co Ltd | Navigation system and medium which stores navigation program using the system |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3460488B2 (en) * | 1997-01-20 | 2003-10-27 | 日産自動車株式会社 | Navigation system |
JP4704622B2 (en) * | 2001-07-30 | 2011-06-15 | 株式会社バンダイナムコゲームス | Image generation system, 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 |
CN108245893B (en) * | 2018-02-09 | 2021-06-29 | 腾讯科技(深圳)有限公司 | Method, device and medium for determining posture of virtual object in three-dimensional virtual environment |
CN111127576B (en) * | 2019-12-18 | 2023-11-17 | 北京像素软件科技股份有限公司 | Game picture rendering method and device and electronic equipment |
-
2020
- 2020-10-29 CN CN202011181734.6A patent/CN112215968B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10207351A (en) * | 1997-01-20 | 1998-08-07 | Nissan Motor Co Ltd | Navigation system and medium which stores navigation program using the system |
Also Published As
Publication number | Publication date |
---|---|
CN112215968A (en) | 2021-01-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109190573B (en) | Ground detection method applied to unmanned vehicle, electronic equipment and vehicle | |
CN111318022B (en) | Game scene generation method and device in game, electronic device and storage medium | |
CN111773709B (en) | Scene map generation method and device, computer storage medium and electronic equipment | |
CN113487717B (en) | Picture processing method and device, computer readable storage medium and electronic equipment | |
CN112734896B (en) | Environment shielding rendering method and device, storage medium and electronic equipment | |
CN110478898B (en) | Configuration method and device of virtual scene in game, storage medium and electronic equipment | |
CN110555352B (en) | Interest point identification method, device, server and storage medium | |
CN112215968B (en) | Model paste processing method and device, storage medium and electronic equipment | |
US20140325477A1 (en) | Method and system for visualization of large codebases | |
CN114972113A (en) | Image processing method and device, electronic equipment and readable storage medium | |
CN110555916B (en) | Terrain editing method and device for virtual scene, storage medium and electronic equipment | |
CN114049403A (en) | Multi-angle three-dimensional face reconstruction method and device and storage medium | |
JP6995912B2 (en) | Topographic map output device, topographic map output method and program | |
CN117454557A (en) | Fan point location arrangement method and device, electronic equipment and readable storage medium | |
CN114357757B (en) | Meteorological data assimilation method, device, equipment, readable storage medium and product | |
CN111870954B (en) | Altitude map generation method, device, equipment and storage medium | |
CN109241059A (en) | A kind of building method of point cloud data, device, electronic equipment and storage medium | |
CN116228956A (en) | Shadow rendering method, device, equipment and medium | |
CN111898819B (en) | Space grid dividing method and device | |
JP6893307B1 (en) | Topographic map output device, topographic map output method and program | |
CN111882633A (en) | Picture rendering method, device, equipment and medium | |
CN113271164A (en) | Method for performing radio wave communication on smooth and flat ground through computer simulation | |
CN113448472B (en) | Binding method of GIS data and three-dimensional model interaction behavior and related device | |
CN109934909B (en) | Method and device for reconstructing 3D model, electronic equipment and storage medium | |
CN111429542A (en) | Vector contour line speckle pattern generation method and device 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 |