Method, device, electronic device and medium for generating scene terrain

By arranging standard models on the target area and performing texture mapping, combined with mask processing, the problem of heavy load when rendering scene terrain is solved, achieving fast rendering and efficient scene loading.

CN114949846BActive Publication Date: 2024-09-20SHANGHAI NETEASE CUICAN NETWORK TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210541676.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-17
Publication Date
2024-09-20
Estimated Expiration
2042-05-17

AI Technical Summary

Technical Problem

When rendering scene terrain in the existing technology, multiple three-dimensional models of different shapes need to be loaded, resulting in a heavy rendering load and a long loading time.

Method used

By arranging the standard model on the target area, and performing texture mapping based on the surface UV coordinate values ​​of the standard model, combined with mask processing, the scene terrain is generated and the model resources that need to be rendered are reduced.

Benefits of technology

The rendering load is reduced, the rendering speed and scene switching speed are increased, and the user experience is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114949846B
    Figure CN114949846B
Patent Text Reader

Abstract

The present disclosure provides a method, device, electronic device and medium for generating scene terrain, which belongs to the field of image processing technology. The method includes: arranging standard models on a target area to construct a scene model, the target area is the display area of ​​the scene terrain on the game screen, and the standard model includes a surface UV coordinate value; based on the surface UV coordinate value of the standard model, calling a target texture map to perform texture mapping on the standard model for constructing the scene model, so that the standard model includes texture information; mapping the target mask to the scene model, so that the scene model matches the target mask; based on the scene model after mask processing, rendering and generating the scene terrain. Based on this solution, the problem of long loading time caused by large rendering load when rendering the scene terrain can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure belongs to the field of image processing technology, and specifically relates to a method, device, electronic equipment and medium for generating scene terrain. Background Art

[0002] With the development of image processing technology, scene models can be built through artificial customized modeling, so that the construction of scene models can be more and more in line with user needs.

[0003] Usually, large-scale scenes can be constructed based on 3D modeling software or game engines by stacking 3D models and manually placing and constructing models by developers. If 100 terrain models with different materials are needed, developers need to use 3D models to build 100 terrain models of different shapes, manually draw different textures for each terrain model, and finally manually place them into the scene terrain.

[0004] However, in the above scene terrain construction method, each model corresponds to a loading resource. When rendering, it is necessary to call 100 loading resources corresponding to the 100 models of different shapes, which generates a huge rendering load and causes the loading time to be too long when rendering the large world scene terrain. Summary of the invention

[0005] The purpose of the embodiments of the present disclosure is to provide a method, device, electronic device and medium for generating a scene terrain, which can solve the problem of long loading time caused by a large rendering load when rendering the scene terrain.

[0006] In order to solve the above technical problems, the present disclosure is implemented as follows:

[0007] In a first aspect, an embodiment of the present disclosure provides a method for generating a scene terrain, the method comprising: arranging standard models on a target area to construct a scene model, wherein the target area is the display area of ​​the scene terrain on the game screen, and the standard model includes UV coordinate values ​​of the surface; based on the surface UV coordinate values ​​of the standard model, calling a target texture map to perform texture mapping on the standard model for constructing the scene model, so that the standard model includes texture information; mapping a target mask to the scene model, so that the scene model matches the target mask; and rendering and generating the scene terrain based on the masked scene model.

[0008] Optionally, the standard model is a standard broken model, and the standard broken model also includes a surface UV coordinate value of each fragment; based on the surface UV coordinate value of the standard model, calling the target texture map to perform texture mapping on the standard broken model for constructing the scene model so that the standard model includes texture information, including: based on the surface UV coordinate value of each fragment in the standard broken model, calling the target texture map to perform texture mapping on the standard broken model for constructing the scene model so that the fragments of the standard model include texture information.

[0009] Optionally, after mapping the target mask onto the scene model so that the scene model matches the target mask, the method further includes: acquiring model data of a standard fragmentation model; performing vertex offset on the scene model based on the model data of the standard fragmentation model and each fragment arranged in the scene model; rendering and generating the scene terrain based on the scene model after mask processing includes: rendering and generating the scene terrain based on the scene model after vertex offset.

[0010] Optionally, before mapping the target mask to the scene model so that the scene model matches the target mask, the method further includes: sampling color values ​​of a texture map of the target mask; performing vertex offset on the target mask based on the sampled color values ​​of the texture of the target mask; mapping the target mask to the scene model includes: mapping the vertex-offset target mask to the scene model.

[0011] Optionally, before arranging the standard models on the target area to construct the scene model, the method also includes: constructing a first model; fragmenting the first model; mapping UV coordinate values ​​for the outer surface of the first model after fragmentation, and mapping UV coordinate values ​​for the cross-section of the fragments of the first model after fragmentation to obtain a second model; storing model data of the second model; wherein the second model is the standard fragmentation model, and the outer contour of the second model is the same as the outer contour of the first model.

[0012] Optionally, after obtaining the second model, the method further includes: cutting the second model according to the first cutting information, and mapping UV coordinate values ​​for the cutting surface of the second model after cutting to obtain a third model; storing the model data of the second model, including: storing the model data of the third model, wherein the third model is the standard broken model.

[0013] Optionally, the target texture map includes at least a first texture map and a second texture map; calling the target texture map to perform texture mapping on a standard fragmentation model for constructing the scene model so that the scene model matches the target mask, including: calling the first texture map to perform texture mapping on fragments of the standard fragmentation model arranged at a first position in the scene model, calling the second texture map to perform texture mapping on fragments of the standard fragmentation model arranged at a second position in the scene model, so that the standard fragmentation model in the scene model is superimposed with texture information of the first texture map and the second texture map; wherein the second position includes part or all of the standard fragmentation model arranged at the first position of the scene model.

[0014] Optionally, arranging the standard models on the target area to construct the scene model includes: determining the arrangement position of each standard model in the X direction and the Y direction of the target area to construct the scene model based on a first preset formula and according to the size of the standard model; the first preset formula is: Wherein, LocPos(r, c) represents the arrangement position of the standard model in the target area, r represents the row number where the standard model is located, c represents the column number where the standard model is located, DisX represents the length of the standard model in the X direction, and DisY represents the length of the standard model in the Y direction; OriginX represents the starting position of the standard model in the X direction, and OriginY represents the starting position of the standard model in the Y direction.

[0015] Optionally, the calling of a target texture map to perform texture mapping on the standard model for constructing the scene model based on the surface UV coordinate value of the standard model includes: determining a target UV coordinate value for texture mapping of the target object based on the surface UV coordinate value of the target object, the arrangement position of the target object and a second preset formula; the target object is a standard broken model or a fragment of the standard broken model; calling the target texture map to perform texture mapping on the target object based on texture information corresponding to the target UV coordinate value in the target texture map; the second preset formula is: Among them, UV Remap represents the target UV coordinate value of the target object for texture mapping, Texcoord1 represents the UV coordinate value of the target object, X Scale Indicates the repetition of the source texture of the texture map in the X direction, Y Scale Indicates the repetition of the source texture of the texture map in the Y direction, Offset1 indicates the overall offset of the texture, X length Indicates the length of the target area in the X direction, Y lengthIndicates the length of the target area in the Y direction, LocPos.x indicates the world position coordinates of the target object in the horizontal direction, LocPos.y indicates the world position coordinates of the target object in the vertical direction, OriginX indicates the starting position of the standard model in the X direction, and OriginY indicates the starting position of the standard model in the Y direction.

[0016] Optionally, based on a third preset formula and the texture map of the target mask, the color value of the texture map of the target mask is sampled; the third preset formula is: Mask = Sample(MaskTex, Texcoord2*Tilling+Offset2); wherein, MaskTex represents the texture map of the target mask, Texcoord2 represents the sampled texture coordinates, Tilling represents the scaling factor of the texture, Offset2 represents the offset size of the texture, and Mask represents the color value obtained by sampling the texture coordinate Texcoord2 of the texture map of the target mask based on the Sample function.

[0017] In a second aspect, an embodiment of the present disclosure provides a device for generating a scene terrain, the device comprising: an arrangement module, a texture mapping module, a mask mapping module and a rendering module; the arrangement module is used to arrange the standard model on a target area to construct a scene model, the target area being the display area of ​​the scene terrain on the game screen, and the standard model comprising a surface UV coordinate value; the texture mapping module is used to call a target texture map to perform texture mapping on the standard model for constructing the scene model based on the surface UV coordinate value of the standard model, so that the standard model comprises texture information; the mask mapping module is used to map a target mask onto the scene model, so that the scene model matches the target mask; the rendering module is used to render and generate the scene terrain based on the scene model after mask processing.

[0018] Optionally, the standard model is a standard broken model, and the standard broken model also includes the surface UV coordinate value of each fragment; the texture mapping module is specifically used to: based on the surface UV coordinate value of the standard broken model, call the target texture map to perform texture mapping on the standard broken model of the scene model, so that the standard broken model includes texture information.

[0019] Optionally, the device for generating scene terrain also includes: an acquisition module and a vertex animation mapping module; the acquisition module is used to acquire model data of a standard fragmentation model after the mask mapping module maps a target mask onto the scene model so that the scene model matches the target mask; the vertex animation mapping module is used to perform vertex offset on the scene model based on the model data of the standard fragmentation model and each fragment arranged in the scene model; the rendering module is specifically used to render and generate the scene terrain based on the scene model after vertex offset.

[0020] Optionally, the scene terrain generation device also includes: a sampling module; the sampling module is used to sample the color value of the texture map of the target mask before the mask mapping module maps the target mask to the scene model; the vertex animation mapping module is used to perform vertex offset on the target mask based on the color value of the texture of the target mask sampled by the sampling module to obtain the target mask after vertex offset; the mask mapping module is specifically used to: map the target mask after vertex offset to the scene model.

[0021] Optionally, the scene terrain generation device also includes: a construction module, a fragmentation processing module, a UV value mapping module and a storage module; the construction module is used to construct a first model before the arrangement module arranges the standard fragmentation model on the target area to construct the scene model; the fragmentation processing module is used to fragment the first model constructed by the construction module; the UV value mapping module is used to map UV coordinate values ​​for the outer surface of the first model after fragmentation processing by the fragmentation processing module, and to map UV coordinate values ​​for the cross-section of the fragments of the first model after fragmentation processing by the fragmentation processing module, so as to obtain a second model; the storage module is used to store model data of the second model; wherein the second model is a standard fragmentation model, and the outer contour of the second model is the same as the outer contour of the first model.

[0022] Optionally, the scene terrain generation device also includes: a cutting module; the cutting module is used to cut the second model according to the first cutting information after the UV value mapping module maps the UV coordinates to obtain the second model; the UV value mapping module is used to map the UV coordinate value of the cutting surface of the second model after cutting by the cutting module to obtain a third model; the storage module is specifically used to store model data of the third model, the third model being the standard fragmentation model.

[0023] Optionally, the target texture map includes at least a first texture map and a second texture map; the texture mapping module is specifically used to call the first texture map to perform texture mapping on the fragments of the standard broken model arranged at the first position in the scene model; call the second texture map to perform texture mapping on the fragments of the standard broken model arranged at the second position in the scene model, so that the standard broken model in the scene model is superimposed with the textures of the first texture map and the second texture map; wherein the second position includes part or all of the standard broken model arranged at the first position of the scene model.

[0024] Optionally, the arrangement module is specifically used to determine the arrangement position of each standard model in the X direction and the Y direction of the target area according to the size of the standard model based on a first preset formula to construct a scene model; the first preset formula is: Wherein, LocPos(r,c) represents the arrangement position of the standard model in the target area, r represents the row number of the standard model, c represents the column number of the standard model, DisX represents the length of the standard model in the X direction, and DisY represents the length of the standard model in the Y direction; OriginX represents the starting position of the standard model in the X direction, and OriginY represents the starting position of the standard model in the Y direction.

[0025] Optionally, the texture mapping module is specifically used to determine the target UV coordinate value of the target object for texture mapping based on the surface UV coordinate value of the target object, the arrangement position of the target object and a second preset formula; the target object is a standard broken model, or a fragment of the standard broken model; the target texture map is called, and the target object is texture mapped based on the texture corresponding to the target UV coordinate value in the target texture map; the second preset formula is: Among them, UV Remap Indicates the UV coordinate value of the target object for texture mapping, Texcoord1 indicates the UV coordinate value of the target object, X Scale Indicates the repetition of the source texture of the texture map in the X direction, Y Scale Indicates the repetition of the source texture of the texture map in the Y direction, Offset1 indicates the overall offset of the texture, X length Indicates the length of the coverage area in the X direction, Y length represents the length of the coverage range in the Y direction, LocPos.x represents the world position coordinates of the target object in the horizontal direction, and LocPos.y represents the world position coordinates of the target object in the vertical direction.

[0026] Optionally, the sampling module is specifically used to sample the color value of the texture map of the target mask based on a third preset formula and the texture map of the target mask; the third preset formula is: Mask=Sample(MaskTex,Texcoord2*Tilling+Offset2); wherein, MaskTex represents the texture map of the target mask, Texcoord2 represents the sampled texture coordinates, Tilling represents the scaling factor of the texture, Offset2 represents the offset size of the texture, and Mask represents the color value obtained by sampling the texture at the texture coordinate Texcoord2 of the texture map of the target mask based on the Sample function.

[0027] In a third aspect, an embodiment of the present disclosure provides an electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method for generating scene terrain as described in the first aspect.

[0028] In a fourth aspect, an embodiment of the present disclosure provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method for generating scene terrain as described in the first aspect are implemented.

[0029] In a fifth aspect, an embodiment of the present disclosure provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instructions to implement the steps of the method for generating scene terrain as described in the first aspect.

[0030] In a sixth aspect, an embodiment of the present disclosure provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps of the method for generating a scene terrain as described in the first aspect.

[0031] In the disclosed embodiment, the electronic device can call a standard model, quickly arrange the standard model on the target area to build a scene model; then, based on the surface UV coordinates of the standard model at each arrangement position, map the texture of the target texture map to the standard model at the corresponding position; finally, call the mask to crop the unnecessary parts of the scene model, so as to obtain a scene model whose appearance meets the requirements, and quickly build scene objects of different shapes and textures in the scene model. When the electronic device renders the scene model in the GUI, compared with the related technology, it is no longer necessary to call multiple three-dimensional models of scene objects of different shapes. Especially in the case of rendering a large world scene, only one standard model needs to be called to quickly build a scene model for rendering, so as to further reduce the model resources called by the electronic device, reduce the rendering load, and reduce the amount of rendering calculations, so as to increase the speed of rendering the scene model, increase the switching speed when switching scenes, and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of a flow chart of a method for generating a scene terrain provided in an embodiment of the present disclosure;

[0033] Figure 2 A schematic diagram of a target area provided in an embodiment of the present disclosure;

[0034] Figure 3 A schematic diagram of a scene terrain after texture mapping provided in an embodiment of the present disclosure;

[0035] Figure 4 A three-dimensional schematic diagram of mask cutting provided by an embodiment of the present disclosure;

[0036] Figure 5 A schematic diagram of a standard fragmentation model provided in an embodiment of the present disclosure;

[0037] Figure 6 A schematic diagram of ice surface terrain with mask mapping provided in an embodiment of the present disclosure;

[0038] Figure 7 A schematic diagram of a mask adjustment boundary provided in an embodiment of the present disclosure;

[0039] Figure 8 A possible structural schematic diagram of a scene terrain generation device provided in an embodiment of the present disclosure;

[0040] Fig. 9 A possible structural diagram of an electronic device provided by an embodiment of the present disclosure;

[0041] Fig.10 A hardware schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0042] First, the professional terms involved in the embodiments of the present disclosure are explained.

[0043] 1. UV

[0044] U and V define a two-dimensional texture coordinate system, where (U, V) represents a two-dimensional texture coordinate point residing on a vertex of a polygonal mesh.

[0045] Among them, U is the coordinate of the texture image in the horizontal direction of the display, which can represent the width of the U-th pixel / image in the horizontal direction; V is the coordinate of the texture image in the vertical direction of the display, which can represent the height of the V-th pixel / image in the vertical direction. U and V usually take values ​​from 0 to 1.

[0046] UV provides a connection between a model surface and a texture map, and is used to determine on which vertex of the model surface a point (pixel) on the texture map should be placed.

[0047] 2. Texture Mapping

[0048] Texture mapping, also known as texture mapping, is the process of mapping texture pixels in texture space to pixels in screen space.

[0049] 3. Mask

[0050] Through the shape or transparency of the mask, you can hide part of the main element's content.

[0051] 4. VAT (Vertex Animation Texture)

[0052] The animation can be saved as VAT information, and the VAT information can be read in the Vertex shader to change the vertex position, so that complex dynamic effects such as soft body, fragmentation, liquid, etc. can be achieved with lower rendering cost.

[0053] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0054] The terms "first", "second", etc. in the specification and claims of the present disclosure are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable when appropriate, so that the embodiments of the present disclosure can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0055] The following describes in detail the method for generating scene terrain provided by the embodiment of the present disclosure through specific embodiments and application scenarios in conjunction with the accompanying drawings.

[0056] Figure 1 A flow chart of a method for generating a scene terrain according to an embodiment of the present disclosure is shown as follows: Figure 1 As shown in , the method includes the following S101 to S104:

[0057] S101. The electronic device arranges standard models on a target area to construct a scene model.

[0058] The target area is the display area of ​​the scene model on the game screen, and the standard model includes the surface UV coordinate value.

[0059] Specifically, the electronic device can call the standard model when rendering the scene terrain, and then arrange the standard model to construct the scene model.

[0060] Optionally, the standard model may be a three-dimensional model of any shape, for example, a cuboid, a cube, a sphere, a triangular pyramid, or a three-dimensional model of other irregular shapes, which is not specifically limited in the embodiments of the present disclosure.

[0061] Exemplarily, assuming that the size of the target area is M*N and the size of the standard model is a 1*1*1 cube, the coverage of the scene model may include M*N standard models, where M and N are both positive integers, and the values ​​of M and N may be the same or different.

[0062] For example, Figure 2 A schematic diagram of a target area provided in an embodiment of the present disclosure, such as Figure 2 As shown in , the scene terrain may be a rectangular area with an area = (X9-X0)*(Y5-Y0). In which, one square represents a standard model, and the scene terrain may include 5*9 standard models.

[0063] S102: The electronic device calls the target texture map to perform texture mapping on the standard model for constructing the scene model based on the surface UV coordinate value of the standard model, so that the standard model includes texture information.

[0064] In the embodiment of the present disclosure, the target texture map may be one texture map, or may include multiple texture maps, which is not specifically limited in the embodiment of the present disclosure.

[0065] Optionally, in an embodiment of the present disclosure, when texture mapping is performed on a standard model for constructing a scene model, multiple texture maps can be called to perform texture mapping on the standard model at different positions in the scene model respectively, or multiple texture maps can be called to perform texture overlay mapping on the same position in the scene model, or one texture map can be called to perform texture mapping on the entire coverage area of ​​the scene model. The corresponding mapping method can be carried out according to specific needs, and the embodiment of the present disclosure does not specifically limit this.

[0066] For example, Figure 3 A schematic diagram of a scene terrain after texture mapping provided by an embodiment of the present disclosure. An electronic device maps a bird's-eye view texture map of a lake to Figure 2 On each standard model in the scene model of the size shown in , the texture on each standard model can be composed as follows Figure 3 The lake surface topography shown in (a).

[0067] S103: The electronic device maps the target mask onto the scene model to match the scene model with the target mask.

[0068] Optionally, the target mask may include one or more masks, which is not specifically limited in the embodiment of the present disclosure.

[0069] Exemplarily, assuming that the scene model includes multiple scene objects, the electronic device may map masks corresponding to the respective scene objects to the corresponding standard models respectively to obtain scene objects matching the respective masks.

[0070] Exemplarily, the target mask may be a mask image of terrain shape information of a specific scene.

[0071] For example, you can choose a mask map of the Mask texture map type that is suitable for the computing performance of low-power mobile devices.

[0072] For example, the target texture map is obtained based on a bird's-eye view of a lake, which includes the main body of the lake and the road, forest belt and other terrain along the lake. If it is necessary to construct the main body of the lake in the scene terrain, the target mask is the shape of the main body of the lake after texture mapping in the scene terrain, and objects other than the main body of the lake are cut out based on the target mask, so as to obtain the terrain of the main body of the lake in the scene model; if it is necessary to construct the main body of the lake and the road along the lake in the scene terrain, the shape of the target mask is the shape of the road along the lake after texture mapping in the scene terrain, and objects other than the main body of the lake and the road along the lake are cut out based on the target mask, so as to obtain the terrain of the main body of the lake and the road along the lake in the scene model.

[0073] For example, you can get a mask image of the lake boundary and map the mask image of the lake boundary to Figure 3 On the scene object shown in (a) in the figure, we can get Figure 3 (b) shows a scene object that only includes the lake surface.

[0074] Figure 4 A three-dimensional schematic diagram of mask cutting provided by an embodiment of the present disclosure, for example, can be called Figure 4 The mask corresponding to the triangular pyramid shape shown in is used to obtain the triangular pyramid scene object from the standard model.

[0075] It should be noted that the embodiment of the present disclosure can call a standard model to quickly build a large world scene model.

[0076] S104: The electronic device renders and generates a scene terrain based on the scene model after the mask processing.

[0077] It can be understood that after the electronic device constructs the scene model, a three-dimensional scene can be rendered on the screen through a GUI (Graphical User Interface) based on the constructed scene model.

[0078] In the case of a scene with a large terrain area, compared to the related art that requires loading the real geometric model of each object in the large scene area and the corresponding data for rendering, the disclosed embodiment only needs to call the resources of a standard model, and then repeat the tiled arrangement based on the standard model and the display area to be rendered. The various models in the scene can be quickly constructed through texture maps and mask maps. The number of model resources called is small, thereby reducing the rendering load, reducing the thread loading time and the image drawing time, thereby shortening the loading time of the scene model. At the shading level, the related art requires manual placement of geometric models over a large area, and the number of materials corresponding to the number of geometric models placed in the scene needs to be compiled during compilation. Therefore, the calculation is difficult, the loading speed is slow, and the performance is poor during GUI rendering. The scene terrain generation method provided by the embodiment of the present disclosure only needs to compile one material instance during compilation, which reduces the calculation difficulty during rendering and the response time of scene loading. By building a large-area scene through a single standard model and reducing the rendering batches, the system's I / O (throughput) can be improved, that is, the number of requests processed per unit time is increased, thereby improving the interactive performance of the scene.

[0079] For example, if you need to build a 10*10 rectangular scene terrain with non-repeated materials, according to relevant technologies, you need to call 100 models with different resource references to build it, and 100 models correspond to 100 materials, which will generate a huge rendering load. However, using standard models, you can copy and generate large areas of scene terrain and call the same material reference, that is, only use 1 model and 1 material reference, which increases the real-time throughput of the scene, so that a large number of models in the scene can be processed at the same time, reducing the loading time of the scene.

[0080] The method for generating scene terrain provided by the embodiment of the present disclosure is that the electronic device can call a standard model, quickly arrange the standard model on the target area to construct the scene model; then based on the surface UV coordinates of the standard model at each arrangement position, the texture of the target texture map is mapped to the standard model at the corresponding position; finally, the mask is called to crop the unnecessary parts of the scene model, so as to obtain a scene model whose appearance meets the requirements, and the scene objects of different shapes and textures in the scene model can be quickly constructed. When the electronic device renders the scene model in the GUI, compared with the related technology, it is no longer necessary to call the three-dimensional models of multiple scene objects of different shapes. Especially in the case of rendering a large world scene, only one standard model needs to be called to quickly construct the scene model for rendering, so that the model resources called by the electronic device can be further reduced, the rendering load can be reduced, and the amount of rendering calculations can be reduced, so that the speed of rendering the scene model can be improved, the switching speed when the scene is switched can be improved, and the user experience can be improved.

[0081] Optionally, in the method for generating scene terrain provided by the embodiment of the present disclosure, the standard model may be a standard fragmentation model, and the standard fragmentation model further includes a surface UV coordinate value of each fragment; further, the above S102 may be specifically performed by the following S21:

[0082] S21. The electronic device calls the target texture map to perform texture mapping on the standard fragmentation model for constructing the scene model based on the surface UV coordinate value of each fragment in the standard fragmentation model, so that the fragments of the standard model include texture information.

[0083] In the embodiment of the present disclosure, the appearance of the standard crushing model may be a seamlessly connected three-dimensional geometric model, and the interior of the standard crushing model includes a plurality of independent fragments, and the plurality of independent fragments constitute an aggregate.

[0084] Optionally, the shape of the standard crushing model can be a crushing model of any shape.

[0085] For example, Figure 5 is a schematic diagram of a standard fragmentation model, such as Figure 5 As shown in (a) of FIG. 1 , the fragmentation model is a cube, which includes randomly broken pieces. The surface of each piece is mapped with UV coordinate values. Figure 5 As shown in (b), the interior of the cube is composed of various fragments.

[0086] It can be understood that in the embodiment of the present disclosure, the standard fragmentation model is a pre-configured primitive model for constructing a scene model.

[0087] It should be noted that in the embodiments of the present disclosure, texture information can be mapped to the fragments that constitute the scene object, so that a scene object with thickness can be obtained, so that when the user subsequently interacts with the scene object, a change effect of the scene object that matches the interactive action can be rendered.

[0088] For example, in the disclosed embodiment, a corresponding texture may be mapped to the surface of the fragments constituting the surface of the object in the standard fragmentation model, and another texture may be mapped to the surface of the fragments constituting the interior of the object in the standard model. For example, the surface fragments of the lawn may be mapped with the texture of the turf, and the fragments inside the turf may be mapped with the texture of the soil. When the user clicks on the grass, an effect close to the actual digging of a pit may be rendered based on the fragments inside the turf.

[0089] Furthermore, the above S103 can be executed by the following S31:

[0090] S31. The electronic device maps the target mask to the fragments of each standard fragmentation model including texture information on the scene model, so that the scene model matches the target mask.

[0091] It should be noted that, in the embodiment of the present disclosure, if the texture of a three-dimensional scene object is mapped, a three-dimensional scene object including the texture can be obtained by performing texture mapping on each fragment.

[0092] Based on this scheme, on the one hand, since each standard shattered model is composed of independent fragments, and the surface of each fragment includes UV information, during texture mapping, the details with more texture information in the texture map can be mapped to the fragments of the standard shattered model at each position, so that the constructed model can include more detailed texture information; on the other hand, since the standard shattered model contains fragmented fragments, when calling the mask to crop the scene object to be constructed, the fragments in the standard shattered model can be used as the minimum cropping object, so that the boundary of the cropped scene object can retain finer textures, avoiding the abrupt texture of the boundary after cropping, making the constructed scene model more realistic and natural, and reducing the repetitive problem of UV texture performance caused by automatically adding texture mapping effects in related technologies.

[0093] Optionally, in the method for generating scene terrain provided in the embodiment of the present disclosure, after the above S104, the following S105 and S106 may be further included:

[0094] S105: The electronic device obtains model data of a standard crushing model.

[0095] Exemplarily, the model data of the standard crushing model includes at least one of the following information of each fragment: position information, pivot information (pivot point), orientation information (direction), Information (angular velocity).

[0096] It should be noted that the above-mentioned model data may also include other data that can be used to achieve the offset, rotation and other morphological transformation of the fragments, which are not listed one by one in the embodiments of the present disclosure.

[0097] S106: The electronic device performs vertex offset on the scene model based on the model data of the standard fragmentation model arranged in the scene model and each fragment.

[0098] Furthermore, the above S104 can be specifically performed by the following S41:

[0099] S41. The electronic device renders and generates a scene terrain based on the scene model after vertex offset.

[0100] It can be understood that the electronic device can perform vertex offset on any scene object in the scene model.

[0101] In the embodiment of the present disclosure, the vertex transformation of the model may be performed based on the UV coordinates of the fragments or based on the local coordinates of the fragments, and the embodiment of the present disclosure does not specifically limit this.

[0102] Among them, the local coordinates represent the physical position of the object itself in the three-dimensional space.

[0103] Exemplarily, the electronic device may perform vertex offset on the scene object based on the axis points of each fragment of the standard fragmentation model and the UV coordinate values ​​of each fragment to obtain the scene object after vertex offset.

[0104] For example, the electronic device can obtain the texture of a three-dimensional scene object, the pivot position of the vertices of the fragments at the boundary of the three-dimensional scene object, perform model vertex position calculations, obtain the direction vector of the vertex displacement, and then control the size of the model displacement, i.e., the scaling factor, through preset parameters to determine the position of the fragment vertices after movement.

[0105] For example, vertex offset processing can be performed on the target interaction model, where the target interaction model is any interaction model in the scene model. The vertex offset function in the VAT can be called to bake the Pivot position of the target interaction model onto the UV coordinate axis, extract the coordinate and rotation information in the vertex animation texture, and perform vertex transformation on the model.

[0106] Based on this scheme, after mapping the target mask to the scene model, the electronic device can call the vertex offset method to adjust the position and shape of the boundary fragments of each scene object in the scene model, so as to obtain scene objects with more details, making the scene rendered based on the scene model more natural and the texture clearer.

[0107] Optionally, in the method for generating scene terrain provided in the embodiment of the present disclosure, before the above S104, the following S107 and S108 may also be included:

[0108] S107: The electronic device samples the color value of the texture map of the target mask.

[0109] It should be noted that the mask may be a grayscale image, and a mask of a specific shape may be formed by grayscale values ​​at different positions.

[0110] For example, Figure 6 A schematic diagram of a mask-mapped ice surface terrain provided by an embodiment of the present disclosure, such as Figure 6 As shown in (a) of Figure 1, the grayscale values ​​at different positions form a mask image of the ice surface. By mapping this mask image onto the standard breakage model, we can obtain Figure 6 The ice surface topography shown in (c).

[0111] S108: The electronic device performs vertex offset on the target mask based on the color value of the sampled texture map of the target mask.

[0112] It can be understood that the shape of the mask boundary can be adjusted by performing vertex offset on the target mask, so that the mask boundary can be made more refined.

[0113] Furthermore, the above S103 can be specifically performed by the following S32:

[0114] S32: The electronic device maps the target mask after the vertex shifting onto the scene model, so that the scene model matches the target mask after the vertex shifting.

[0115] Among them, the standard model in this scheme is the standard crushing model.

[0116] Figure 7 A schematic diagram of a mask adjustment boundary provided by an embodiment of the present disclosure. Figure 7 (a) shows a schematic diagram of the ice surface terrain model based on the fragmentation model and the mask of the ice surface boundary. Figure 7 (b) shows a schematic diagram of the ice surface terrain that can be obtained by adjusting the shape of the mask based on the ice surface mask through vertex offset. After adjusting the boundary details, the boundary of the ice mapped by the mask is more randomized and close to the boundary of the real ice surface. Figure 7 (c) in the figure shows a schematic diagram of the texture of the fracture surface of ice obtained after the standard crushing model is processed by mask.

[0117] Furthermore, based on the texture mask value of the mask image and the size deformation scaling coefficient of the scene object (the model of the object composed of fragments), the original pre-fragmented scene model can be adjusted into a scene terrain shape of a specific shape through vertex offset.

[0118] Specifically, in the embodiment of the present disclosure, the electronic device can also perform vertex offset based on the UV information of the surface of each fragment in the fragmented scene model, and can render the dynamic effect corresponding to the interactive operation.

[0119] For example, the vertices of the fragments that make up the grass can be offset. After the user performs interactive input to dig a hole on the ground, a hole can be rendered in the grass with mud piled up on both sides of the hole. This allows flexible and real-time UI interaction to be achieved with a smaller amount of resources in the big world scene.

[0120] Based on this scheme, after obtaining the target mask, the color value of the texture map of the target mask can be sampled first, and then the vertex offset of the target mask can be performed based on the color value of the texture map of the sampled target mask. For example, the shape of the boundary of the target mask can be finely adjusted to make the shape of the target mask more in line with the requirements of the realistic effect, and then mask mapping can be performed based on the vertex-offset target mask, so that the constructed scene model can be made more realistic.

[0121] Optionally, in the method for generating scene terrain provided in the embodiment of the present disclosure, before the above S101, the following S11 to S14 may be performed:

[0122] S11. The electronic device constructs a first model.

[0123] Exemplarily, the first model of any shape such as a cuboid, a cube, a cylinder, a sphere, etc. can be constructed as needed.

[0124] S12, a first model of electronic equipment fragmentation processing.

[0125] The shape of the fragmented first model is the same as that of the original first model. The appearance of the fragmented first model is a seamlessly connected aggregate model. Each fragment in the fragmented first model is an independent fragment.

[0126] For example, the electronic device can construct a first model based on 3D modeling software, and call a fragmentation program to cut the first model into fragments of different shapes and sizes to obtain a fragmented first model. Taking a cuboid as an example, a fragmented model can be constructed with the world center as the origin and the axis point at the center of the cuboid.

[0127] S13, the electronic device maps UV coordinate values ​​for the outer surface of the first model after the fragmentation process, and maps UV coordinate values ​​for the cross-section of the fragments of the first model after the fragmentation process, so as to obtain a second model.

[0128] The second model is the above-mentioned standard crushing model, and the outer contour of the second model is the same as the outer contour of the first model.

[0129] Optionally, the electronic device may map UV coordinate values ​​for the outer surface of the first model after S11 and then perform fragmentation processing, or it may map UV coordinate values ​​for the outer surface of the fragmented first model after fragmentation processing of the first model. The present disclosed embodiment does not specifically limit this.

[0130] For example, taking the fragmented model of a rectangular parallelepiped as an example, the top view projection UV coordinate value can be called to map the UV coordinate values ​​to the six outer surfaces of the fragmented rectangular parallelepiped, and to map the UV coordinate values ​​to the cut surfaces of each fragment in the fragmented rectangular parallelepiped.

[0131] It should be noted that the above-mentioned call to project the UV coordinate value of the top view is only an example. In actual applications, the coordinate axes corresponding to the modeling of different three-dimensional modeling software called by electronic devices may be inconsistent. Therefore, based on the configuration of each modeling software, an adaptive UV projection method can be called. The embodiments of the present disclosure do not make specific limitations on this.

[0132] Exemplarily, after acquiring the second model, the second model may be exported as a static mesh model and may be stored in a *.FBX format.

[0133] S14. The electronic device stores the model data of the second model.

[0134] Among them, the electronic device can store the model data in conjunction with the model.

[0135] For example, the model data related to the standard broken model can usually be exported and stored in the form of a map. Among them, the HDR (High-Dynamic Range) map can be stored in the *.EXR format, and the Non-HDR (non-high dynamic range image) map can be stored in the *.PNG format.

[0136] Exemplarily, the model data may include dynamic information for offset of each fragment of the model, and the dynamic information may include at least one of position information, rotation information, normal information, and pivot point information.

[0137] Exemplarily, vertex animation mapping technology may be used to encode the dynamic information of the second model into the corresponding static mesh model and map for storage.

[0138] Optionally, the output frame number of the vertex animation texture can be selected as a single frame or multiple frames. When the output vertex animation texture is a single frame, the resource resolution size of the output texture can be reduced, and when it is multiple frames, it can be stored as multiple standard fragmentation models. The encoding frame number of the vertex animation texture can be selected as a single frame or multiple frames. When the acquired vertex animation texture is a single frame, the time and encoding cost of acquiring texture resource data can be reduced.

[0139] The UV information, vertex color information, etc. of the data sampled by each of the above textures may be stored in multiple sets of UV coordinates.

[0140] Optionally, the map of the model data may include at least one of the following information maps: a position information map, a rotation information map, a normal information map, and a pivot point information map. It can be understood that in the embodiment of the present disclosure, the standard fragmentation model is a collection of a single basic unit model (i.e., fragments) that is customized or preconfigured for constructing a scene.

[0141] For example, a standard shattering model may be constructed based on tools such as Houdini, and a vertex animation program in Houdini VAT or Pivot Painter tools may be used to store the standard shattering model and model data.

[0142] Based on this solution, the electronic device can pre-construct a standard fragmentation model for constructing a scene model. It can first construct a three-dimensional primitive model according to the required shape, and then fragment the three-dimensional primitive model, and map UV information for the surface of each fragment in the primitive model to obtain a customized single standard fragmentation model, so that refined texture mapping can be performed based on the UV information on the surface of each fragment, so that the texture mapped to the model can retain more details. The electronic device also stores the model data on the primitive model to store information for dynamic transformation of each fragment. When the standard fragmentation model is called to construct a scene model, the fragments can be processed by vertex offset, rotation, stretching, etc. based on the model data, so that the constructed model is closer to the real color and shape.

[0143] Optionally, in the method for generating scene terrain provided in the embodiment of the present disclosure, after the above S13, the following S15 may be further included:

[0144] S15. The electronic device cuts the second model according to the first cutting information, and maps UV coordinate values ​​for the cutting surface of the second model after cutting to obtain a third model.

[0145] Among them, the fourth model is the standard crushing model mentioned above.

[0146] It should be noted that the first cutting information is the cutting information selected by the developer, and different cutting information can be input according to requirements to adjust the geometric shape of the standard crushing model.

[0147] Optionally, the rectangular parallelepiped crushing model may be cut into a triangular pyramid crushing model, a cube crushing model, or other irregular crushing models, which is not specifically limited in the embodiments of the present disclosure.

[0148] Furthermore, the above S14 can be executed by the following S16:

[0149] S16. The electronic device stores model data of the third model.

[0150] It can be understood that the model data of the third model includes dynamic information of each fragment constituting the third model.

[0151] Based on this solution, after constructing the broken model, the broken model can be cut as needed, and the UV value of the newly obtained cut surface can be mapped, so as to obtain a standard broken model whose shape meets the custom requirements. The custom standard broken model can be used to construct the scene model later.

[0152] Optionally, in the method for generating scene terrain provided in the embodiment of the present disclosure, the above S102 may be specifically performed by the following S22:

[0153] S22. The electronic device calls the first texture map to perform texture mapping on the fragments of the standard broken model arranged at the first position of the scene model, and calls the second texture map to perform texture mapping on the fragments of the standard broken model arranged at the second position of the scene model, so that the standard broken model in the scene model superimposes the textures of the first texture and the second texture.

[0154] The second position includes a standard fragmentation model of a partial or complete arrangement of the first position of the scene model.

[0155] For example, you can call the ice texture map to render the standard broken model at position 1 first, and then call the snow texture to render the standard broken model at position 2. Position 1 and position 2 include overlapping areas, so that the effect of ice covered with snow can be rendered for the texture based on the superposition.

[0156] Based on this solution, different materials can be rendered at the same location flexibly according to needs, thereby obtaining a texture with different materials superimposed, so that the model based on the superimposed texture can render a scene with more details, thereby improving the rendering effect and enhancing the user's visual experience.

[0157] Optionally, in the method for generating a scene terrain provided by an embodiment of the present disclosure, the target texture map includes at least a third texture map and a fourth texture map, and the above S102 can be specifically performed by the following S23:

[0158] S23. The electronic device calls the third texture map to perform texture mapping on the fragments of the standard broken model arranged at the third position in the scene model, so that the standard model arranged at the third position includes the texture of the first texture map; and calls the fourth texture map to perform texture mapping on the fragments of the standard model arranged at the fourth position in the scene model, so that the standard model arranged at the fourth position includes the texture of the fourth texture map.

[0159] Exemplarily, the standard fragmentation model of the texture mapping the third texture map includes the fragmentation model of the first scene object; the standard fragmentation model of the texture mapping the fourth texture map includes the fragmentation model of the second scene object, and the first scene object and the second scene object are different scene objects in the scene model.

[0160] Based on this solution, electronic devices can call different texture maps, perform texture mapping on standard fragmentation models at different display positions in the scene model respectively, and then perform mask mapping in combination with the masks corresponding to each scene object. The fragment models of the textures of different scene objects can be quickly obtained, which reduces the complexity of constructing scene objects with textures of different shapes, simplifies the construction steps of the scene model, and no longer needs to separately construct models for scene objects of different shapes and arrange them. When rendering, only one standard fragmentation model needs to be called to quickly construct the scene model, reducing the rendering load of the scene model.

[0161] Optionally, in the method for generating scene terrain provided in the embodiment of the present disclosure, the above S101 may be specifically performed by the following S111:

[0162] S111. The electronic device determines the arrangement position of each standard model in the X direction and the Y direction of the target area based on formula (1) and the size of the standard model to construct a scene model.

[0163]

[0164] Among them, LocPos(r,c) represents the arrangement position of the standard model in the target area, r represents the row number of the standard model, c represents the column number of the standard model, DisX represents the length of the standard model in the X direction, and DisY represents the length occupied by each standard model in the Y direction. OriginX represents the starting position of the standard model in the X direction, and OriginY represents the starting position of the standard model in the Y direction.

[0165] It can be understood that the number of standard models arranged in the X and Y directions can be determined based on the size of the standard model and the target area, and then the specific arrangement position of each standard model can be determined based on the above formula, so as to matrix the single model.

[0166] It should be noted that the above formula (1) is also applicable to the arrangement of the standard crushing model.

[0167] Based on this solution, a method for automatically arranging standard models to form a scene model can be provided, so that in the construction of a large-scale scene, various standard models can be quickly arranged to facilitate the subsequent construction of scene objects based on the standard models at various positions. There is no need to confirm the position information and map the display position according to the positions of different objects, which can shorten the time for building the scene model.

[0168] Optionally, in the method for generating scene terrain provided in the embodiment of the present disclosure, the above S102 may be specifically performed by the following S24 and S25:

[0169] S24: The electronic device determines a target UV coordinate value for texture mapping of the target object based on the surface UV coordinate value of the target object, the arrangement position of the target object and formula (2).

[0170] The target object is a standard crushing model or a fragment of a standard crushing model.

[0171] S25. The electronic device calls the target texture map, and performs texture mapping on the target object based on the texture corresponding to the target UV coordinate value in the target texture map.

[0172]

[0173] Among them, UV Remap Indicates the target UV coordinate value for texture mapping of the target object. Texcoord indicates the UV coordinate value of the target object. X Scale Indicates the repetition of the source texture of the texture map in the X direction, Y Scale Indicates the repetition of the source texture of the texture map in the Y direction, Offset indicates the overall offset of the texture, X length Indicates the length of the target area in the X direction, Y length represents the length of the target area in the Y direction, LocPos.x represents the world position coordinates of the target object in the horizontal direction, and LocPos.y represents the world position coordinates of the target object in the vertical direction.

[0174] For example, in a DirectX (Direct eXtension, a multimedia programming interface) environment, the UV coordinate remapping of a large-area scene model can be automatically programmed based on the above formula (2), so that each target object is UV offset according to its respective position and size (length and width).

[0175] Optionally, X Scale and Y Scale The settings can be customized according to business needs.

[0176] For example, the target object is the surface of the fragments of the standard crushing model. It can represent the coordinate position based on the texture, and map the texture to the UV coordinate space according to the side lengths of each standard broken model in the X and Y directions, that is, the fragments of each standard broken model will be UV offset according to their respective positions and lengths and widths. Offset1 can be a random texture offset parameter.

[0177] That is to say, the world position coordinates and absolute world position coordinates of the fragments of each standard fragmentation model in the scene (such as in a large scene terrain) are calculated and sampled, and new UV coordinates that are seamlessly connected and non-repetitive are remapped.

[0178] For example, texture mapping can be performed by calling a material editing program and an image coordinate modification program together.

[0179] Based on this solution, the texture can be mapped to the UV coordinate space at the coordinate position of the texture according to the side lengths of each standard broken model in the X and Y directions. That is, the fragments of each standard broken model will be subjected to corresponding UV offsets according to their respective positions and lengths and widths, so that the colors of each different standard broken model fragments can be accurately spliced ​​to obtain a material performance effect that meets the requirements.

[0180] Optionally, in the method for generating scene terrain provided by the embodiment of the present disclosure, the above S107 may be specifically performed by the following S71:

[0181] S71. The electronic device samples the texture color value of the target mask based on formula (3) and the texture map of the target mask.

[0182] Mask=Sample(MaskTex,Texcord2*Tilling+Offset2) Formula (3)

[0183] Among them, MaskTex represents the texture map of the target mask, Texcoord2 represents the texture coordinates of the sampled texture, Tilling represents the scaling factor of the texture, Offset2 represents the offset size of the texture, and Mask represents the color value obtained by sampling the texture at the texture coordinate Texcoord2 of the texture map of the target mask using the Sample function.

[0184] The Sample function can be used to sample texture color values. A graphics application can provide an interface to obtain the Sample function, and the electronic device can call the Sample function to obtain the texture color value corresponding to the texture coordinate position using the above formula (3).

[0185] Exemplarily, the following formula (4) may also be used to offset the vertices of the mask.

[0186]

[0187] Among them, WPO (World Position Offset) represents the vertex offset function, S represents the scaling vector, R represents the rotation vector, O represents the offset vector, and P represents the vector of the local coordinates of the vertex; R can be customized to determine the specific matrix according to the needs. If the vertex is not rotated, R is the unit matrix. (x, y, z) represents the local coordinates of the vertex.

[0188] In the embodiment of the present disclosure, since the color value obtained by sampling the mask image is a three-dimensional vector, the local coordinates of the Mask texture color obtained by sampling the mask can be input into the above formula (4) as the local coordinates of the vertex, and the local coordinates of the scaled and offset vertex are finally obtained by calculation.

[0189] It should be noted that based on the WPO function, the vertex movement of the mesh object can be controlled in the world space to achieve special effects such as target movement, rotation, and shape change.

[0190] For example, based on the above formula (4), the scene objects in the scene terrain after the mask processing can be subjected to vertex offset, which will not be described in detail here.

[0191] In the disclosed embodiment, the channels of the pixels of the mask map (e.g., target mask) of the scene terrain texture may include: a red channel of the texture, a green channel of the texture, a blue channel of the texture, and a transparency alpha channel. The texture of the mask of the scene terrain may be stored in the color information of any channel.

[0192] Based on this solution, electronic devices can accurately sample the color values ​​of texture coordinate positions according to the texture map of the mask, and then perform vertex offset on the sampling points to fine-tune the mask shape, making the three-dimensional model obtained through mask mapping more detailed and realistic.

[0193] It should be noted that the method for generating scene terrain provided in the embodiments of the present disclosure may be executed by a scene terrain generating device, or a control module in the scene terrain generating device for executing the method for constructing a scene model. In the embodiments of the present disclosure, the method for constructing a scene model by a scene terrain generating device is taken as an example to illustrate the device for constructing a scene model provided in the embodiments of the present disclosure.

[0194] Figure 8 A possible structural diagram of a scene terrain generation device provided by an embodiment of the present disclosure is as follows: Figure 8As shown in, the scene terrain generation device 800 includes: an arrangement module 801, a texture mapping module 802, a mask mapping module 803 and a rendering module 804; the arrangement module 801 is used to arrange standard models on a target area to construct a scene model, the target area is the display area of ​​the scene terrain on the game screen, and the standard model includes a surface UV coordinate value; the texture mapping module 802 is used to call a target texture map to perform texture mapping on the standard model for constructing the scene model based on the surface UV coordinate value of the standard model, so that the standard model includes texture information; the mask mapping module 803 is used to map a target mask to the scene model, so that the scene model matches the target mask; the rendering module 804 is used to render and generate the scene terrain based on the scene model after mask processing.

[0195] Optionally, the standard model is a standard broken model, and the standard broken model also includes the surface UV coordinate value of each fragment; the texture mapping module 802 is specifically used to: based on the UV coordinate value of the surface of each fragment in the standard broken model, call the target texture map to perform texture mapping on the standard broken model for constructing the scene model, so that the standard broken model includes texture information.

[0196] Optionally, the device for generating scene terrain also includes: an acquisition module and a vertex animation mapping module; the acquisition module is used to acquire model data of a standard fragmentation model after the mask mapping module maps a target mask onto the scene model so that the scene model matches the target mask; the vertex animation mapping module is used to perform vertex offset on the scene model based on the model data of the standard fragmentation model and each fragment arranged in the scene model; the rendering module is specifically used to render and generate the scene terrain based on the scene model after vertex offset.

[0197] Optionally, the scene terrain generation device also includes: a sampling module; the sampling module is used to sample the color value of the texture map of the target mask before the mask mapping module maps the target mask to the scene model; the vertex animation mapping module is used to perform vertex offset on the target mask based on the color value of the texture of the target mask sampled by the sampling module; the mask mapping module is specifically used to map the target mask after the vertex offset to the scene model.

[0198] Optionally, the scene terrain generation device also includes: a construction module, a fragmentation processing module, a UV value mapping module and a storage module; the construction module is used to construct a first model before the arrangement module arranges the standard model on the target area to construct the scene model; the fragmentation processing module is used to fragment the first model constructed by the construction module; the UV value mapping module is used to map UV coordinate values ​​for the outer surface of the first model after fragmentation by the fragmentation processing module, and to map UV coordinate values ​​for the cross-section of the fragments of the first model after fragmentation by the fragmentation processing module, so as to obtain a second model; the storage module is used to store model data of the second model; wherein the second model is a standard fragmentation model, and the outer contour of the second model is the same as the outer contour of the first model.

[0199] Optionally, the scene terrain generation device also includes: a cutting module; the cutting module is used to cut the second model according to the first cutting information after the UV value mapping module maps the UV coordinates to obtain the second model; the UV value mapping module is used to map the UV coordinate value for the cutting surface of the second model after cutting by the cutting module to obtain a third model; the storage module is specifically used to store model data of the third model.

[0200] Optionally, the target texture map includes at least a first texture map and a second texture map; the texture mapping module is specifically used to call the first texture map to perform texture mapping on the fragments of the standard broken model arranged at the first position in the scene model, and call the second texture map to perform texture mapping on the fragments of the standard broken model arranged at the second position, so that the standard broken model in the scene model is superimposed with the textures of the first texture map and the second texture map; wherein the second position includes part or all of the standard broken model arranged at the first position of the scene model.

[0201] Optionally, the target texture map includes at least a third texture map and a fourth texture map; the texture mapping module is specifically used to call the third texture map to perform texture mapping on the fragments of the standard fragmentation model arranged at a third position in the scene model; and call the fourth texture map to perform texture mapping on the fragments of the standard fragmentation model arranged at a fourth position in the scene model; wherein the standard fragmentation model for mapping the texture of the third texture map includes a fragmentation model of a first scene object, and the standard fragmentation model for mapping the texture of the fourth texture map includes a fragmentation model of a second scene object, and the first object and the second object are different scene objects in the scene model.

[0202] Optionally, the arrangement module is specifically used to determine the arrangement position of each standard model in the X direction and the Y direction of the target area to construct the scene model based on a first preset formula and according to the size of the standard model; the first preset formula is: Wherein, LocPos(r,c) represents the arrangement position of the standard model in the target area, r represents the row number of the standard model, c represents the column number of the standard model, DisX represents the length of the standard model in the X direction, and DisY represents the length of the standard model in the Y direction; OriginX represents the starting position of the standard model in the X direction, and OriginY represents the starting position of the standard model in the Y direction.

[0203] Optionally, the texture mapping module is specifically used to: determine a target UV coordinate value for texture mapping of a target object based on a surface UV coordinate value of the target object, an arrangement position of the target object and a second preset formula; the target object is a standard broken model, or a fragment of the standard broken model; call a target texture map, and perform texture mapping on the target object based on a texture corresponding to a target UV coordinate value in the target texture map; the second preset formula is:

[0204] Among them, UV Remap represents the target UV coordinate value of the target object for texture mapping, Texcoord1 represents the UV coordinate value of the target object, X Scale Indicates the repetition of the source texture of the texture map in the X direction, Y Scale Indicates the repetition of the source texture of the texture map in the Y direction, Offset1 indicates the overall offset of the texture, X length Indicates the length of the target area in the X direction, Y length Indicates the length of the target area in the Y direction, LocPos.x indicates the world position coordinates of the target object in the horizontal direction, LocPos.y indicates the world position coordinates of the target object in the vertical direction, OriginX indicates the starting position of the standard model in the X direction, and OriginY indicates the starting position of the standard model in the Y direction.

[0205] Optionally, the sampling module is specifically used to sample the color value of the texture map of the target mask based on a third preset formula and the texture map of the target mask; the third preset formula is: Mask=Sample(MaskTex,Texcoord2*Tilling+Offset2); wherein, MaskTex represents the texture map of the target mask, Texcoord2 represents the sampled texture coordinates, Tilling represents the scaling factor of the texture, Offset2 represents the offset size of the texture, and Mask represents the color value obtained by sampling the texture at the texture coordinate Texcoord2 of the texture map of the target mask based on the Sample function.

[0206] The disclosed embodiment provides a scene terrain generation device, which can call a standard model, quickly arrange the standard model on the target area to construct the scene model; then map the texture of the target texture map to the standard model at the corresponding position based on the surface UV coordinates of the standard model at each arrangement position; finally, call the mask to crop the unnecessary parts of the scene model, so as to obtain a scene model whose appearance meets the requirements, and quickly construct scene objects of different shapes and textures in the scene model. When the scene terrain generation device renders the scene model in the GUI, compared with the related technology, it is no longer necessary to call multiple three-dimensional models of scene objects of different shapes. Especially in the case of rendering a large world scene, only one standard model needs to be called to quickly construct the scene model for rendering, so that the model resources called by the scene terrain generation device can be further reduced, the rendering load can be reduced, and the amount of rendering calculations can be reduced, so that the speed of rendering the scene model can be improved, the switching speed when the scene is switched can be improved, and the user experience can be improved.

[0207] The scene terrain generation device in the embodiment of the present disclosure may be a device, or a component, integrated circuit, or chip in a terminal. The device may be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, a UMPC (ultra-mobile personal computer), a netbook, or a PDA (personal digital assistant), etc., and the non-mobile electronic device may be a server, a NAS (Network Attached Storage), a PC (personal computer), a TV (television), a teller machine, or a self-service machine, etc., which is not specifically limited in the embodiment of the present disclosure.

[0208] The scene terrain generation device provided in the embodiment of the present disclosure can achieve Figures 1 to 7 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0209] Alternatively, if Fig. 9 As shown, the embodiment of the present disclosure also provides an electronic device 900, including a processor 901, a memory 902, and a program or instruction stored in the memory 902 and executable on the processor 901. When the program or instruction is executed by the processor 901, each process of the above-mentioned scene terrain generation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0210] It should be noted that the electronic devices in the embodiments of the present disclosure include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0211] Fig.10 A schematic diagram of the hardware structure of an electronic device for implementing an embodiment of the present disclosure.

[0212] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.

[0213] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.10 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0214] The disclosed embodiment provides an electronic device, which can call a standard model, quickly arrange the standard model on the target area to build a scene model; then map the texture of the target texture map to the standard model at the corresponding position based on the surface UV coordinates of the standard model at each arrangement position; finally, call the mask to crop the unnecessary parts of the scene model, so as to obtain a scene model whose appearance meets the requirements, and quickly build scene objects of different shapes and textures in the scene model. When the electronic device renders the scene model in the GUI, compared with the related technology, it is no longer necessary to call the three-dimensional models of multiple scene objects of different shapes. Especially in the case of rendering a large world scene, only one standard model needs to be called to quickly build the scene model for rendering, so that the model resources called by the electronic device can be further reduced, the rendering load can be reduced, and the amount of rendering calculations can be reduced, so that the speed of rendering the scene model can be improved, the switching speed when the scene is switched can be improved, and the user experience can be improved.

[0215] It should be understood that in the embodiment of the present disclosure, the input unit 1004 may include a GPU (Graphics Processing Unit) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1006 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 1009 may be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1010.

[0216] The embodiment of the present disclosure also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned scene terrain generation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0217] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer ROM (Read-Only Memory), RAM (Random Access Memory), a magnetic disk or an optical disk.

[0218] The disclosed embodiment further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned scene terrain generation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0219] It should be understood that the chip mentioned in the embodiments of the present disclosure may also be referred to as a system-level chip, a system chip, a chip system, or a system-on-chip chip, etc.

[0220] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises one..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiments of the present disclosure is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0221] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present disclosure.

[0222] The embodiments of the present disclosure are described above in conjunction with the accompanying drawings, but the present disclosure is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present disclosure, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present disclosure and the claims, all of which are within the protection of the present disclosure.

Claims

1. A method for generating scene terrain, It is characterized in that The method comprises: Arranging standard models on a target area to construct a scene model, wherein the target area is a display area of ​​the scene terrain on the game screen, and the standard model includes a surface UV coordinate value; the standard model is a three-dimensional model of an arbitrary shape; Based on the surface UV coordinate value of the standard model, calling the target texture map to perform texture mapping on the standard model for constructing the scene model, so that the standard model includes texture information; Mapping a target mask onto the scene model so that the scene model matches the target mask; Based on the masked scene model, rendering and generating the scene terrain; The step of arranging standard models on the target area to construct a scene model includes: Based on the first preset formula, according to the size of the standard model, the arrangement position of each standard model in the X direction and the Y direction of the target area is determined to construct the scene model; The step of calling a target texture map to perform texture mapping on the standard model for constructing the scene model based on the surface UV coordinate value of the standard model includes: Determining a target UV coordinate value for texture mapping of the target object based on a surface UV coordinate value of the target object, an arrangement position of the target object and a second preset formula; the target object is a standard broken model or a fragment of a standard broken model; The target texture map is called, and texture mapping is performed on the target object based on the texture corresponding to the target UV coordinate value in the target texture map.

2. The method according to claim 1, It is characterized in that The standard model is a standard crushing model, and the standard crushing model also includes the surface UV coordinate value of each fragment; The step of calling a target texture map to perform texture mapping on the standard model for constructing the scene model based on the surface UV coordinate value of the standard model so that the standard model includes texture information includes: Based on the surface UV coordinate value of each fragment in the standard fragmentation model, the target texture map is called to perform texture mapping on the standard fragmentation model for constructing the scene model, so that the fragments of the standard model include texture information.

3. The method according to claim 2, It is characterized in that After mapping the target mask onto the scene model so that the scene model matches the target mask, the method further includes: Obtain model data of the standard crushing model; Based on the model data and each fragment of the standard fragmentation model arranged in the scene model, performing vertex offset on the scene model; The step of rendering and generating the scene terrain based on the scene model after the mask processing includes: Based on the scene model after vertex offset, the scene terrain is generated by rendering.

4. The method according to any one of claims 1 to 3, It is characterized in that Before mapping the target mask onto the scene model, the method further comprises: Sample the color value of the texture map of the target mask; Based on the sampled color value of the texture of the target mask, performing vertex offset on the target mask; Mapping the target mask onto the scene model comprises: The target mask after vertex offset is mapped onto the scene model.

5. The method according to claim 2, It is characterized in that Before arranging the standard models on the target area to construct the scene model, the method further includes: Build the first model; Fragmenting the first model; Mapping UV coordinate values ​​for the outer surface of the first model after the fragmentation process, and mapping UV coordinate values ​​for the cross-section of the fragments of the first model after the fragmentation process, so as to obtain a second model; storing model data of the second model; The second model is the standard crushing model, and the outer contour of the second model is the same as the outer contour of the first model.

6. The method according to claim 5, It is characterized in that After obtaining the second model, the method further includes: Cut the second model according to the first cutting information, and map UV coordinate values ​​for the cutting surface of the second model after cutting to obtain a third model; Storing the model data of the second model includes: The model data of the third model is stored, and the third model is the standard crushing model.

7. The method according to claim 2, It is characterized in that The target texture map includes at least a first texture map and a second texture map; The calling of the target texture map performs texture mapping on the standard fragmentation model for constructing the scene model so that the fragments of the standard model include texture information, including: Calling the first texture map to perform texture mapping on the fragments of the standard broken model arranged at a first position in the scene model, and calling the second texture map to perform texture mapping on the fragments of the standard broken model arranged at a second position in the scene model, so that the standard broken model in the scene model is superimposed with the textures of the first texture map and the second texture map; The second position includes a standard fragmentation model of a partial or complete arrangement of the first position of the scene model.

8. The method according to claim 1, It is characterized in that The first preset formula is: Wherein, LocPos(r, c) represents the arrangement position of the standard model in the target area, r represents the row number where the standard model is located, c represents the column number where the standard model is located, DisX represents the length of the standard model in the X direction, and DisY represents the length of the standard model in the Y direction; OriginX represents the starting position of the standard model in the X direction, and OriginY represents the starting position of the standard model in the Y direction.

9. The method according to claim 1, It is characterized in that The second preset formula is: Among them, UV Remap Indicates the target UV coordinate value for texture mapping of the target object, Texcoord 1 Indicates the UV coordinate value of the target object, X Scale Indicates the repetition of the source texture of the texture map in the X direction, Y Scale Indicates the repetition of the source texture of the texture map in the Y direction, Offset 1 Indicates the overall texture offset, X length Indicates the length of the target area in the X direction, Y length Indicates the length of the target area in the Y direction, LocPos.x indicates the world position coordinates of the target object in the horizontal direction, LocPos.y indicates the world position coordinates of the target object in the vertical direction, OriginX indicates the starting position of the standard model in the X direction, and OriginY indicates the starting position of the standard model in the Y direction.

10. The method according to claim 4, It is characterized in that The color value of the texture map of the sampling target mask includes: Based on a third preset formula and the texture map of the target mask, sampling a color value of the texture map of the target mask; The third preset formula is: Mask=Sample(MaskTex,Texcoord 2 *Tilling+Offset 2 ); Among them, MaskTex represents the texture map of the target mask, Texcoord 2 Indicates the sampled texture coordinates, Tilling indicates the texture scaling factor, Offset 2 Indicates the offset size of the texture, Mask represents the texture coordinates Texcoord of the texture map of the target mask sampled based on the Sample function 2 The color value obtained by the texture at 11. A device for generating scene terrain, It is characterized in that The device comprises: an arrangement module, a texture mapping module, a mask mapping module and a rendering module; The arrangement module is used to arrange the standard model on the target area to construct the scene model, the target area is the display area of ​​the scene terrain on the game screen, the standard model includes the surface UV coordinate value; the standard model is a three-dimensional model of any shape; The texture mapping module is used to call a target texture map to perform texture mapping on the standard model for constructing the scene model based on the surface UV coordinate value of the standard model, so that the standard model includes texture information; The mask mapping module is used to map the target mask onto the scene model so that the scene model matches the target mask; The rendering module is used to render and generate the scene terrain based on the scene model after mask processing; The step of arranging standard models on the target area to construct a scene model includes: Based on the first preset formula, according to the size of the standard model, the arrangement position of each standard model in the X direction and the Y direction of the target area is determined to construct the scene model; The step of calling a target texture map to perform texture mapping on the standard model for constructing the scene model based on the surface UV coordinate value of the standard model includes: Determining a target UV coordinate value for texture mapping of the target object based on a surface UV coordinate value of the target object, an arrangement position of the target object and a second preset formula; the target object is a standard broken model or a fragment of a standard broken model; The target texture map is called, and texture mapping is performed on the target object based on the texture corresponding to the target UV coordinate value in the target texture map.

12. An electronic device, It is characterized in that The method comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method for generating scene terrain as described in any one of claims 1 to 10.

13. A readable storage medium, It is characterized in that The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the method for generating scene terrain as described in any one of claims 1 to 10 are implemented.