Terrain rendering method and device for virtual scene, equipment, medium and program product

By directly rendering the three-dimensional mesh in the virtual scene on the graphics processor, the problem of low rendering efficiency in the existing technology is solved, and a more efficient and stable rendering effect is achieved.

CN119701333APending Publication Date: 2025-03-28TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202311290348.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The prior art has low rendering efficiency in virtual scenes and is prone to resource locking and performance degradation.

Method used

By obtaining multiple three-dimensional meshes in the virtual scene, determining their division level and texture level, rendering directly on the graphics processor based on these parameters, avoiding the central processor reading back.

Benefits of technology

It improves the terrain rendering efficiency and effect of virtual scenes, avoiding resource locking and information lag problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119701333A_ABST
    Figure CN119701333A_ABST
Patent Text Reader

Abstract

The invention provides a terrain rendering method and device for a virtual scene, electronic equipment, a computer readable storage medium and a computer program product, and the method comprises the steps: obtaining a plurality of three-dimensional grids in a view cone corresponding to the virtual scene, and enabling the three-dimensional grids to be obtained through dividing a three-dimensional terrain in the virtual scene; for each three-dimensional grid, obtaining a division grade corresponding to the three-dimensional grid, and determining a texture grade of the three-dimensional grid based on the division grade; obtaining texture parameters of the three-dimensional grids in the rendering process based on the texture levels of the three-dimensional grids, and rendering the plurality of three-dimensional grids based on the texture parameters and the division levels corresponding to the three-dimensional grids to obtain a target image; wherein the target image is used for indicating a topographic image in a view field range indicated by the view cone in the virtual scene. In this way, the rendering efficiency and the rendering effect can be improved when the terrain of the virtual scene is rendered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a terrain rendering method, device, electronic device, computer-readable storage medium and computer program product for a virtual scene. Background Art

[0002] In the related art, when rendering the terrain of a virtual scene, most of the time, it is necessary to read back the graphics processor, that is, calculate the actual required rendering parameters on the graphics processor, and after the central processing unit reads this parameter, it prepares the texture resources required for rendering, and then sends the texture resources and rendering instructions to the graphics processor. However, when reading back, a large number of resources will be locked, causing a serious decline in performance. If there is a delay of 1 frame, it will cause information lag. Therefore, the rendering efficiency of the related art when rendering the terrain of the virtual scene is low. Summary of the invention

[0003] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for rendering terrain of a virtual scene, which can improve the rendering efficiency and rendering effect when rendering the terrain of the virtual scene.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application provides a method for terrain rendering of a virtual scene, the method comprising:

[0006] Acquire a plurality of three-dimensional grids inside a viewing cone corresponding to a virtual scene, wherein the three-dimensional grids are obtained by dividing the three-dimensional terrain in the virtual scene;

[0007] For each of the three-dimensional grids, obtaining a division level corresponding to the three-dimensional grid, and determining a texture level of the three-dimensional grid based on the division level;

[0008] Based on the texture level of each of the three-dimensional grids, acquiring a texture parameter of each of the three-dimensional grids during the rendering process, and rendering the multiple three-dimensional grids based on the texture parameter and the division level corresponding to the three-dimensional grid to obtain a target image;

[0009] The target image is used to indicate, in the virtual scene, a terrain image within the field of view indicated by the viewing cone.

[0010] The present application provides a terrain rendering device for a virtual scene, the device comprising:

[0011] An acquisition module, used to acquire a plurality of three-dimensional grids inside a viewing cone corresponding to a virtual scene, wherein the three-dimensional grids are obtained by dividing the three-dimensional terrain in the virtual scene;

[0012] A determination module, configured to obtain, for each of the three-dimensional grids, a division level corresponding to the three-dimensional grid, and determine a texture level of the three-dimensional grid based on the division level;

[0013] A rendering module is used to obtain texture parameters of each of the three-dimensional grids during the rendering process based on the texture level of each of the three-dimensional grids, and render the multiple three-dimensional grids based on the texture parameters and the division level corresponding to the three-dimensional grid to obtain a target image; wherein the target image is used to indicate, in the virtual scene, a terrain image within the field of view indicated by the viewing cone.

[0014] In the above scheme, the determination module is also used to obtain the target distance between the three-dimensional grid and the virtual light source corresponding to the virtual scene; select the target distance interval to which the target distance belongs from multiple distance intervals, each of the distance intervals corresponding to a division level; and determine the division level corresponding to the target distance interval as the division level corresponding to the three-dimensional grid.

[0015] In the above scheme, the determination module is also used to obtain a preset texture offset parameter; wherein the texture offset parameter is used to offset the texture level; and the texture level of the three-dimensional grid is determined in combination with the division level and the texture offset parameter.

[0016] In the above scheme, the determination module is also used to multiply the value of the division level with a reference value to obtain a product result; wherein the reference value is obtained by adding the value of the division level and the target value; performing square root processing on the product result to obtain a square root result; performing difference processing on the square root result and the value of the texture offset parameter to obtain the texture level of the three-dimensional grid.

[0017] In the above scheme, the acquisition module is also used to acquire multiple three-dimensional grids corresponding to the virtual scene and a viewing cone corresponding to the virtual scene; for each of the three-dimensional grids, the following processing is performed: an intersection detection is performed on the three-dimensional grid and the viewing cone, and when the ratio of the detection result representing the part of the three-dimensional grid inside the viewing cone to the volume of the three-dimensional grid reaches a ratio threshold, the three-dimensional grid is determined as a three-dimensional grid inside the viewing cone corresponding to the virtual scene.

[0018] In the above scheme, the rendering module is also used to draw each of the three-dimensional grids in the target canvas based on the texture parameters of each of the three-dimensional grids and the division level corresponding to the three-dimensional grid to obtain rendering data of each of the three-dimensional grids; based on the rendering data of each of the three-dimensional grids, render the multiple three-dimensional grids to obtain a target image.

[0019] In the above scheme, the rendering module is also used to perform the following processing on each of the three-dimensional grids: based on the division level of the three-dimensional grid, allocating a target grid area corresponding to the three-dimensional grid on the target canvas corresponding to the virtual scene; based on the texture parameters of the three-dimensional grid, obtaining the drawing resolution corresponding to the three-dimensional grid, and based on the drawing resolution, drawing the three-dimensional grid in the target grid area to obtain rendering data of the three-dimensional grid.

[0020] In the above scheme, the rendering module is also used to perform the following processing for each of the three-dimensional grids: based on the division level of the three-dimensional grid, determine the target grid area corresponding to the three-dimensional grid in the cache canvas; when the rendering data of the three-dimensional grid is obtained from the target grid area, use the obtained rendering data as the rendering data obtained by drawing the three-dimensional grid in the target canvas; when the rendering data of the three-dimensional grid is not obtained from the target grid area, based on the texture parameters of the three-dimensional grid, obtain the drawing resolution corresponding to the three-dimensional grid, and based on the drawing resolution, draw the three-dimensional grid in the target canvas to obtain the rendering data of the three-dimensional grid.

[0021] In the above scheme, the device also includes a division module, which is used to obtain plane data and height data of the virtual scene; based on the plane data and the height data, the three-dimensional terrain of the virtual scene is determined, and the three-dimensional terrain is grid-divided to obtain multiple three-dimensional grids corresponding to the virtual scene; the acquisition module 1 is also used to obtain multiple three-dimensional grids inside the visual cone corresponding to the virtual scene from the multiple three-dimensional grids corresponding to the virtual scene.

[0022] In the above scheme, the division module is also used to grid the three-dimensional terrain to obtain a target number of initial three-dimensional grids; obtain the distance between each of the initial three-dimensional grids and the virtual light source corresponding to the virtual scene, and based on the distance, adjust the size of each of the initial three-dimensional grids to obtain a target three-dimensional grid; determine multiple target three-dimensional grids as multiple three-dimensional grids corresponding to the virtual scene; wherein the size of the target three-dimensional grid is positively correlated with the distance.

[0023] In the above scheme, the division module is also used to perform the following processing on each of the initial three-dimensional grids: take the initial three-dimensional grid as the first three-dimensional grid, and obtain the i-th distance threshold corresponding to the i-th three-dimensional grid; when the distance corresponding to the i-th three-dimensional grid is less than the i-th distance threshold, grid divide the i-th three-dimensional grid to obtain the i+1-th three-dimensional grid; traverse i until the size of the i+1-th three-dimensional grid reaches the target size; wherein, i is a positive integer not less than 1 and not greater than N, and N is a preset positive integer.

[0024] An embodiment of the present application provides an electronic device, including:

[0025] A memory for storing executable instructions;

[0026] The processor is used to implement the terrain rendering method of the virtual scene provided in the embodiment of the present application when executing the executable instructions stored in the memory.

[0027] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the terrain rendering method of the virtual scene provided by the embodiment of the present application.

[0028] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the terrain rendering method of the virtual scene provided in the embodiment of the present application.

[0029] The embodiments of the present application have the following beneficial effects:

[0030] When determining the division level of each of the acquired multiple three-dimensional grids, the texture level of the three-dimensional grid is determined based on the division level, thereby obtaining the texture parameters of each three-dimensional grid during the rendering process based on the texture level of each three-dimensional grid, and rendering the multiple three-dimensional grids based on the texture parameters and the division level corresponding to the three-dimensional grid to obtain the target image. In this way, by directly determining the texture parameters corresponding to each of the multiple three-dimensional grids in the virtual scene, and then rendering the terrain of the virtual scene based on the texture parameters, the rendering efficiency and rendering effect when rendering the terrain of the virtual scene are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 1 is a schematic diagram of the architecture of a terrain rendering system 100 for a virtual scene provided in an embodiment of the present application;

[0032] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0033] Figure 3 It is a flowchart of a terrain rendering method for a virtual scene provided in an embodiment of the present application;

[0034] Figure 4 is a schematic diagram of performing intersection detection on a three-dimensional grid and a viewing cone provided in an embodiment of the present application;

[0035] Figure 5 is a schematic diagram of determining a three-dimensional terrain of a virtual scene based on plane data and height data provided in an embodiment of the present application;

[0036] Figure 6 is a schematic diagram of the distance between the initial three-dimensional grid and the virtual light source provided in an embodiment of the present application;

[0037] Figure 7 is a schematic diagram of a process for determining a target three-dimensional grid provided in an embodiment of the present application;

[0038] Figure 8 is a schematic diagram of a target image provided in an embodiment of the present application;

[0039] Fig. 9 is a schematic diagram of a three-dimensional grid with different texture parameters provided in an embodiment of the present application after being rendered;

[0040] Fig.10 It is a flowchart of a terrain rendering method for a virtual scene provided in an embodiment of the present application;

[0041] Fig.11 It is a flowchart of a terrain coloring technology running on a mobile terminal provided in an embodiment of the present application;

[0042] Fig.12 It is a schematic diagram of different blocks provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0044] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0045] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0047] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0048] 1) Client, also known as the user end, refers to the program corresponding to the server that provides local services to users. Except for some applications that can only run locally, it is generally installed on an ordinary client and needs to cooperate with the server to run, that is, it requires corresponding servers and service programs in the network to provide corresponding services. In this way, specific communication connections need to be established on the client and server sides to ensure the normal operation of the application.

[0049] 2) Virtual light source is a "light source" set up in computer animation software or virtual engines. The role of virtual light source in expressing viewpoint during animation production is equivalent to physical light source in the traditional sense. The objects illuminated by virtual light source and physical light source are completely different, but their functions are extremely similar. Physical light source illuminates real people or actually built scenes, while virtual light source illuminates models built in 3D software, which can realize unlimited possibilities.

[0050] 3) A virtual scene is a virtual scene displayed (or provided) when an application is running on a terminal. The virtual scene can be a simulation of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiment of the present application does not limit the dimension of the virtual scene. For example, a virtual scene may include the sky, land, ocean, etc. The land may include environmental elements such as deserts and cities, and users can control virtual objects to move in the virtual scene.

[0051] 4) Scene data, which indicates the various characteristics of objects in the virtual scene during the interaction process, for example, it may include the position of the object in the virtual scene. Of course, different types of characteristics may be included according to the type of virtual scene; for example, in a virtual scene of a game, scene data may include the waiting time required for various functions configured in the virtual scene (depending on the number of times the same function can be used within a specific time), and may also indicate the attribute values ​​of various states of the game character, such as health value (also called red volume) and magic value (also called blue volume).

[0052] 5) Virtual light refers to the light in the virtual scene emitted by the virtual light source used to illuminate the virtual scene. The virtual light includes direct light and indirect light. The direct light is emitted by the virtual light source and reflected from the virtual illumination point to the virtual camera. The indirect light is emitted by the virtual light source and, after at least one reflection, reaches the virtual illumination point and is finally reflected from the virtual illumination point to the virtual camera.

[0053] 6) Virtual camera is a "camera" set up in computer animation software or virtual engine. The role of virtual camera in expressing viewpoint during animation is equivalent to that of traditional camera. The shooting objects of virtual camera and physical camera are completely different, but the functions are extremely similar. Physical camera shoots real people or actually built scenes, while virtual camera shoots models built in 3D software, which can realize infinite possibilities. Virtual camera is presented in the form of icon in virtual engine, and also has parameters such as lens, focal length, focus, aperture, depth of field, etc. It can realize camera actions such as "push, pull, shake, move, follow, swing, rise, fall, and comprehensive movement", and can realize shooting effects that are difficult or even impossible to achieve with physical camera, such as passing through walls, keyholes, objects, etc. The parameters that need to be adjusted for physical camera are distributed on the body of physical camera and need manual operation. The camera parameters of the virtual camera are buttons or numerical input bars integrated on the panel. The operator only needs to input parameters or drag the mouse. Sometimes a few key frames can determine the movement path of the virtual camera. In actual shooting, physical cameras often require stabilizers or motion control systems. Even so, the shaking of the picture still exists.

[0054] 7) Render Target (RT), the video memory buffer used to render pixels, that is, the memory area. There can be multiple such memory areas at the same time, that is, there can be multiple render targets at the same time.

[0055] See also Figure 1 , Figure 1It is a schematic diagram of the architecture of a terrain rendering system 100 for a virtual scene provided in an embodiment of the present application. A terminal (terminal 400 is shown as an example) is connected to a server 200 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two. The terminal 400 is used for a user to use a client 401, which is displayed on a display interface (display interface 401-1 is shown as an example). The terminal 400 and the server 200 are interconnected via a wired or wireless network.

[0056] The server 200 is used to obtain a plurality of three-dimensional grids inside a viewing cone corresponding to a virtual scene, wherein the three-dimensional grids are obtained by dividing the three-dimensional terrain in the virtual scene; for each three-dimensional grid, obtain a division level corresponding to the three-dimensional grid, and determine a texture level of the three-dimensional grid based on the division level; based on the texture level of each three-dimensional grid, obtain a texture parameter of each three-dimensional grid during a rendering process, and render the plurality of three-dimensional grids based on the texture parameters and the division level corresponding to the three-dimensional grid to obtain a target image; wherein the target image is used to indicate a terrain image within a viewing field indicated by the viewing cone in the virtual scene; and send the target image to a terminal;

[0057] The terminal 400 is used to receive the target image sent by the server and display the target image based on the display interface.

[0058] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Deliver Network), and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a set-top box, an intelligent voice interaction device, a smart home appliance, a virtual reality device, a vehicle-mounted terminal, an aircraft, and a mobile device (e.g., a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device, an intelligent speaker, and a smart watch), etc., but is not limited thereto. The terminal device and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0059] See also Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. In practical applications, the electronic device can be Figure 1 The server 200 or terminal 400 shown, see Figure 2 , Figure 2The electronic device shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .

[0060] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0061] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0062] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0063] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0064] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0065] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0066] A network communication module 452, used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;

[0067] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);

[0068] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.

[0069] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 A terrain rendering device 455 of a virtual scene stored in a memory 450 is shown, which may be software in the form of a program or a plug-in, and includes the following software modules: an acquisition module 4551, a determination module 4552, and a rendering template 4553. These modules are logical, and thus may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.

[0070] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the terrain rendering device for the virtual scene provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the terrain rendering method for the virtual scene provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.

[0071] In some embodiments, the terminal or server can implement the terrain rendering method of the virtual scene provided in the embodiment of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as an instant messaging APP, a web browser APP; it can also be a small program, that is, a program that can be run only by downloading it to a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form.

[0072] Based on the above description of the terrain rendering system and electronic device of the virtual scene provided by the embodiment of the present application, the terrain rendering method of the virtual scene provided by the embodiment of the present application is described below. In actual implementation, the terrain rendering method of the virtual scene provided by the embodiment of the present application can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration, so that Figure 1 The server 200 in the embodiment of the present application independently executes the terrain rendering method of the virtual scene provided by the embodiment of the present application as an example. Figure 3 , Figure 3 is a flow chart of a terrain rendering method for a virtual scene provided in an embodiment of the present application. Figure 3 The steps shown are explained.

[0073] Step 101: The server obtains a plurality of three-dimensional grids inside a viewing cone corresponding to a virtual scene. The three-dimensional grids are obtained by dividing the three-dimensional terrain in the virtual scene.

[0074] In actual implementation, the virtual scene can be a virtual game scene, or an audio and video live broadcast scene, etc., and the terrain of the virtual scene can include forest terrain, flowing water terrain, plateau terrain, glacier terrain, hilly terrain, etc. Before obtaining the multiple three-dimensional grids inside the visual cone corresponding to the virtual scene, the server first obtains the scene data corresponding to the virtual scene. The scene data corresponding to the virtual scene can be pre-stored locally or obtained from the outside world (such as the Internet). Here, after the server obtains the scene data corresponding to the virtual scene, it obtains the multiple three-dimensional grids inside the visual cone corresponding to the virtual scene. Specifically, based on the scene data, the multiple three-dimensional grids corresponding to the virtual scene and the visual cone corresponding to the virtual scene are obtained; for each three-dimensional grid, the following processing is performed: the intersection detection is performed on the three-dimensional grid and the visual cone, and when the detection result represents that the ratio of the part of the three-dimensional grid inside the visual cone to the volume of the three-dimensional grid reaches a ratio threshold, the three-dimensional grid is determined as the three-dimensional grid inside the visual cone corresponding to the virtual scene. Here, the ratio threshold can be pre-set, such as 50%.

[0075] In actual implementation, the process of obtaining the view cone corresponding to the virtual scene may be to obtain the virtual light source corresponding to the virtual scene; form a target cone with the virtual light emitted by the virtual light source as the edge and the virtual scene plane as the bottom surface; and determine the target cone as the view cone. In this way, the three-dimensional grid inside the view cone can be illuminated by the virtual light emitted by the virtual light source, so that the virtual camera can collect the corresponding three-dimensional grid, that is, the terrain in the virtual scene corresponding to the corresponding three-dimensional grid can be rendered and displayed.

[0076] For example, see Figure 4 , Figure 4 is a schematic diagram of performing intersection detection on a three-dimensional grid and a viewing cone provided in an embodiment of the present application, based on Figure 4 The dotted box indicates a virtual light source, and the four white lines emitted from the virtual light source are virtual light rays. Thus, a target cone is formed with the virtual light rays as edges and the virtual scene plane as the bottom surface, thereby detecting whether the three-dimensional grid is inside the target cone.

[0077] In actual implementation, the process of obtaining the viewing cone corresponding to the virtual scene may be, the process of obtaining multiple three-dimensional grids corresponding to the virtual scene may be, the process of obtaining plane data and height data of the virtual scene; based on the plane data and the height data, the three-dimensional terrain of the virtual scene is determined, and the three-dimensional terrain is gridded to obtain multiple three-dimensional grids corresponding to the virtual scene; thus, the process of obtaining multiple three-dimensional grids inside the viewing cone corresponding to the virtual scene may be, from the multiple three-dimensional grids corresponding to the virtual scene, obtaining the multiple three-dimensional grids inside the viewing cone corresponding to the virtual scene.

[0078] It should be noted that the plane data here can be the terrain data of the virtual scene in the horizontal direction, and the height data is the terrain data of the virtual scene in the vertical direction, that is, the height of the surface is stored in a single-channel grayscale image, and the grayscale image is used as the height data. In this way, the three-dimensional terrain corresponding to the virtual scene can be generated by combining the terrain data of the virtual scene in the horizontal direction and the terrain data of the virtual scene in the vertical direction.

[0079] For example, Figure 5 As shown, Figure 5 is a schematic diagram of determining the three-dimensional terrain of a virtual scene based on plane data and height data provided in an embodiment of the present application, based on Figure 5 , combined with the horizontal plane data of the virtual scene and the vertical height data of the virtual scene, the three-dimensional terrain corresponding to the virtual scene can be generated.

[0080] In actual implementation, after determining the three-dimensional terrain of the virtual scene, the three-dimensional terrain can be gridded to obtain multiple three-dimensional grids corresponding to the virtual scene. Specifically, the three-dimensional terrain is gridded to obtain a target number of initial three-dimensional grids; the distance between each initial three-dimensional grid and the virtual light source corresponding to the virtual scene is obtained, and based on the distance, the size of each initial three-dimensional grid is adjusted to obtain a target three-dimensional grid; the multiple target three-dimensional grids are determined as the multiple three-dimensional grids corresponding to the virtual scene; wherein the size of the target three-dimensional grid is positively correlated with the distance.

[0081] It should be noted that the number of targets here can be preset, such as 1024, etc.; and the distance between the initial three-dimensional grid and the virtual light source corresponding to the virtual scene, that is, the distance between the center of the top surface of the six surfaces of the initial three-dimensional grid closest to the virtual light source and the virtual light source, for example, see Figure 6 , Figure 6 is a schematic diagram of the distance between the initial three-dimensional grid and the virtual light source provided in the embodiment of the present application, based on Figure 6 , the surface formed by ABCD is the surface of the initial three-dimensional grid closest to the virtual light source, that is, the top surface, and P is the center of the surface formed by ABCD. The distance between point P and the virtual light source is the distance between the initial three-dimensional grid and the virtual light source.

[0082] It should be noted that the size of the target three-dimensional grid is positively correlated with the distance and is used for indication. When the size of the target three-dimensional grid is smaller, it means that the distance between the target three-dimensional grid and the virtual light source corresponding to the virtual scene is closer; when the size of the target three-dimensional grid is larger, it means that the distance between the target three-dimensional grid and the virtual light source corresponding to the virtual scene is farther.

[0083] In some embodiments, the process of resizing each initial three-dimensional grid based on distance to obtain a target three-dimensional grid specifically includes performing the following processing on each initial three-dimensional grid: taking the initial three-dimensional grid as the first three-dimensional grid, and obtaining the i-th distance threshold corresponding to the i-th three-dimensional grid; when the distance corresponding to the i-th three-dimensional grid is less than the i-th distance threshold, meshing the i-th three-dimensional grid to obtain the i+1-th three-dimensional grid; traversing i until the size of the i+1-th three-dimensional grid is the target size; wherein i is a positive integer not less than 1 and not greater than N, and N is a preset positive integer.

[0084] It should be noted that the process of resizing each initial three-dimensional grid to obtain a target three-dimensional grid is to detect each initial three-dimensional grid and obtain a detection result; based on the detection result, a target three-dimensional grid is determined, wherein the detection result is used to indicate whether the initial three-dimensional grid needs to be further divided into grids.

[0085] It should be noted that i is used to indicate the number of grid divisions performed to obtain the corresponding three-dimensional grid. For example, when i is 1, the first three-dimensional grid is obtained by performing one grid division on the three-dimensional terrain. When i is 2, the second three-dimensional grid is obtained by performing two grid divisions on the three-dimensional terrain. That is, firstly, a grid division is performed on the three-dimensional terrain to obtain the initial three-dimensional grid, that is, the first three-dimensional grid, and then the initial three-dimensional grid is grid divided once to obtain the second three-dimensional grid.

[0086] In actual implementation, each i-th three-dimensional grid has a corresponding i-th distance threshold, where the distance threshold and the corresponding relationship are pre-set. When the distance corresponding to the i-th three-dimensional grid is less than the i-th distance threshold, the i-th three-dimensional grid is meshed to obtain the i+1-th three-dimensional grid; when the distance corresponding to the i-th three-dimensional grid is not less than the i-th distance threshold, the i-th three-dimensional grid is used as the target three-dimensional grid, that is, the size of the i-th three-dimensional grid is the target size. Here, for i, traversal is performed until the size of the i+1-th three-dimensional grid is the target size, that is, for each i-th three-dimensional grid, the distance corresponding to the i-th three-dimensional grid is compared with the i-th distance threshold, when the distance corresponding to the i-th three-dimensional grid is not less than the i-th distance threshold, the i-th three-dimensional grid is used as the target three-dimensional grid, that is, the size of the i-th three-dimensional grid is the target size, when the distance corresponding to the i-th three-dimensional grid is less than the i-th distance threshold, the i-th three-dimensional grid is meshed to obtain the i+1-th three-dimensional grid, and the above operation is repeated for the i+1-th three-dimensional grid obtained by division, that is, for each i+1-th three-dimensional grid obtained by division, The distance corresponding to the i+1th three-dimensional grid is compared with the i+1th distance threshold. When the distance corresponding to the i+1th three-dimensional grid is not less than the i-th distance threshold, the i+1th three-dimensional grid is used as the target three-dimensional grid, that is, the size of the i+1th three-dimensional grid is the target size. When the distance corresponding to the i+1th three-dimensional grid is less than the i+1th distance threshold, the i+1th three-dimensional grid is meshed to obtain the i+2th three-dimensional grid, and the above operation is repeated for the i+2th three-dimensional grid obtained by the meshing until the sizes of all three-dimensional grids are the target size, where the target size is the grid size that makes the distance corresponding to the corresponding three-dimensional grid not less than the corresponding distance threshold. Among them, starting from the first distance threshold to the i-th distance threshold, the size of the distance threshold decreases successively.

[0087] It should be noted that a target distance threshold is also set here. When the distance corresponding to the three-dimensional grid obtained by grid division is less than the target distance threshold, the grid division will not continue. At the same time, the grid with a distance less than the target distance threshold will be used as the target three-dimensional grid, where the target distance threshold is less than each distance threshold; at the same time, when the distance corresponding to the three-dimensional grid obtained by grid division is less than the target distance threshold, the number of grid divisions corresponding to the three-dimensional grid is one more than the number of divisions corresponding to the minimum distance threshold.

[0088] For example, see Figure 7 , Figure 7 is a schematic diagram of a process for determining a target three-dimensional grid provided in an embodiment of the present application, based on Figure 7 , the map shown in a is now evenly divided into 16 initial three-dimensional grids as shown in b. For each initial three-dimensional grid, that is, the first three-dimensional grid, the corresponding distance is compared with the first distance threshold, such as 1024. When the distance is greater than the first distance threshold, no grid division is performed. When the distance is less than the first distance threshold, the initial three-dimensional grid is divided, which is equivalent to size adjustment, and 4 more grids are obtained. Here, the distance of the initial three-dimensional grids indicated by A, B, C, D, E, and F in b is less than the first distance threshold. Therefore, these six initial three-dimensional grids are grid divided to obtain 24 second three-dimensional grids indicated by c and 10 target three-dimensional grids; for each second three-dimensional grid, the corresponding distance is compared with the second distance threshold, such as 512. When the distance is greater than the second distance threshold, no grid division is performed. When the distance is less than the second distance threshold, the second three-dimensional grid is divided, which is equivalent to size adjustment, and 4 more grids are obtained. Here, A, B, C, D, E, and F in c The distance of the second three-dimensional grids indicated by B, C, D, E, and F is less than the second distance threshold, so the six second three-dimensional grids are grid-divided to obtain 28 target three-dimensional grids indicated by d and 24 third three-dimensional grids; for each third three-dimensional grid, the corresponding distance is compared with the third distance threshold, such as 256. When the distance is greater than the third distance threshold, grid division is not performed. When the distance is less than the third distance threshold, the third three-dimensional grid is divided, which is equivalent to size adjustment, and 4 grids are obtained. Here, the distance of the third three-dimensional grid indicated by A in d is less than the third distance threshold. Therefore, the second three-dimensional grid is grid-divided to obtain 51 target three-dimensional grids indicated by e and 1 fourth three-dimensional grid. In this way, the above operation is repeated until each three-dimensional grid is adjusted to a target three-dimensional grid, that is, the distance corresponding to the three-dimensional grid is greater than the corresponding distance threshold, or the distance corresponding to the three-dimensional grid is less than the target distance threshold.

[0089] It should be noted that the process of gridding the three-dimensional terrain to obtain multiple three-dimensional grids corresponding to the virtual scene can be implemented by a graphics processing unit (GPU) or a central processing unit (CPU) in a server. When it is implemented by the central processing unit in the server, it is also possible to obtain multiple three-dimensional grids corresponding to the virtual scene from the CPU. The embodiments of the present application do not limit how to implement the process of gridding the three-dimensional terrain to obtain multiple three-dimensional grids corresponding to the virtual scene.

[0090] Step 102: for each three-dimensional grid, obtain the division level corresponding to the three-dimensional grid, and determine the texture level of the three-dimensional grid based on the division level.

[0091] It should be noted that, as mentioned above, i can also correspond to the division level of the three-dimensional grid. For example, when i is 1, the division level corresponding to the first three-dimensional grid is the first level, when i is 2, the division level corresponding to the second three-dimensional grid is the second level, ..., when i is N, the division level corresponding to the Nth three-dimensional grid is the Nth level. Accordingly, when the distance corresponding to the three-dimensional grid obtained by grid division is less than the target distance threshold, the division level corresponding to the three-dimensional grid is one level higher than the division level corresponding to the minimum distance threshold. In other words, the division level is determined based on the distance between the three-dimensional grid and the virtual light source corresponding to the virtual scene.

[0092] Based on this, the process of obtaining the division level corresponding to the three-dimensional grid can be: obtaining the target distance between the three-dimensional grid and the virtual light source corresponding to the virtual scene; selecting the target distance interval to which the target distance belongs from multiple distance intervals, each distance interval corresponding to a division level; and determining the division level corresponding to the target distance interval as the division level corresponding to the three-dimensional grid.

[0093] It should be noted that the distance region here is determined by the aforementioned multiple distance thresholds and the target distance threshold. The division level corresponding to each distance interval is the division level corresponding to the smaller distance threshold of the two distance thresholds forming the corresponding distance interval. When the distance interval is formed by the target distance threshold and zero, the division level corresponding to the distance interval is the maximum division level; for example, when the multiple distance thresholds are 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, and the target When the distance threshold is 1, [0, 1), [1, 2), [2, 4), [4, 8), [8, 16), [16, 32), [32, 64), [64, 128), [128, 256), [256, 512), [512, 1024), [1024, ∞) are formed, wherein the division level corresponding to [1024, ∞) is the first level, the division level corresponding to [512, 1024) is the second level, and ..., the division level corresponding to [0, 1) is the twelfth level. Based on this, when the target distance between the three-dimensional grid and the virtual light source corresponding to the virtual scene is 100, the target distance interval to which the target distance belongs, i.e., [64, 128), is selected from the twelve distance intervals, and the division level corresponding to the target distance interval, i.e., the fifth level, is determined as the division level corresponding to the three-dimensional grid.

[0094] It should be noted that the process of obtaining the division level corresponding to the three-dimensional grid can be implemented by the GPU, and can also be implemented by the CPU. For the case implemented by the CPU, when the CPU determines the division level corresponding to the three-dimensional grid, the division level of each of the multiple three-dimensional grids inside the visual cone corresponding to the virtual scene is sent to the GPU. Specifically, after the GPU determines the multiple three-dimensional grids inside the visual cone corresponding to the virtual scene, a request to obtain the division level of the corresponding multiple three-dimensional grids is sent to the CPU, so that after the CPU determines the division level of the corresponding multiple three-dimensional grids, the division level of the corresponding multiple three-dimensional grids is returned to the GPU. The implementation method of the process of obtaining the division level corresponding to the three-dimensional grid is not limited in the embodiments of the present application.

[0095] In actual implementation, after obtaining the division level of the three-dimensional mesh, the process of determining the texture level of the three-dimensional mesh based on the division level may be to obtain a preset texture offset parameter; wherein the texture offset parameter is used to offset the texture level; and determine the texture level of the three-dimensional mesh in combination with the division level and the texture offset parameter.

[0096] It should be noted that the texture offset parameter is a preset configurable fixed value used to offset the texture level of the three-dimensional grid.

[0097] In actual implementation, the process of determining the texture level of the three-dimensional grid in combination with the division level and the texture offset parameter may be, based on the division level of the current three-dimensional grid, fitting the texture level corresponding to the three-dimensional grid, that is, multiplying the value of the division level with the reference value to obtain a product result; wherein the reference value is obtained by adding the value of the division level and the target value; performing square root processing on the product result to obtain a square root result; performing difference processing on the square root result and the value of the texture offset parameter to obtain the texture level of the three-dimensional grid, that is,

[0098] MipsLevel=Sqrt((LOD+2)*LOD)-MipoffsetConst...Formula (1);

[0099] Among them, MipsLevel is the texture level corresponding to the current three-dimensional grid; Sqrt is the square root function, LOD refers to the level parameter corresponding to the division level of the current three-dimensional grid; MipOffsetConst is the texture offset parameter.

[0100] It should be noted that the level parameter is negatively correlated with the division level, that is, the larger the division level of the three-dimensional grid, the smaller the corresponding level parameter, and the smaller the division level of the three-dimensional grid, the larger the corresponding level parameter. Continuing with the above example, the division level corresponding to [1024,∞) is the first level, the division level corresponding to [512,1024) is the second level, ..., the division level corresponding to [0,1) is the twelfth level. Based on this, the level parameter corresponding to the first level is 10, the level parameter corresponding to the second level is 9, ..., and the level parameter corresponding to the twelfth level is 0.

[0101] Step 103, based on the texture level of each three-dimensional grid, obtain the texture parameters of each three-dimensional grid during the rendering process, and render multiple three-dimensional grids based on the texture parameters and the division level corresponding to the three-dimensional grid to obtain a target image; wherein the target image is used to indicate, in the virtual scene, a terrain image within the field of view indicated by the viewing cone.

[0102] It should be noted that the field of view here is used to indicate the spatial area inside the viewing cone. The spatial area inside the viewing cone can be illuminated by the virtual light source, that is, it can be captured by the virtual camera. Therefore, the terrain image within the field of view indicated by the viewing cone is also the target image finally rendered.

[0103] In addition, there is a pre-set correspondence between the texture level and the texture parameter, so that based on the texture level of each three-dimensional grid, the texture parameters of each three-dimensional grid in the rendering process are obtained, which can be, obtaining the correspondence between the texture level and the texture parameter; based on the correspondence and the texture level of each three-dimensional grid, the texture parameters of each three-dimensional grid in the rendering process are obtained. Wherein, the texture parameters here include texture density, texture quality, texture size, etc., which are used to indicate the roughness, smoothness, shape factor, peak-to-valley, color, etc. of the terrain corresponding to the virtual scene, wherein roughness refers to the irregularity of the terrain, which is usually used to describe the roughness of the terrain; smoothness refers to the smoothness of the terrain, which is usually used to describe the smoothness of the terrain; shape factor refers to the shape feature of the terrain, which is usually used to describe the shape feature of the terrain; peak-to-valley refers to the undulation of the terrain, which is usually used to describe the undulation of the terrain; color refers to the category of the terrain, such as grass, snow, etc.

[0104] In actual implementation, after determining the texture parameters of each three-dimensional grid, based on the texture parameters and the division level corresponding to the three-dimensional grid, multiple three-dimensional grids are rendered to obtain a target image. The process may be: based on the texture parameters of each three-dimensional grid and the division level corresponding to the three-dimensional grid, each three-dimensional grid is drawn in a target canvas to obtain rendering data of each three-dimensional grid; based on the rendering data of each three-dimensional grid, multiple three-dimensional grids are rendered to obtain a target image, for example, Figure 8 As shown, Figure 8 is a schematic diagram of a target image provided in an embodiment of the present application, based on Figure 8 After rendering multiple three-dimensional grids based on the rendering data of each three-dimensional grid, the following is obtained: Figure 8 The target image is shown.

[0105] It should be noted that the division level here can be used to find the area corresponding to each three-dimensional grid in the target canvas. After finding the area corresponding to each three-dimensional grid on the target canvas, based on the texture parameters of the corresponding three-dimensional grid, the corresponding three-dimensional grid is drawn in the area corresponding to each three-dimensional grid on the target canvas to obtain the rendering data of the corresponding three-dimensional grid. Specifically, based on the texture parameters of each three-dimensional grid and the division level corresponding to the three-dimensional grid, each three-dimensional grid is drawn in the target canvas to obtain the rendering data of each three-dimensional grid, which can be performed on each three-dimensional grid. The following processing is performed: based on the division level of the three-dimensional grid, on the target canvas corresponding to the virtual scene, a target grid area corresponding to the three-dimensional grid is allocated; based on the texture parameters of the three-dimensional grid, the drawing resolution corresponding to the three-dimensional grid is obtained, and based on the drawing resolution, the three-dimensional grid is drawn in the target grid area to obtain the rendering data of the three-dimensional grid.

[0106] It should be noted that three-dimensional grids of different division levels have different sizes, but the corresponding target grid areas have the same size; the drawing resolution is used to indicate the size of the field of view in each target grid area. The larger the drawing resolution, the larger the texture parameters and texture level of the corresponding three-dimensional grid, and the larger the field of view corresponding to the corresponding target grid area, that is, the higher the display accuracy of the corresponding target grid area in the rendered target image; the smaller the drawing resolution, the smaller the texture parameters and texture level of the corresponding three-dimensional grid, and the smaller the field of view corresponding to the corresponding target grid area, that is, the lower the display accuracy of the corresponding target grid area in the rendered target image.

[0107] For example, see Fig. 9 , Fig. 9 is a schematic diagram of a three-dimensional grid with different texture parameters provided in an embodiment of the present application after being rendered, based on Fig. 9 , from a to f, the texture parameters, i.e., the texture levels, of the corresponding three-dimensional meshes decrease in sequence. That is, the texture parameters, i.e., the texture level, of the three-dimensional mesh corresponding to a is greater than the texture parameters, i.e., the texture level, of the three-dimensional mesh corresponding to b, the texture parameters, i.e., the texture level, of the three-dimensional mesh corresponding to b is greater than the texture parameters, i.e., the texture level, of the three-dimensional mesh corresponding to c, ..., the texture parameters, i.e., the texture level, of the three-dimensional mesh corresponding to e is greater than the texture parameters, i.e., the texture level, of the three-dimensional mesh corresponding to f.

[0108] It should be noted that the user's operation may affect the display of the three-dimensional terrain in the virtual scene. For example, when the user performs a zoom-in display operation, the three-dimensional terrain in the virtual scene will be zoomed in, that is, the distance between each three-dimensional grid and the virtual light source will become smaller, thereby affecting the division level of each three-dimensional grid, and then affecting the texture level of each three-dimensional grid; here, due to different distance change values, the division level of some three-dimensional grids will be changed, thereby affecting the texture level of the three-dimensional grid, while for other three-dimensional grids, the division level will not be changed, that is, the texture level will not be affected. Continuing with the above example, for the two three-dimensional grids with corresponding distances of 550 and 16, when the distance change value is 10, that is, the distance decreases by 10, at this time, the distances corresponding to the two three-dimensional grids are 540 and 6 respectively, then for the three-dimensional grid with a distance change of 540, the division level remains unchanged, while for the three-dimensional grid with a distance change of 6, the division level changes;

[0109] For another example, when the user performs a field of view turning operation, such as turning the field of view to the left, the three-dimensional terrain in the virtual scene will change. Therefore, due to the appearance of new terrain, the division level and texture level of the three-dimensional grid corresponding to the new terrain need to be re-determined, while part of the original terrain will still be displayed. In this case, the division level and texture level of the three-dimensional grid corresponding to these parts of the original terrain remain unchanged.

[0110] Based on this, for the process of drawing each 3D grid in the target canvas based on the texture parameters of each 3D grid and the division level corresponding to the 3D grid to obtain the rendering data of each 3D grid, it can also be to obtain the rendering data of the 3D grid that has been drawn before with unchanged division level and texture level, that is, the cached rendering data, thereby reducing the drawing process and improving the rendering efficiency of the terrain in the virtual scene. Specifically, based on the texture parameters of each 3D grid and the division level corresponding to the 3D grid, the process of drawing each 3D grid in the target canvas to obtain the rendering data of each 3D grid can also be to perform the following processing on each 3D grid: based on the division level of the 3D grid, determine the target grid area corresponding to the 3D grid in the cache canvas; when the rendering data of the 3D grid is obtained from the target grid area, use the obtained rendering data as the rendering data obtained by drawing the 3D grid in the target canvas; when the rendering data of the 3D grid is not obtained from the target grid area, obtain the drawing resolution corresponding to the 3D grid based on the texture parameters of the 3D grid, and draw the 3D grid in the target canvas based on the drawing resolution to obtain the rendering data of the 3D grid.

[0111] It should be noted that the cached canvas here is the target canvas that was drawn when the virtual terrain of the virtual scene was rendered last time, that is, when the previous frame of the target image was rendered. Continuing with the above example, when the user performs a zoom display operation, the cached canvas is the canvas that is drawn corresponding to the target image displayed before the user performs the zoom operation.

[0112] It should be noted that when the rendering data of the three-dimensional mesh is not obtained from the target mesh area, the drawing resolution corresponding to the three-dimensional mesh is obtained based on the texture parameters of the three-dimensional mesh, and based on the drawing resolution, the three-dimensional mesh is drawn in the target canvas to obtain the rendering data of the three-dimensional mesh. This process is also the above-mentioned three-dimensional mesh-based division level, on the target canvas corresponding to the virtual scene, a target mesh area corresponding to the three-dimensional mesh is allocated; based on the texture parameters of the three-dimensional mesh, the drawing resolution corresponding to the three-dimensional mesh is obtained, and based on the drawing resolution, the three-dimensional mesh is drawn in the target mesh area to obtain the rendering data of the three-dimensional mesh. This process is not elaborated in the embodiments of the present application.

[0113] In some embodiments, the embodiments of the present application can be implemented by a GPU. In this way, in the related art, when rendering the terrain of a virtual scene, most of the time, a graphics processor readback is required, that is, the rendering parameters required for rendering are calculated by the central processing unit, and the rendering parameters are sent to the graphics processor. However, when reading back, a large number of resources will be locked, resulting in a serious decline in performance. If there is a delay of 1 frame, it will cause information lag, resulting in a low rendering efficiency when rendering the terrain of the virtual scene. The present application directly determines the texture parameters corresponding to each of the multiple three-dimensional grids in the virtual scene through the graphics processor, and then renders the terrain of the virtual scene based on the texture parameters. Compared with the related art, when rendering the terrain of the virtual scene, most of the time, a graphics processor readback is required. There is no need for GPU readback, and there is no problem of information lag, which improves the rendering efficiency when rendering the terrain of the virtual scene.

[0114] Next, the terrain rendering method of the virtual scene provided by the embodiment of the present application is further introduced. Fig.10 is a flow chart of a method for rendering terrain of a virtual scene provided in an embodiment of the present application, see Fig.10 The terrain rendering method of the virtual scene provided in the embodiment of the present application is implemented collaboratively by the terminal and the server.

[0115] Step 201 : In response to a target object's display operation on a virtual scene, the client sends a virtual scene display request to a server.

[0116] In actual implementation, the target object may be a user, the client may be an application corresponding to a virtual scene set on a terminal, such as a game client, etc., and the virtual scene may be a scene in a game.

[0117] In step 202, the central processor in the server responds to the display request of the virtual scene, determines the three-dimensional terrain corresponding to the virtual scene based on the scene data, and grids the three-dimensional terrain to obtain multiple three-dimensional grids corresponding to the virtual scene and the division level corresponding to each three-dimensional grid.

[0118] In step 203, the central processing unit in the server sends the scene data of the virtual scene, a plurality of three-dimensional grids corresponding to the virtual scene, and a rendering instruction of the division level corresponding to each three-dimensional grid to the graphics processor.

[0119] Step 204 : The image processor in the server obtains a view cone corresponding to the virtual scene based on the scene data of the virtual scene, and performs intersection detection between the multiple three-dimensional grids corresponding to the virtual scene and the view cone.

[0120] Step 205 , the image processor in the server obtains multiple three-dimensional grids inside the viewing cone corresponding to the virtual scene based on the detection result, and determines the texture level of each three-dimensional grid based on the division level corresponding to each three-dimensional grid.

[0121] In step 206, the image processor in the server obtains texture parameters of each 3D grid during the rendering process based on the texture level of each 3D grid, and renders multiple 3D grids based on the texture parameters and the division level corresponding to the 3D grid to obtain a target image.

[0122] It should be noted that the target image is used to indicate, in the virtual scene, a terrain image within the field of view indicated by the viewing cone.

[0123] Step 207: The server sends the target image to the client.

[0124] Step 208: The client displays the target image based on the human-computer interaction interface.

[0125] In actual implementation, the client may display the target image in the human-computer interaction interface of the client, save the target image locally in the terminal, and send the target image to other devices that are communicatively connected to the terminal.

[0126] By using the above-mentioned embodiment of the present application, when determining the division level of each of the acquired multiple three-dimensional grids, the texture level of the three-dimensional grid is determined based on the division level, thereby obtaining the texture parameters of each three-dimensional grid during the rendering process based on the texture level of each three-dimensional grid, and rendering the multiple three-dimensional grids based on the texture parameters and the division level corresponding to the three-dimensional grid to obtain the target image. In this way, by directly determining the texture parameters corresponding to each of the multiple three-dimensional grids in the virtual scene, and then rendering the terrain of the virtual scene based on the texture parameters, the rendering efficiency when rendering the terrain of the virtual scene is improved.

[0127] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0128] In the related art, when rendering the terrain of a virtual scene, most of the time, it is necessary to read back the graphics processor, that is, calculate the actual required rendering parameters on the graphics processor, and after the central processing unit reads this parameter, it prepares the texture resources required for rendering, and then sends the texture resources and rendering instructions to the graphics processor. However, when reading back, a large number of resources will be locked, causing a serious decline in performance. If there is a delay of 1 frame, it will cause information lag. Therefore, the rendering efficiency of the related art when rendering the terrain of the virtual scene is low.

[0129] Based on this, the embodiment of the present application provides a terrain coloring technology running on a mobile terminal, provides a texture level that fits the virtual texture with the LOD level (level parameter) of the quadtree child node, and uses the same Atlas block to represent the size of different world ranges. In this way, the contradiction between the terrain coloring effect of a super-large open world on the mobile terminal and the performance of the mobile terminal is solved, and an excellent surface coloring performance is obtained on the mobile terminal, which provides a guarantee for the improvement of game quality and greatly improves the player's gaming experience.

[0130] Next, the quadtree is explained. Specifically, first prepare the data (height data) in the Z direction (vertical direction of the virtual scene), that is, the height map, which is generated during the offline production period. For example, a 32KM*32KM map is evenly divided into 32*32=1024 height maps, each with a height of Figure 1 K*1K resolution is used to represent the Z-direction height of a 1KM*1KM terrain. That is, 1 pixel represents a height of 1 meter. Then prepare the data (plane data) in the XY horizontal plane direction (the horizontal direction of the virtual scene), that is, the segmentation data of the quadtree. Finally, take the Z-direction data during runtime and combine it with the XY horizontal plane data into (x, y, z) to obtain the terrain grid, such as Figure 5 shown.

[0131] In actual implementation, for the quadtree segmentation data, specifically, the DistanceMin, i.e. the shortest distance, between the observation camera (virtual ray) and the node (three-dimensional grid) is determined, and then based on the shortest distance, the closest LOD level is found in the configuration array, which is the LOD of this quadtree node.

[0132] As an example, the actual distance is used to illustrate the subdivision of the quadtree. The closest distance between the four vertices of a quadtree node (the quadtree node is a square, so there are 4 vertices in total) and the camera is DistMin. The LOD configuration is a distance array LOD_Cfg, the array length is 10, and the values ​​are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 respectively; DistMin is compared with the 10 values ​​in LOD_Cfg respectively, and the array index of the first value that is smaller than DistMin is taken as the LOD level of the quadtree node. For example, the DistMin value of a quadtree node is 9.35 meters. It is compared with the values ​​in LOD_Cfg one by one. When LOD_Cfg[4]=16, 9.35<16, so the LOD level of the node is level 4.

[0133] Next, the visibility judgment is explained. Figure 4 As shown, Figure 4The boxes in the figure are quadtree nodes. Boxes of different sizes represent the LODs of different nodes. The white line represents the range of the view cone. For any quadtree node, a view cone intersection test is performed between it and the view cone. The intersecting quadtree nodes prove that they can be seen by the camera in the current frame. Otherwise, they are not seen by the camera and there is no need to submit them for rendering. Specifically, first take the XY plane positions of the four vertices of the quadtree node to obtain the bounding box BoundBox_XY of the XY plane; then, take the highest and lowest points of all Z within the coverage of the quadtree node, Z_Max and Z_Min; then, combine BoundBox_XY, Z_Max and Z_Min to obtain the bounding box BoundBox_XYZ of the quadtree node in three-dimensional space, which can accurately describe the range of the quadtree node in the world space (that is, the volume of the three-dimensional grid); then perform an intersection check on the bounding box BoundBox_XYZ and whether it is within the view cone. If any one of them intersects, it proves that the quadtree node can be seen by the camera view cone and needs to be submitted for rendering in the current frame; finally, traverse all quadtree nodes, execute the above process, and save a list of all nodes that intersect with the view cone for submission for rendering in this frame.

[0134] It should be noted that after explaining the quadtree and visibility judgment, the technical solution of the present application will be explained next, see Fig.11 , Fig.11 is a flow chart of the terrain coloring technology running on a mobile terminal provided by an embodiment of the present application, based on Fig.11The terrain coloring technology running on the mobile terminal provided in the embodiment of the application is implemented by steps 1101 to 1110. Specifically, firstly, the data of a frame of terrain image in the virtual scene is obtained; then, based on the data of the frame image, the quadtree node Node that is visible under the current observation camera is obtained; then, the LOD level of the corresponding Node is obtained, and the Mips level used by the corresponding Node is fitted with the LOD level of the corresponding Node. The fitting formula is shown in formula (1); then, the statistical information in the previous step is collected to obtain the texture level of all quadtree nodes required under the current camera perspective; then, based on all Nodes and their texture levels, the rendering data of each Node is obtained from the cache. When the rendering data of the Node can be obtained from the cache, it means that the currently requested Node has been cached and does not need to be calculated in the current frame. When the rendering data of the Node calculated based on the texture level cannot be obtained from the cache, it means that the cache is missing, that is, a block (target grid area) is allocated to the corresponding Node on Atlas for caching the rendering data calculated based on the texture level. (This Atlas is a RenderTarget, which can be simply understood as a picture), write the corresponding rendering data into the allocated block; finally, all the required Nodes and their texture levels of the current frame can find the corresponding blocks on the Atlas, read each block in the Atlas, and render the terrain based on the rendering data to obtain the terrain image.

[0135] It should be noted that the "cache" and "Atlas" here are the same concept, both referring to the intermediate results of the calculation. In this solution, Atlas is divided into blocks of the same size, and each block represents a different world range, that is, each block has the same resolution and contains the same number of pixels, but each pixel represents a different size of the world range. For example, see Fig.12 , Fig.12 is a schematic diagram of different blocks provided in the embodiment of the present application, based on Fig.12 , a indicates the cached result of a certain execution, that is, the cached Atlas, and b indicates the enlarged result of the four blocks. It can be clearly seen that the world ranges represented by these four blocks are different. The two blocks at the bottom have higher precision, the lower left is 1m*1m, and the lower right is 2m*2m. The upper left is 16m*16m, and the upper right is 8m*8m.

[0136] In this way, the texture parameters corresponding to each of the multiple three-dimensional grids in the virtual scene are directly determined by the graphics processor, and then the terrain of the virtual scene is rendered based on the texture parameters. Compared with the related technologies that mostly require graphics processor readback when rendering the terrain of the virtual scene, there is no need for GPU readback and no information lag problem, which improves the rendering efficiency when rendering the terrain of the virtual scene; at the same time, exquisite surface textures and rich surface details can be displayed on the mobile terminal, and adding rich details such as puddles, snow, wet gradients, roads, etc. to the surface will not affect the rendering efficiency, which provides a guarantee for improving the quality of the game and greatly enhances the player's gaming experience.

[0137] By using the above-mentioned embodiment of the present application, when determining the division level of each of the acquired multiple three-dimensional grids, the texture level of the three-dimensional grid is determined based on the division level, thereby obtaining the texture parameters of each three-dimensional grid during the rendering process based on the texture level of each three-dimensional grid, and rendering the multiple three-dimensional grids based on the texture parameters and the division level corresponding to the three-dimensional grid to obtain the target image. In this way, by directly determining the texture parameters corresponding to each of the multiple three-dimensional grids in the virtual scene, and then rendering the terrain of the virtual scene based on the texture parameters, the rendering efficiency when rendering the terrain of the virtual scene is improved.

[0138] The following is a description of an exemplary structure of a terrain rendering device 455 of a virtual scene provided in an embodiment of the present application implemented as a software module. In some embodiments, for example, Figure 2 As shown, the software modules stored in the terrain rendering device 455 of the virtual scene in the memory 450 may include:

[0139] An acquisition module 4551 is used to acquire a plurality of three-dimensional grids inside a viewing cone corresponding to a virtual scene, wherein the three-dimensional grids are obtained by dividing the three-dimensional terrain in the virtual scene;

[0140] A determination module 4552 is used to obtain, for each of the three-dimensional grids, a division level corresponding to the three-dimensional grid, and determine a texture level of the three-dimensional grid based on the division level;

[0141] The rendering module 4553 is used to obtain the texture parameters of each of the three-dimensional grids during the rendering process based on the texture level of each of the three-dimensional grids, and render the multiple three-dimensional grids based on the texture parameters and the division level corresponding to the three-dimensional grid to obtain a target image; wherein the target image is used to indicate, in the virtual scene, a terrain image within the field of view indicated by the viewing cone.

[0142] In some embodiments, the determination module 4552 is also used to obtain the target distance between the three-dimensional grid and the virtual light source corresponding to the virtual scene; select the target distance interval to which the target distance belongs from multiple distance intervals, each of the distance intervals corresponding to a division level; and determine the division level corresponding to the target distance interval as the division level corresponding to the three-dimensional grid.

[0143] In some embodiments, the determination module 4552 is further used to obtain a preset texture offset parameter; wherein the texture offset parameter is used to offset the texture level; and the texture level of the three-dimensional grid is determined in combination with the division level and the texture offset parameter.

[0144] In some embodiments, the determination module 4552 is also used to multiply the value of the division level with a reference value to obtain a product result; wherein the reference value is obtained by adding the value of the division level and a target value; performing square root processing on the product result to obtain a square root result; performing difference processing on the square root result and the value of the texture offset parameter to obtain the texture level of the three-dimensional grid.

[0145] In some embodiments, the acquisition module 4551 is also used to acquire multiple three-dimensional grids corresponding to the virtual scene and a viewing cone corresponding to the virtual scene; for each of the three-dimensional grids, the following processing is performed: an intersection detection is performed on the three-dimensional grid and the viewing cone, and when the ratio of the detection result representing the portion of the three-dimensional grid inside the viewing cone to the volume of the three-dimensional grid reaches a ratio threshold, the three-dimensional grid is determined as a three-dimensional grid inside the viewing cone corresponding to the virtual scene.

[0146] In some embodiments, the rendering module 4553 is also used to draw each of the three-dimensional grids in the target canvas based on the texture parameters of each of the three-dimensional grids and the division level corresponding to the three-dimensional grid to obtain rendering data of each of the three-dimensional grids; based on the rendering data of each of the three-dimensional grids, render the multiple three-dimensional grids to obtain a target image.

[0147] In some embodiments, the rendering module 4553 is also used to perform the following processing on each of the three-dimensional meshes: based on the division level of the three-dimensional mesh, allocating a target mesh area corresponding to the three-dimensional mesh on the target canvas corresponding to the virtual scene; based on the texture parameters of the three-dimensional mesh, obtaining the drawing resolution corresponding to the three-dimensional mesh, and based on the drawing resolution, drawing the three-dimensional mesh in the target mesh area to obtain rendering data of the three-dimensional mesh.

[0148] In some embodiments, the rendering module 4553 is also used to perform the following processing on each of the three-dimensional meshes: based on the division level of the three-dimensional mesh, determine the target mesh area corresponding to the three-dimensional mesh in the cache canvas; when the rendering data of the three-dimensional mesh is obtained from the target mesh area, use the obtained rendering data as the rendering data obtained by drawing the three-dimensional mesh in the target canvas; when the rendering data of the three-dimensional mesh is not obtained from the target mesh area, based on the texture parameters of the three-dimensional mesh, obtain the drawing resolution corresponding to the three-dimensional mesh, and based on the drawing resolution, draw the three-dimensional mesh in the target canvas to obtain the rendering data of the three-dimensional mesh.

[0149] In some embodiments, the device also includes a division module, which is used to obtain plane data and height data of the virtual scene; based on the plane data and the height data, the three-dimensional terrain of the virtual scene is determined, and the three-dimensional terrain is grid-divided to obtain multiple three-dimensional grids corresponding to the virtual scene; the acquisition module 4551 is also used to obtain multiple three-dimensional grids inside the viewing cone corresponding to the virtual scene from the multiple three-dimensional grids corresponding to the virtual scene.

[0150] In some embodiments, the division module is also used to grid the three-dimensional terrain to obtain a target number of initial three-dimensional grids; obtain the distance between each of the initial three-dimensional grids and the virtual light source corresponding to the virtual scene, and based on the distance, adjust the size of each of the initial three-dimensional grids to obtain a target three-dimensional grid; determine multiple target three-dimensional grids as multiple three-dimensional grids corresponding to the virtual scene; wherein the size of the target three-dimensional grid is positively correlated with the distance.

[0151] In some embodiments, the division module is also used to perform the following processing on each of the initial three-dimensional grids: taking the initial three-dimensional grid as the first three-dimensional grid, and obtaining the i-th distance threshold corresponding to the i-th three-dimensional grid; when the distance corresponding to the i-th three-dimensional grid is less than the i-th distance threshold, grid dividing the i-th three-dimensional grid to obtain the i+1-th three-dimensional grid; traversing i until the size of the i+1-th three-dimensional grid reaches the target size; wherein, i is a positive integer not less than 1 and not greater than N, and N is a preset positive integer.

[0152] The present application embodiment provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the terrain rendering method of the virtual scene or the training method of the three-dimensional network model described in the present application embodiment, for example, Figure 3 A terrain rendering method for a virtual scene is shown.

[0153] The present application embodiment provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the terrain rendering method of the virtual scene provided by the present application embodiment, for example, Figure 3 A terrain rendering method for a virtual scene is shown.

[0154] In some embodiments, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a CD-ROM; or it may be various devices including one or any combination of the above memories.

[0155] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0156] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0157] As an example, the executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0158] In summary, the embodiments of the present application have the following beneficial effects:

[0159] (1) By directly determining the texture parameters corresponding to each of the multiple three-dimensional grids in the virtual scene, and then rendering the terrain of the virtual scene based on the texture parameters, the rendering efficiency and rendering effect of the terrain of the virtual scene are improved.

[0160] (2) The texture parameters corresponding to each of the multiple three-dimensional grids in the virtual scene are directly determined by the graphics processor, and then the terrain of the virtual scene is rendered based on the texture parameters. Compared with the related art, when rendering the terrain of the virtual scene, most of them require the graphics processor to read back. There is no need for GPU read back, and there is no problem of information lag, which improves the rendering efficiency when rendering the terrain of the virtual scene; exquisite surface textures and rich surface details can be displayed on the mobile terminal. At the same time, adding rich details such as puddles, snow, wet gradients, roads, etc. on the surface will not affect the rendering efficiency, which provides a guarantee for the improvement of game quality and greatly enhances the player's gaming experience.

[0161] It should be noted that in the embodiments of the present application, data involving scene data, object operations, etc., when the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0162] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A terrain rendering method for a virtual scene, characterized in that: The method comprises: Acquire a plurality of three-dimensional grids inside a viewing cone corresponding to a virtual scene, wherein the three-dimensional grids are obtained by dividing the three-dimensional terrain in the virtual scene; For each of the three-dimensional grids, obtaining a division level corresponding to the three-dimensional grid, and determining a texture level of the three-dimensional grid based on the division level; Based on the texture level of each of the three-dimensional grids, acquiring a texture parameter of each of the three-dimensional grids during the rendering process, and rendering the multiple three-dimensional grids based on the texture parameter and the division level corresponding to the three-dimensional grid to obtain a target image; The target image is used to indicate, in the virtual scene, a terrain image within the field of view indicated by the viewing cone.

2. The method according to claim 1, characterized in that The obtaining of the division level corresponding to the three-dimensional grid includes: Acquire a target distance between the three-dimensional grid and a virtual light source corresponding to the virtual scene; Selecting a target distance interval to which the target distance belongs from a plurality of distance intervals, each of the distance intervals corresponding to a classification level; The division level corresponding to the target distance interval is determined as the division level corresponding to the three-dimensional grid.

3. The method according to claim 1, characterized in that The step of determining the texture level of the three-dimensional mesh based on the division level includes: Acquire a preset texture offset parameter; wherein the texture offset parameter is used to offset the texture level; The texture level of the three-dimensional mesh is determined in combination with the division level and the texture offset parameter.

4. The method according to claim 3, characterized in that The step of determining the texture level of the three-dimensional mesh by combining the division level and the texture offset parameter includes: The value of the classification level is multiplied by a reference value to obtain a product result; wherein the reference value is obtained by adding the value of the classification level to a target value; Performing a square root processing on the product result to obtain a square root result; The square root result is subtracted from the value of the texture offset parameter to obtain the texture level of the three-dimensional grid.

5. The method according to claim 1, characterized in that The step of obtaining a plurality of three-dimensional grids inside a viewing cone corresponding to the virtual scene includes: Acquire a plurality of three-dimensional grids corresponding to the virtual scene and a viewing cone corresponding to the virtual scene; For each of the three-dimensional grids, the following processing is performed: An intersection check is performed on the three-dimensional grid and the viewing cone, and when a ratio of a portion of the three-dimensional grid inside the viewing cone represented by a detection result to the volume of the three-dimensional grid reaches a ratio threshold, the three-dimensional grid is determined to be a three-dimensional grid inside the viewing cone corresponding to the virtual scene.

6. The method according to claim 1, characterized in that The rendering of the plurality of three-dimensional grids based on the texture parameters and the division levels corresponding to the three-dimensional grids to obtain a target image includes: Based on the texture parameters of each of the three-dimensional meshes and the division level corresponding to the three-dimensional meshes, drawing each of the three-dimensional meshes in a target canvas to obtain rendering data of each of the three-dimensional meshes; The plurality of three-dimensional grids are rendered based on the rendering data of each of the three-dimensional grids to obtain a target image.

7. The method according to claim 6, characterized in that The step of drawing each of the three-dimensional meshes in a target canvas based on the texture parameters of each of the three-dimensional meshes and the division level corresponding to the three-dimensional meshes to obtain rendering data of each of the three-dimensional meshes includes: The following processing is performed on each of the three-dimensional grids: Based on the division level of the three-dimensional grid, allocating a target grid area corresponding to the three-dimensional grid on a target canvas corresponding to the virtual scene; Based on the texture parameters of the three-dimensional mesh, a drawing resolution corresponding to the three-dimensional mesh is obtained, and based on the drawing resolution, the three-dimensional mesh is drawn in the target mesh area to obtain rendering data of the three-dimensional mesh.

8. The method according to claim 6, characterized in that The step of drawing each of the three-dimensional meshes in a target canvas based on the texture parameters of each of the three-dimensional meshes and the division level corresponding to the three-dimensional meshes to obtain rendering data of each of the three-dimensional meshes includes: The following processing is performed on each of the three-dimensional grids: Determine, based on the division level of the three-dimensional grid, a target grid area corresponding to the three-dimensional grid in the cache canvas; When the rendering data of the three-dimensional mesh is acquired from the target mesh area, the acquired rendering data is used as rendering data obtained by drawing the three-dimensional mesh in the target canvas; When rendering data of the three-dimensional mesh is not obtained from the target mesh area, a drawing resolution corresponding to the three-dimensional mesh is obtained based on texture parameters of the three-dimensional mesh, and based on the drawing resolution, the three-dimensional mesh is drawn in a target canvas to obtain rendering data of the three-dimensional mesh.

9. The method according to claim 1, characterized in that The method further comprises: Acquiring plane data and height data of the virtual scene; Determine the three-dimensional terrain of the virtual scene based on the plane data and the height data, and perform grid division on the three-dimensional terrain to obtain a plurality of three-dimensional grids corresponding to the virtual scene; The step of obtaining a plurality of three-dimensional grids inside a viewing cone corresponding to the virtual scene includes: From the multiple three-dimensional grids corresponding to the virtual scene, multiple three-dimensional grids inside the viewing cone corresponding to the virtual scene are obtained.

10. The method according to claim 9, characterized in that The step of meshing the three-dimensional terrain to obtain a plurality of three-dimensional grids corresponding to the virtual scene includes: Mesh the three-dimensional terrain to obtain the target number of initial three-dimensional grids; Acquire the distance between each of the initial three-dimensional grids and the virtual light source corresponding to the virtual scene, and adjust the size of each of the initial three-dimensional grids based on the distance to obtain a target three-dimensional grid; Determine the plurality of target three-dimensional grids as a plurality of three-dimensional grids corresponding to the virtual scene; The size of the target three-dimensional grid is positively correlated with the distance.

11. The method according to claim 10, characterized in that The step of resizing each of the initial three-dimensional grids based on the distance to obtain a target three-dimensional grid includes: The following processing is performed for each of the initial three-dimensional grids: Taking the initial three-dimensional grid as the first three-dimensional grid, and obtaining an i-th distance threshold corresponding to the i-th three-dimensional grid; When the distance corresponding to the i-th three-dimensional grid is less than the i-th distance threshold, meshing the i-th three-dimensional grid to obtain an (i+1)-th three-dimensional grid; Traverse i until the size of the (i+1)th three-dimensional grid reaches the target size; Wherein, i is a positive integer not less than 1 and not greater than N, and N is a preset positive integer.

12. A terrain rendering device for a virtual scene, characterized in that: The device comprises: An acquisition module, used to acquire a plurality of three-dimensional grids inside a viewing cone corresponding to a virtual scene, wherein the three-dimensional grids are obtained by dividing the three-dimensional terrain in the virtual scene; A determination module, configured to obtain, for each of the three-dimensional grids, a division level corresponding to the three-dimensional grid, and determine a texture level of the three-dimensional grid based on the division level; A rendering module is used to obtain texture parameters of each of the three-dimensional grids during the rendering process based on the texture level of each of the three-dimensional grids, and render the multiple three-dimensional grids based on the texture parameters and the division level corresponding to the three-dimensional grid to obtain a target image; wherein the target image is used to indicate, in the virtual scene, a terrain image within the field of view indicated by the viewing cone.

13. An electronic device, characterized in that: include: A memory for storing executable instructions; A processor is used to implement the terrain rendering method of a virtual scene as described in any one of claims 1 to 11 when executing the executable instructions stored in the memory.

14. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to cause the processor to execute and implement the terrain rendering method of the virtual scene described in any one of claims 1 to 11.

15. A computer program product comprising a computer program or computer executable instructions, characterized in that: When the computer program or computer executable instruction is executed by a processor, the terrain rendering method of a virtual scene as described in any one of claims 1 to 11 is implemented.

Citation Information

Cited By

  • Virtual scene real-time rendering method and system for enhancing immersion

    CN119991858A

  • Texture fitting mode, device and equipment and computer readable storage medium

    CN121505130A

  • Scene resource packet generation method and device, equipment and medium

    CN122152541A