CN-115518376-B - Virtual landform generating method, device, computer equipment and storage medium
Abstract
The embodiment of the application discloses a method, a device, computer equipment and a storage medium for generating a virtual landform, wherein the method, the device, the computer equipment and the storage medium acquire the topography shape of the initial virtual landform, determine the collision point of a preset ray and the initial virtual landform, the preset ray passes through a target point, the target point comprises a preset point of the topography shape, adjust the position of the collision point according to a preset direction, acquire a surface position point, the preset direction is related to the height of the initial virtual landform, and generate a target virtual landform according to the surface position point. In the embodiment of the application, the target virtual landform with high adaptation degree with the virtual scene where the initial virtual landform is located can be automatically generated by the initial virtual landform, and can be directly mapped in the virtual scene, so that the generation efficiency is high, and the display effect can be optimized.
Inventors
- SHEN ZHONGYONG
- SHI HAO
Assignees
- 网易(杭州)网络有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20221012
Claims (12)
- 1. The method for generating the virtual landform is characterized by comprising the following steps: acquiring a topographic shape of an initial virtual topography, wherein the topographic shape comprises a shape line or a facial model; determining a collision point of a preset ray and the initial virtual landform, wherein the preset ray passes through a target point, and the target point comprises a preset point of the landform shape; According to a preset direction, the position of the collision point is adjusted to obtain a ground surface position point, the preset direction is related to the height of the initial virtual landform, and the preset direction comprises a direction from top to bottom in the virtual scene or a direction from bottom to top in the virtual scene; generating a target virtual landform according to the earth surface position points, wherein the earth surface position points are used for forming the earth surface of the target virtual landform; wherein determining the collision point of the preset ray and the initial virtual landform comprises: Determining the collision position of the preset ray and the initial virtual landform; moving the target point to the collision position of the initial virtual landform to obtain a collision point; The step of adjusting the position of the collision point according to the preset direction to obtain a ground surface position point comprises the following steps: the position of the collision point is adjusted from bottom to top or from top to bottom along a preset direction, and a candidate position point is obtained; And repeatedly executing the step of taking the candidate position point as the target point, carrying out collision detection on the initial virtual landform according to a preset ray and the target point, determining the collision point, and adjusting the position of the collision point according to a preset direction until the candidate position point does not exist, wherein the earth surface position point is the position point determined by the candidate position point.
- 2. The method for generating a virtual landform according to claim 1, wherein the acquiring the topography of the initial virtual landform comprises: converting the initial virtual landform into a shape line; Generating a surface patch model conforming to the shape of the shape line according to the shape line to obtain a terrain shape, wherein the surface patch model comprises at least one surface patch component.
- 3. The method for generating a virtual landform according to claim 2, wherein the acquiring the topography of the initial virtual landform and determining a collision point between a preset ray and the initial virtual landform further comprises: determining a first vertex and a second vertex from the vertices of the dough piece assembly, wherein the heights of the first vertex and the second vertex along the preset direction are different; and determining the direction of a preset ray according to the first vertex and the second vertex.
- 4. The method for generating a virtual relief as claimed in claim 3, wherein said determining a first vertex and a second vertex from among the vertices of the patch assembly according to the height of the vertices of the patch assembly along the preset direction comprises: respectively obtaining the height values of all the first side vertexes and the height values of all the second side vertexes in the dough sheet component to obtain a first height sum and a second height sum, wherein the first side vertexes and the second side vertexes are respectively positioned on two sides of the dough sheet component; And determining a vertex corresponding to a relatively larger one of the first height sum and the second height sum as a first vertex, and determining a vertex corresponding to a relatively smaller one of the first height sum and the second height sum as a second vertex.
- 5. The method for generating a virtual landform according to claim 3, wherein determining a direction of a preset ray according to the first vertex and the second vertex comprises: And determining the direction of any preset ray according to any associated first vertex and any associated second vertex.
- 6. The method for generating a virtual landform according to claim 3, wherein generating a target virtual landform from the surface location point comprises: when the preset point comprises the second vertex, adjusting the height of the first vertex according to the height of the ground surface position point to obtain a target position point; generating a target virtual landform according to the surface location point and the target location point; Wherein adjusting the height of the first vertex according to the height of the ground surface position point comprises: And moving the first vertex upwards to the same height as the corresponding surface position point.
- 7. The method for generating a virtual landform according to claim 1, wherein the acquiring the topography of the initial virtual landform comprises: and converting the initial virtual landform into a shape line to obtain a landform shape.
- 8. The method for generating a virtual landform according to claim 1, wherein after the position of the collision point is adjusted according to the preset direction to obtain the surface location point, the method further comprises: if the distance between the target point and the ground surface position point is larger than a preset value, determining a target direction according to the target point and the ground surface position point; and moving the target point by a preset distance along the target direction so as to update the position of the surface position point.
- 9. The method for generating a virtual landform according to claim 1, further comprising, after generating a target virtual landform from the surface location point: acquiring a first scene landform and a second scene landform, wherein the first scene landform and the second scene landform are respectively mapped into a virtual scene by the target virtual landform and the initial virtual landform; and subtracting the height field of the first scene landform from the height field of the second scene landform to obtain the target scene landform.
- 10. A virtual landform generating device, comprising: the shape generating unit is used for acquiring a topographic shape of the initial virtual topography, wherein the topographic shape comprises a shape line or a surface patch model; a determining unit, configured to determine a collision point between a preset ray and the initial virtual landform, where the preset ray passes through a target point, and the target point includes a preset point of the landform; the adjusting unit is used for adjusting the position of the collision point according to a preset direction to obtain a ground surface position point, wherein the preset direction is highly related to the initial virtual landform, and the preset direction comprises a direction from top to bottom in the virtual scene or a direction from bottom to top in the virtual scene; The landform generating unit is used for generating a target virtual landform according to the surface location points, wherein the surface location points are used for forming the surface of the target virtual landform; The method comprises the steps of determining a collision point of a preset ray and an initial virtual landform, wherein the step of determining the collision point of the preset ray and the initial virtual landform comprises the steps of determining the collision position of the preset ray and the initial virtual landform; the method comprises the steps of obtaining a ground surface position point by adjusting the position of the collision point according to a preset direction, wherein the step of obtaining the ground surface position point comprises the steps of adjusting the position of the collision point from bottom to top or from top to bottom along the preset direction to obtain a candidate position point, taking the candidate position point as the target point, repeatedly executing the steps of detecting the initial virtual landform according to preset rays and the target point to determine the collision point, and adjusting the position of the collision point according to the preset direction until the collision point does not exist, wherein the ground surface position point is the position point determined by the candidate position point.
- 11. A computer device comprising a processor and a memory, the memory storing a plurality of instructions, the processor loading instructions from the memory to perform the steps in the method of generating a virtual landform as claimed in any one of claims 1 to 9.
- 12. A computer readable storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor to perform the steps in the method for generating a virtual landform according to any one of claims 1 to 9.
Description
Virtual landform generating method, device, computer equipment and storage medium Technical Field The present application relates to the field of computer technologies, and in particular, to a method and apparatus for generating a virtual landform, a computer device, and a storage medium. Background In recent years, with the development of computer technology, more and more users experience various games through electronic devices. In game design, the design of a game scene is a key ring, and the game scene with complex and diversified landforms can bring immersive game experience to users. In the prior art, a geomorphic model in a game scene is usually constructed manually, and then the constructed geomorphic model is spliced in the game scene. However, this method requires manual landform splicing, which is time-consuming and laborious, and is prone to uneven problems, not only low in efficiency, but also poor in display effect. Disclosure of Invention The embodiment of the application provides a method, a device, computer equipment and a storage medium for generating virtual landforms, which have high generation efficiency and can optimize display effect. The embodiment of the application provides a method for generating a virtual landform, which comprises the steps of obtaining a terrain shape of an initial virtual landform, determining a collision point of a preset ray and the initial virtual landform, enabling the preset ray to pass through a target point, wherein the target point comprises a preset point of the terrain shape, adjusting the position of the collision point according to a preset direction to obtain a ground surface position point, enabling the preset direction to be related to the height of the initial virtual landform, and generating a target virtual landform according to the ground surface position point. The embodiment of the application also provides a virtual landform generating method and device, which comprise a shape generating unit, a determining unit and a landform generating unit, wherein the shape generating unit is used for acquiring the topography shape of the initial virtual landform, the determining unit is used for determining the collision point of a preset ray and the initial virtual landform, the preset ray passes through a target point, the target point comprises a preset point of the topography shape, the adjusting unit is used for adjusting the position of the collision point according to a preset direction to obtain a surface position point, the preset direction is related to the height of the initial virtual landform, and the landform generating unit is used for generating a target virtual landform according to the surface position point. The embodiment of the application also provides computer equipment, which comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions from the memory to execute the steps in any virtual landform generating method provided by the embodiment of the application. The embodiment of the application also provides a computer readable storage medium, which stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor to execute the steps in any virtual landform generating method provided by the embodiment of the application. The method and the device for obtaining the initial virtual landform can obtain the landform of the initial virtual landform, determine the collision point of the preset ray and the initial virtual landform, enable the preset ray to pass through a target point, enable the target point to comprise the preset point of the landform, adjust the position of the collision point according to the preset direction, obtain the ground surface position point, enable the preset direction to be related to the height of the initial virtual landform, and generate the target virtual landform according to the ground surface position point. According to the method, the collision point on the initial virtual landform can be determined based on the preset rays passing through the preset points of the topographic shape of the initial virtual landform, and the earth surface position point of the target virtual landform can be obtained by adjusting the collision point. Accordingly, corresponding surface location points can be determined based on the topographic shape of the initial virtual landform, the generated target virtual landform is related to the topographic shape of the initial virtual landform, and the surface height of the virtual landform can be differentially adjusted by adjusting the collision points. Therefore, the target virtual landform with high adaptation degree with the virtual scene where the initial virtual landform is located can be automatically generated by the initial virtual landform, and can be directly mapped in the virtual scene, so that the generation efficiency is high, and the display effect c