Volume rendering method, device, storage medium and computer equipment

Through the optimization of voxelization and sampling data, the problem of high computing and resource consumption in intelligent mobile terminals is solved, efficient rendering is achieved, and game performance and player experience are improved.

CN112138386BActive Publication Date: 2024-12-03NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011017777.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-24
Publication Date
2024-12-03
Estimated Expiration
2040-09-24

AI Technical Summary

Technical Problem

When using ray tracing for rendering in smart mobile terminals, the calculation amount and resource consumption are too large, resulting in delay and performance problems, affecting the player's experience.

Method used

By voxeling the model to be rendered into voxel grids and dividing the pixel map area into blocks, the volume sampling data is obtained using the sampling camera to reduce the number of sampling times and storage requirements, and reduce the calculation amount and memory consumption.

Benefits of technology

It significantly reduces the computing and storage needs of sampled data, improves performance, and can effectively render high-quality images on lightweight devices, improving player experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112138386B_ABST
    Figure CN112138386B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a volume rendering method, device, storage medium and computer equipment. The method comprises: voxelizing a model to be rendered into a plurality of voxel grids; dividing a pixel map area with a predetermined resolution so that the pixel map area is divided into a predetermined number of blocks; and dividing any vertex N of each block obtained by the division. i The position of is mapped to the position P of each sampling camera in the three-dimensional coordinate system for volume sampling of the voxel grid j ; At any vertex N of each block i The position of the vertex N is saved i Mapped position P j The volume sampling data obtained by the sampling camera is matched according to the viewing angle of the rendering camera, and then the model to be rendered is rendered. The technical solution of the present application greatly reduces the amount of calculation on the sampling data, and also significantly saves memory and video memory resources, and can be applied to lightweight devices such as mobile terminals.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, in particular to the field of electronic games, and specifically to a volume rendering method, apparatus, storage medium and computer equipment. Background Art

[0002] In the field of computer image processing, ray tracing is a volume rendering technique that generates images by tracing the path of light in units of pixels in the pixel plane and simulating the effect of its encounter with virtual objects. Compared with the scanline rendering method, ray tracing can produce a high degree of visual realism and is widely used in computer-generated still images and film and television visual effects.

[0003] With the rapid development of mobile Internet, many games can be run on smart mobile terminals. Players are pursuing higher and higher visual effects in games, and they hope to experience the visual effects of movies and TV shows in games. In order to meet the players' pursuit, many game companies try to use ray tracing, a volume rendering technology, in games.

[0004] However, a prominent feature of ray tracing is its huge computational overhead. Using ray tracing for rendering in lightweight devices such as smart mobile terminals means higher latency, which may bring a bad experience to players, such as screen freezes. Summary of the invention

[0005] The embodiments of the present application provide a volume rendering method, apparatus, storage medium and computer equipment, which can reduce the computational overhead and the consumption of resources such as memory and video memory.

[0006] The present application embodiment provides a volume rendering method, including:

[0007] Voxelize the model to be rendered into a number of voxel grids;

[0008] Dividing a pixel map area having a predetermined resolution so that the pixel map area is divided into a predetermined number of blocks;

[0009] Set any vertex N of the block i The position of is mapped to the position P of each sampling camera in the three-dimensional coordinate system for volume sampling of the voxel grid i The volume sampling data obtained by volume sampling includes the cumulative concentration d of the voxel grid obtained along the sampling direction of the sampling camera, the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d ;

[0010] At the vertex N i The position P is saved ini Upsampling the volume sampling data obtained by the camera;

[0011] According to the viewing angle of the rendering camera, the model to be rendered is rendered after matching the volume sampling data acquired by the sampling camera.

[0012] Optionally, after dividing the pixel map area with a predetermined resolution into a predetermined number of blocks, the method further comprises: mapping the predetermined number of blocks divided into the pixel map area to a square area centered at the origin of the two-dimensional coordinate system; recording the vertex N of each block. i The coordinates (x i ,y i ).

[0013] Optionally, any vertex N of the block i The position of is mapped to the position P of each sampling camera in the three-dimensional coordinate system for volume sampling of the voxel grid i , including: placing the vertex N i The position is mapped to a viewpoint on the spherical surface of the hemisphere, and the viewpoint is the position P of the sampling camera i The hemisphere serves as the starting point of the sampling direction of the sampling camera for volume sampling of the voxel grid, and the hemisphere can at least surround the model to be rendered.

[0014] Optionally, the vertex N i The position of is mapped to a viewpoint on the spherical surface of the hemisphere, including: obtaining the vertex N i The coordinate x i With y i The mean value E1 of the sum, and the coordinate x i With y i The mean value E2 of the difference between them; using E1-0.5, 1-|E1|-|E2| and E2 as parameters of the normalization function, the function value of the normalization function is obtained, and the function value is used as the coordinate of the viewpoint in the three-dimensional coordinate system (p x , p y , p z ).

[0015] Optionally, at the vertex N i The position P is saved in i The volume sampling data obtained by the upsampling camera includes: at the vertex N i The pixel map corresponding to the position P i The cumulative concentration d of the voxel grid obtained by the upsampling camera and the forward depth f of the voxel grid d and the inverse depth b of the voxel gridd The R channel value, G channel value and B channel value of the RGB channels of the pixel map are respectively stored.

[0016] Optionally, the rendering of the model to be rendered after matching the volume sampling data obtained by the sampling camera according to the viewing angle of the rendering camera includes: obtaining the texture coordinates (U, V) in the current vector state according to the current vector of the rendering camera and the inverse world matrix of the model to be rendered; matching the texture coordinates (U, V) with the vertices of each block; if the texture coordinates (U, V) can match the coordinates (x i ,y i ) matches, then select the coordinate (x i ,y i ) corresponds to vertex N i as a rendering resource; and calculating color information after the pixel map and the scene are fused according to the illumination data on the voxel grid and the volume sampling data of the rendering resource, wherein the scene is the scene where the model to be rendered is located.

[0017] Optionally, the step of calculating the color information of the pixel map after fusion with the scene according to the illumination data on the voxel grid and the volume sampling data of the rendering resource comprises: i The depth of the pixel map, the depth of the scene and the radius of the hemisphere, and calculate d' according to the Beer-Lambert formula and the Henyey-Greestein formula, at the position P i The scattered light energy L of the upsampled voxel b and projected light energy L hg , the hemisphere is the vertex N i The position map is the position P i is used to surround the hemisphere of the model to be rendered, and d' is the hemisphere at the position P i The percentage of the accumulated concentration of the upsampled voxel grid remaining after the scene is cut; according to the formula C = S1*L b *L hg *d' calculates the color information after the pixel map is fused with the scene, and S1 is the brightness irradiated to the model to be rendered.

[0018] The present application also provides a volume rendering device, including:

[0019] A voxelization module, used to voxelize the model to be rendered into a number of voxel grids;

[0020] A tile block division module, used to divide a pixel tile area with a predetermined resolution into a predetermined number of tiles;

[0021] A mapping module is used to map any vertex N of the block i The position of is mapped to the position P of each sampling camera in the three-dimensional coordinate system for volume sampling of the voxel grid i The volume sampling data obtained by volume sampling includes the cumulative concentration d of the voxel grid obtained along the sampling direction of the sampling camera, the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d ;

[0022] The data storage module is used to store the data at the vertex N i The position P is saved in i Upsampling the volume sampling data obtained by the camera;

[0023] The rendering module is used to render the model to be rendered after matching the volume sampling data acquired by the sampling camera according to the viewing angle of the rendering camera.

[0024] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the steps in the volume rendering method described in any of the above embodiments.

[0025] An embodiment of the present application also provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the steps in the volume rendering method described in any of the above embodiments by calling the computer program stored in the memory.

[0026] From the technical solution provided by the above embodiment of the present application, it can be seen that, on the one hand, since any vertex N in the pixel map area is divided into a number of blocks i The position of i The sampling camera is used to perform volume sampling on the voxel grid to obtain the cumulative concentration d and forward depth f of the voxel grid. d and reverse depth b d When ray tracing is used, each pixel only needs to be sampled 6 times at most, while the ray tracing rendering solution needs to sample more than dozens of times during volume sampling. Therefore, the solution of the present application greatly reduces the amount of calculation on the sampling data. On the other hand, compared with the amount of pixels required to be recorded in a massive amount of memory when using ray tracing and 3D mapping (i.e., the cube of the pixels of each map), the technical solution of the present application only needs to process the volume sampling data corresponding to the map at the vertex of each block. The amount of these volume sampling data is several orders of magnitude less than the amount of data using ray tracing technology. Therefore, it significantly saves memory and video memory resources and can be applied to lightweight devices such as mobile terminals. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0028] Figure 1 A schematic diagram of an application scenario of the volume rendering device provided in an embodiment of the present application.

[0029] Figure 2 A schematic diagram of a flow chart of a volume rendering method provided in an embodiment of the present application.

[0030] Figure 3 A schematic diagram of a torus provided in an embodiment of the present application being voxelized into a voxel grid.

[0031] Figure 4a This is a schematic diagram of a doll model provided in an embodiment of the present application.

[0032] Figure 4b The embodiment of the present application provides a voxelization method in which a bounding box is used to "enclose" the attached Figure 4a Schematic diagram of the example doll model.

[0033] Figure 5 A schematic diagram of dividing a pixel map area into 25 blocks provided in an embodiment of the present application.

[0034] Figure 6 The embodiments of the present application provide Figure 5 A diagram showing how the vertices of each block are numbered starting from 0 after the 25 blocks are mapped to a square area with a side length of 2 and a center at the origin of the 2D coordinate system.

[0035] Figure 7 The embodiment of the present application provides Figure 6 The 36 vertices of the example are mapped to 36 viewpoints on the spherical surface of the hemisphere.

[0036] Figure 8 This is a schematic diagram of a sampling camera on the spherical surface of a hemisphere provided in an embodiment of the present application sampling a model enclosed by the hemisphere.

[0037] Fig. 9 A vertex N provided in the embodiment of the present application i The depth p of the pixel map at d , the depth w of the scene where the model to be rendered is located d 、Position P j The forward depth f of the voxel grid sampled atd and the inverse depth b of the voxel d Schematic diagram of .

[0038] Fig.10 A schematic diagram of the structure of a volume rendering device provided in an embodiment of the present application.

[0039] Fig.11 A schematic structural diagram of a volume rendering device provided in another embodiment of the present application.

[0040] Fig.12 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0042] The embodiments of the present application provide a volume rendering method, apparatus, storage medium and computer equipment. Specifically, the volume rendering method of the embodiments of the present application can be executed by a computer device, wherein the computer device can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (Personal Digital Assistant, PDA), etc. The terminal can also include a client, which can be a game application client, a browser client carrying a game program, or an instant messaging client, etc. The server can 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, CDN, and big data and artificial intelligence platforms.

[0043] For example, when the volume rendering method is run on a terminal, the terminal device stores a game application and is used to present a virtual scene in the game screen. The terminal device is used to interact with the user through a graphical user interface, for example, the game application is downloaded and installed through the terminal device and run. The terminal device may provide the graphical user interface to the user in a variety of ways, for example, it may be rendered and displayed on the display screen of the terminal device, or the graphical user interface may be presented through holographic projection. For example, the terminal device may include a touch display screen and a processor, the touch display screen is used to present the graphical user interface and receive operation instructions generated by the user acting on the graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate the graphical user interface, respond to the operation instructions, and control the display of the graphical user interface on the touch display screen.

[0044] For example, when the volume rendering method is run on a server, it can be a cloud game. Cloud gaming refers to a gaming method based on cloud computing. In the operation mode of cloud gaming, the operating body of the game application and the main body of the game screen presentation are separated, and the storage and operation of the volume rendering method are completed on the cloud gaming server. The game screen presentation is completed on the client of the cloud gaming. The cloud gaming client is mainly used for receiving and sending game data and presenting the game screen. For example, the cloud gaming client can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, a personal digital assistant, etc., but the terminal device for processing game data is a cloud gaming server in the cloud. When playing the game, the user operates the cloud gaming client to send an operation instruction to the cloud gaming server. The cloud gaming server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the cloud gaming client through the network. Finally, the cloud gaming client decodes and outputs the game screen.

[0045] See also Figure 1 , Figure 1Schematic diagram of application scenarios of the volume rendering device provided in the embodiment of the present application. The system may include at least one terminal 1000, at least one server 2000, at least one database 3000, and a network 4000. The terminal 1000 held by the user can be connected to the servers of different games through the network 4000. The terminal 1000 is any device with computing hardware that can support and execute software products corresponding to the game. In addition, the terminal 1000 has one or more multi-touch screens for sensing and obtaining the input of the user through touch or sliding operations performed at multiple points on one or more touch-sensitive display screens. In addition, when the system includes multiple terminals 1000, multiple servers 2000, and multiple networks 4000, different terminals 1000 can be connected to each other through different networks 4000 and different servers 2000. The network 4000 can be a wireless network or a wired network, such as a wireless network such as a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc. In addition, different terminals 1000 can also use their own Bluetooth network or hotspot network to connect to other terminals or to servers, etc. For example, multiple users can be online through different terminals 1000 and connected and synchronized with each other through appropriate networks to support multi-player games. In addition, the system may include multiple databases 3000, which are coupled to different servers 2000, and information related to the game environment can be continuously stored in the databases 3000 when different users are online playing multi-player games.

[0046] The embodiment of the present application provides a volume rendering method, which can be executed by a terminal or a server. The embodiment of the present application takes the volume rendering method executed by a terminal as an example for explanation. Among them, the terminal includes a touch display screen and a processor, and the touch display screen is used to present a graphical user interface and receive an operation instruction generated by a user acting on the graphical user interface. When the user operates the graphical user interface through the touch display screen, the graphical user interface can control the local content of the terminal by responding to the received operation instruction, and can also control the content of the opposite server by responding to the received operation instruction. For example, the operation instruction generated by the user acting on the graphical user interface includes an instruction for starting a game application, and the processor is configured to start the game application after receiving the instruction to start the game application provided by the user. In addition, the processor is configured to render and draw a graphical user interface associated with the game on the touch display screen. The touch display screen is a multi-touch sensitive screen that can sense touch or sliding operations performed simultaneously at multiple points on the screen. The user performs a touch operation on the graphical user interface using a finger, and when the graphical user interface detects the touch operation, the different virtual objects in the graphical user interface of the game are controlled to perform actions corresponding to the touch operation. For example, the game can be any of the games such as casual games, action games, role-playing games, strategy games, sports games, puzzle games, etc. Among them, the game can include a virtual scene of the game drawn on a graphical user interface. In addition, the virtual scene of the game can include one or more virtual objects controlled by a user (or player), such as a virtual character. In addition, the virtual scene of the game can also include one or more obstacles, such as railings, gullies, walls, etc., to limit the movement of virtual objects, such as limiting the movement of one or more objects to a specific area within the virtual scene. Optionally, the virtual scene of the game also includes one or more elements, such as skills, scores, character health status, energy, etc., to provide help to players, provide virtual services, increase scores related to player performance, etc. In addition, the graphical user interface can also present one or more indicators to provide indication information to the player. For example, the game can include a virtual object controlled by a player and one or more other virtual objects (such as an enemy character). In one embodiment, one or more other virtual objects are controlled by other players of the game. For example, one or more other virtual objects can be controlled by a computer, such as a robot using an artificial intelligence (AI) algorithm, to achieve a man-machine battle mode. For example, a virtual object has various skills or abilities that game players use to achieve their goals. For example, a virtual object has one or more weapons, props, tools, etc. that can be used to eliminate other objects from the game. Such skills or abilities can be activated by a game player using one of a plurality of preset touch operations with the touch display screen of the terminal. The processor can be configured to present a corresponding game screen in response to an operation instruction generated by the user's touch operation.

[0047] See also Figure 2 , is a flow chart of the volume rendering method provided in an embodiment of the present application, which mainly includes steps S201 to S205, and is described in detail as follows:

[0048] Step S201, voxelize the model to be rendered into a plurality of voxel grids.

[0049] Voxel is the abbreviation of volume element. Voxel is essentially the 3D version of pixel. Each voxel has a position and related attributes in 3D space. Voxelization is the process of filling the interior of an object with a certain geometric body. In other words, voxelization is the process of cutting an object into a grid of volume elements, i.e., voxel grid. Figure 3 , is an example of a torus being voxelized into voxel grids (the voxel grids in the figure are small cubes). Voxelization is usually regarded as a preliminary work or a necessary process for volume sampling. In an embodiment of the present application, when voxelizing the model to be rendered into voxel grids, it is possible to first find a bounding box of the model, and then cut the length, width and height of the bounding box with a certain step size. Usually, only three parameters need to be input into the voxel generator, namely the model to be voxelized, the spatial mode (i.e., world space or local space) and the density of the bounding box. As shown in the attached figure Figure 4a As shown, it is a doll model to be rendered. Figure 4b Given a voxelization, a bounding box is used to "surround" the attached Figure 4a The figure model of the example is shown in the figure model diagram. The bounding box is a cube. It should be noted that the bounding box can be any geometric body that surrounds a model. Figure 4b It cannot be regarded as a limitation on the selection of the bounding box of the technical solution of the present application.

[0050] Step S202, dividing the pixel map area with a predetermined resolution into a predetermined number of blocks.

[0051] The pixel map (volume texture) area is a two-dimensional display plane that is projected as an image after the sampling camera performs volume sampling on the three-dimensional model during volume rendering. The two-dimensional display plane has a predetermined resolution, such as 1024 pixels. In the embodiment of the present application, the pixel map area with a predetermined resolution is divided into a predetermined number of blocks. Figure 5 As shown in FIG. 1 , it is an example of dividing the pixel map area into 5*5=25 blocks. Obviously, under the premise of a certain resolution of the pixel map area, the more blocks the pixel map area is divided into, the lower the resolution of the area contained in each block. Figure 5In the example division method, the resolution of each block is 1024 / 25. If the pixel map area is divided into 8*8=64 blocks, the resolution of each block is 1024 / 64 when the resolution of the pixel map area is still 1024 pixels.

[0052] For the convenience of subsequent calculations, in the embodiment of the present application, after dividing the pixel map area with a predetermined resolution into a predetermined number of blocks, the pixel map area can also be divided into a predetermined number of blocks and mapped to a square area centered at the origin of the two-dimensional coordinate system (for example, the side length of the square area is 2), and the vertex N of each block is recorded. i The coordinates of the square area (x i ,y i ), that is, a predetermined number of blocks are mapped to a square area centered at the origin of the two-dimensional coordinate system and surrounded by coordinates (1, 1), (-1, 1), (-1, -1) and (1, -1), and any vertex N of each block i The coordinates of the square area (x i ,y i ) can be determined according to the number of blocks and the position of the blocks in the square area. Further, the vertices of these blocks can also be numbered, as shown in the attached figure. Figure 6 As shown, it is attached Figure 5 After the 25 blocks in the example are mapped to a square area with a side length of 2 and a center at the origin of the two-dimensional coordinate system, the vertices of each block are numbered starting from 0. 35 is the number of the last vertex (due to the overlap of vertices of adjacent blocks, there are actually only 36 vertices in the 25 blocks instead of 100 vertices that need to be numbered).

[0053] Step S203: any vertex N of each block obtained by segmentation in step S202 i The position of is mapped to the position P of each sampling camera in the three-dimensional coordinate system for volume sampling of the voxel grid j , where the volume sampling data obtained by volume sampling includes the cumulative concentration d of the voxel grid obtained along the sampling direction of the sampling camera, the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d .

[0054] Considering that the required volume sampling data may be collected through fewer sampling positions, and facilitating subsequent calculations, in the embodiment of the present application, any vertex N of each block obtained by segmentation in step S202 is i The position of is mapped to the position P of each sampling camera in the three-dimensional coordinate system for volume sampling of the voxel grid j It can be: Vertex Ni The position is mapped to a viewpoint on the spherical surface of the hemisphere, which is the position of the sampling camera P j And as the starting point of the sampling direction of the sampling camera for volume sampling of the voxel grid, the hemisphere can at least surround the model to be rendered. Figure 7 As shown, it is the attached Figure 6 The 36 vertices of the 25 blocks in the example are mapped to a schematic diagram of 36 viewpoints on the spherical surface of the hemisphere. These viewpoints are the positions of the sampling cameras used for volume sampling of the model to be rendered; if the position is recorded as P j , then point P j It is also the starting point of the sampling direction of the sampling camera for volume sampling of the voxel grid. Figure 8 It is a schematic diagram of a sampling camera on the spherical surface of a hemisphere sampling a model (the model is a tree) enclosed by the hemisphere.

[0055] As an embodiment of the present application, vertex N i The position of the hemisphere is mapped to a viewpoint on the spherical surface of the hemisphere, which can be obtained by finding the vertex N i The coordinate x i With y i The mean value E1 of the sum and the coordinate x i With y i Then, using E1-0.5, 1-|E1|-|E2| and E2 as the parameters of the normalization function, the function value of the normalization function is obtained, and the function value is used as the coordinate of the viewpoint in the three-dimensional coordinate system (p x , p y , p z ), that is, E1=(x i +y i ) / 2…………(Formula 1)

[0056] E2=(x i -y i ) / 2…………(Formula 2)

[0057] Call the normalization function normalize(x, y, z), pass E1-0.5, 1-|E1|-|E2| and 1-|E1|-|E2| to parameters x, y and z respectively, and return the value as the viewpoint P j That is, the sampling camera (p x , p y , p z ), that is: (p x , p y , p z )=normalize(E1-0.5, 1-|E1|-|E2|, 1-|E1|-|E2|)……(Formula 3)

[0058] The prototype of the above normalization function normalize(x, y, z) is normalize

[0059] It should be noted that if the model to be rendered is placed in a way that its center (the center of the model to be rendered is also the center of the bounding box) coincides with the center of the hemisphere (which can be the origin of the three-dimensional coordinate system), according to the above formulas 1, 2 and 3, the bounding box is Figure 6 The example cube's vertices are mapped to the attached Figure 7 For example, the viewpoint on the spherical surface of the hemisphere, the sampling direction of the sampling camera for volume sampling of the voxel grid should be from the position of the sampling camera, that is, the viewpoint P j Points to the center of the hemisphere.

[0060] Step S204: at any vertex N of each block i The position of the vertex N is saved i Mapped position P j The volume sampling data obtained by the sampling camera at .

[0061] As an embodiment of the present application, at any vertex N of each block i The position of the vertex N is saved i Mapped position P j The volume sampling data obtained by the sampling camera at the vertex N can be: i On the pixel map corresponding to the position, the position P j The cumulative concentration d of the voxel grid obtained by the sampling camera at the voxel grid and the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d The R channel value, G channel value, and B channel value of the RGB channel of the pixel map are stored respectively. j It is composed of vertex N i The position is mapped from, and each vertex N i As attached Figure 6 So, we can get the position P j Get the corresponding vertex N i The position can be at the vertex N i On the pixel map corresponding to the position, the position P j The cumulative concentration d of the voxel grid obtained by the sampling camera at the voxel grid and the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d Assign values ​​to the R channel, G channel and B channel of the RGB channel of the pixel map respectively. It should be noted that due to the position P j It is composed of vertex N i , so for the attached Figure 6 and attached Figure 7 , even if they have the same number, it does not mean that the vertices with the same number correspond to the viewpoints, for example, Figure 6 The vertex numbered 6 in the example may not be mapped to the attached Figure 7 The viewpoint numbered 6 on the hemisphere of the example.

[0062] Step S205 , rendering the model to be rendered after matching the volume sampling data acquired by the sampling camera according to the viewing angle of the rendering camera.

[0063] The rendering camera's viewpoint is represented by the vector V w Determine, vector V w It is a three-dimensional vector with the direction from the geometric center of the model to be rendered to the direction of the rendering camera and the distance from the geometric center of the model to be rendered to the rendering camera as the size. When the viewing angle of the rendering camera is changed, that is, the vector V w Different texture coordinates (U, V) can be obtained. If the texture coordinates can correspond to the corresponding vertex N i The coordinates (x i ,y i ) matches, which is equivalent to selecting the map at this point. Specifically, step S205 can be implemented by the following steps S2051 to S2054:

[0064] Step S2051: According to the current vector of the rendering camera and the inverse world matrix of the model to be rendered, the texture coordinates (U, V) under the current vector state are obtained.

[0065] Assume that the inverse world matrix of the model to be rendered is represented by InvWorld, and the current vector of the rendering camera is as described above, using the vector V w Indicates that V w Multiply it with InvWorld to get a three-dimensional intermediate vector Vo. Let Vo = {Vo.x, Vo.y, Vo.z}. Further, calculate Px = Vo.x / [abs(Vo.x)+abs(Vo.y)+abs(Vo.z)], Py = Vo.z / [abs(Vo.x)+abs(Vo.y)+abs(Vo.z)], where abs(Vo.x), abs(Vo.y) and abs(Vo.z) represent the absolute values ​​of Vo.x, Vo.y and Vo.z respectively. The mapping coordinates (U, V) in the current vector state are determined by Px and Py, that is, U = P.x+Py, V = Px-Py.

[0066] Step S2052: Match the texture coordinates (U, V) with the vertices of each block.

[0067] The texture coordinates (U, V) belong to the coordinates in the two-dimensional coordinate system. The blocks are the blocks divided in step S202. Any vertex N of these blocks i Use coordinates (x i ,y i ) represents. The texture coordinates (U, V) calculated in step S2051 are matched with the vertices of each block, that is, U, that is, P.x+Py, is matched with x i 、V is Px-Py and y i Compare.

[0068] Step S2053: If the texture coordinates (U, V) match the coordinates (x i ,y i ) matches, then select the coordinate (x i ,y i ) corresponds to vertex N i The pixel map at is used as the rendering resource.

[0069] It should be noted that in the embodiment of the present application, the so-called mapping coordinates (U, V) can be the same as the coordinates (x i ,y i ) does not mean that U matches x i , V and y i Just equal, but two thresholds δ can be preset x With δ y (δ x With δ y are positive numbers), if U and x i The absolute difference is |Ux i |In [0,δ x ] and / or between V and y i The absolute difference is |Vy i |In [0,δ y ], then determine that the texture coordinates (U, V) can be aligned with the coordinates (x i ,y i )match.

[0070] The texture coordinates (U, V) and the coordinates of the square area (x i ,y i ) matching process, that is, the process of selecting the pixel map at the vertex of the small square. Figure 6 For the example blocks and vertices, if the texture coordinates (U, V) of the rendering camera in a certain vector state, i.e., a certain viewing angle, and the coordinates (x 16 ,y 16) matches, the pixel map at the vertex numbered 16 is selected as the rendering resource. When the rendering camera's viewing angle is continuously changed, the attached pixels can be Figure 6 Example pixel tiles at 36 vertices Figure 1 One matches.

[0071] Step S2054: Calculate vertex N according to the lighting data on the voxel grid and the volume sampling data of the rendering resource. i The color information after the pixel map at the location is merged with the scene where the model to be rendered is located.

[0072] Rendering a model is essentially to obtain the color information of the model after it is placed in a scene and after the model is merged with the scene. In the embodiment of the present application, after the color information of the pixel map at each vertex and the scene where the model to be rendered is merged is calculated, the color information of the model to be rendered and the scene where it is merged is obtained. Specifically, according to the illumination data on the voxel grid and the volume sampling data of the rendering resource, the color information of the vertex N is calculated. i The color information after the pixel map at the location is fused with the scene where the model to be rendered is located can be realized by the following steps S1 and S2:

[0073] Step S1: According to vertex N i The depth of the pixel map at position P, the depth of the scene where the model to be rendered is located, and the radius of the hemisphere, and d' is calculated according to the Beer-Lambert formula and the Henyey-Greestein formula. j The scattered light energy L of the voxel sampled at b and projected light energy L hg .

[0074] The hemisphere here is vertex N i The position is mapped to position P j The hemisphere used to surround the model to be rendered is shown in the following figure. Figure 7 The hemisphere shown, d' is at position P j The percentage of the accumulated concentration of the upsampled voxel grid remaining after the scene is cut. i The depth of the pixel map at is p d , the depth of the scene where the model to be rendered is w d , a vertex N i The depth p of the pixel map at d , the depth w of the scene where the model to be rendered is located d 、Position P j The forward depth f of the voxel grid sampled at d and the inverse depth b of the voxel d As attached Fig. 9 As shown. According to vertex N iThe depth p of the pixel map at d , the depth w of the scene where the model to be rendered is located d and the radius R of the hemisphere, and calculate d' according to the Beer-Lambert formula and the Henyey-Greestein formula, at position P j The scattered light energy L of the voxel sampled at b and projected light energy L hg as follows:

[0075] L d =p d +(f d -0.5)×Rw d …………(Formula 4)

[0076] T d =[f d -(1-b d )]×R…………(Formula 5)

[0077] T in the above formula 5 d For position P j The total volume depth of the upsampled voxel grid.

[0078] d'=d×L d / T d …………(Formula 6)

[0079] In the above formula 6, d is the position P j The accumulated concentration of the upsampled voxel grid.

[0080] L b =e -d' …………(Formula 6)

[0081] L hg =2(1-g 2 ) / pow(1+g 2 -2×g×LoV, 1.5)…………(Formula 7)

[0082] In the above formula 8, the prototype of the function pow(x, y) is pow(x, y) = x y , LoV is the dot product of the illumination direction and the viewing angle direction defined in the Henyey-Greestein formula, and its value range is [-1, 1]. g is the scattering factor, and its value is usually a constant between 0 and 1.

[0083] Step S2: According to the formula C = S1 * L b *L hg * d' calculate vertex N iThe color information after the pixel map at is merged with the scene where the model to be rendered is located, where S1 is the brightness irradiated to the model to be rendered.

[0084] Then, L is obtained by using formula 4 to formula 7. b and L hg After that, according to the formula C = S1 * L b *L hg *d', vertex N can be calculated i The color information after the pixel map at the location is merged with the scene where the model to be rendered is located. i , the color information after the pixel map at all vertices and the scene where the model to be rendered is merged can be calculated, and finally the color information after the model to be rendered and the scene where the model to be rendered are merged during rendering can be obtained.

[0085] From the above attached Figure 2 The volume rendering method of the example shows that, on the one hand, since any vertex N in the pixel map area is divided into a number of blocks i The position of i The sampling camera is used to perform volume sampling on the voxel grid to obtain the cumulative concentration d and forward depth f of the voxel grid. d and reverse depth b d When ray tracing is used, each pixel only needs to be sampled 6 times at most, while the ray tracing rendering solution needs to sample more than dozens of times during volume sampling. Therefore, the solution of the present application greatly reduces the amount of calculation on the sampling data. On the other hand, compared with the amount of pixels required to be recorded in a massive amount of memory when using ray tracing and 3D mapping (i.e., the cube of the pixels of each map), the technical solution of the present application only needs to process the volume sampling data corresponding to the map at the vertex of each block. The amount of these volume sampling data is several orders of magnitude less than the amount of data using ray tracing technology. Therefore, it significantly saves memory and video memory resources and can be applied to lightweight devices such as mobile terminals.

[0086] In order to facilitate better implementation of the volume rendering method of the embodiment of the present application, the embodiment of the present application also provides a volume rendering device. Please refer to 10, which is a structural diagram of the volume rendering device provided in the embodiment of the present application. The volume rendering device may include a voxelization module 1001, a texture block division module 1002, a mapping module 1003, a data storage module 1004 and a rendering module 1005, wherein:

[0087] A voxelization module 1001 is used to voxelize the model to be rendered into a plurality of voxel grids;

[0088] A tile block division module 1002 is used to divide a pixel tile area with a predetermined resolution into a predetermined number of tiles;

[0089] The mapping module 1003 is used to map any vertex N of the block divided by the texture block division module 1002 i The position of is mapped to the position P of each sampling camera in the three-dimensional coordinate system for volume sampling of the voxel grid j , where the volume sampling data obtained by volume sampling includes the cumulative concentration d of the voxel grid obtained along the sampling direction of the sampling camera, the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d ;

[0090] Data storage module 1004 is used to store data at vertex N i The location of the saved position P j Volume sampling data obtained by the sampling camera at ;

[0091] The rendering module 1005 is used to render the model to be rendered after matching the volume sampling data acquired by the sampling camera according to the viewing angle of the rendering camera.

[0092] See also Fig.11 , is another structural schematic diagram of the volume rendering device provided in an embodiment of the present application. Fig.11 and Fig.10 The difference is that the volume rendering device further includes a two-dimensional mapping module 1101 and a recording module 1102, wherein:

[0093] A two-dimensional mapping module 1101 is used to divide the pixel map area into a predetermined number of blocks and map them to a square area whose center is at the origin of the two-dimensional coordinate system, for example, a square area whose center is at the origin of the two-dimensional coordinate system and whose side length is 2;

[0094] Recording module 1102, used to record any vertex N of each block i The coordinates of the square area (x i ,y i ).

[0095] Optional, in the above Fig.11 In the volume rendering device of the example, the mapping module 1003 is specifically used to transform the vertex N i The position is mapped to a viewpoint on the spherical surface of the hemisphere, where the viewpoint is the position P of the sampling camera. j And as the starting point of the sampling direction of the sampling camera for volume sampling of the voxel grid, the hemisphere can at least surround the model to be rendered.

[0096] Optionally, in the above embodiment of the present application, vertex N i The position of the vertex N is mapped to a viewpoint on the spherical surface of the hemisphere: i The coordinate x i With yi The mean value E1 of the sum and the coordinate x i With y i The mean value of the difference is E2; take E1-0.5, 1-|E1|-|E2| and E2 as the parameters of the normalization function, and obtain the function value of the normalization function, where the function value is the coordinate of the viewpoint in the three-dimensional coordinate system (p x , p y , p z ), |E1| is the absolute value of E1, and |E2| is the absolute value of E2.

[0097] Optional, in the above Fig.10 In the exemplary volume rendering device, the data storage module 1004 is used to store the vertex N i On the pixel map corresponding to the position, the position P j The cumulative concentration d of the voxel grid obtained by the sampling camera at the voxel grid and the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d Stored as vertex N i The R channel value, G channel value, and B channel value of the RGB channel of the pixel map corresponding to the position.

[0098] Optional, in the above Fig.11 In the volume rendering device of the example, the rendering module 1005 is specifically used to obtain the texture coordinates (U, V) in the current vector state according to the current vector of the rendering camera and the inverse world matrix of the model to be rendered, and match the texture coordinates (U, V) with the vertices of each block. If the texture coordinates (U, V) can match the coordinates (x i ,y i ) matches, then select the coordinate (x i ,y i ) corresponds to vertex N i The pixel map at the location is used as the rendering resource, and the color information after the pixel map and the scene where the model to be rendered are merged is calculated according to the lighting data on the voxel grid and the volume sampling data of the rendering resource.

[0099] Optionally, in the above embodiment of the present application, the vertex N is calculated according to the illumination data on the voxel grid and the volume sampling data of the rendering resource. i The color information after the pixel map at the location is merged with the scene where the model to be rendered is: i The depth of the pixel map at position P, the depth of the scene where the model to be rendered is located, and the radius of the hemisphere, and d' is calculated according to the Beer-Lambert formula and the Henyey-Greestein formula. j The scattered light energy L of the voxel sampled at b and projected light energy Lhg , according to the formula C = S1 * L b *L hg * d' calculate vertex N i The color information after the pixel map at the location is merged with the scene where the model to be rendered is located, where the hemisphere is the vertex N i The position is mapped to position P j is used to surround the hemisphere of the model to be rendered, and d' is the hemisphere at position P j The cumulative concentration of the voxel grid sampled at is the percentage remaining after the scene is cut off, and S1 is the brightness irradiated to the model to be rendered.

[0100] All of the above technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described in detail here.

[0101] The volume rendering device provided in the embodiment of the present application has, on the one hand, any vertex N in the pixel map area is divided into a plurality of blocks. i The position of i The sampling camera is used to perform volume sampling on the voxel grid to obtain the cumulative concentration d and forward depth f of the voxel grid. d and reverse depth b d When ray tracing is used, each pixel only needs to be sampled 6 times at most, while the ray tracing rendering solution needs to sample more than dozens of times during volume sampling. Therefore, the solution of the present application greatly reduces the amount of calculation on the sampling data. On the other hand, compared with the amount of pixels required to be recorded in a massive amount of memory when using ray tracing and 3D mapping (i.e., the cube of the pixels of each map), the technical solution of the present application only needs to process the volume sampling data corresponding to the map at the vertex of each block. The amount of these volume sampling data is several orders of magnitude less than the amount of data using ray tracing technology. Therefore, it significantly saves memory and video memory resources and can be applied to lightweight devices such as mobile terminals.

[0102] Accordingly, the embodiment of the present application also provides a computer device, which may be a terminal or a server, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), or other terminal devices. Fig.12 As shown, Fig.12A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 400 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer-readable storage media, and a computer program stored in the memory 402 and executable on the processor. The processor 401 is electrically connected to the memory 402. It will be understood by those skilled in the art that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0103] The processor 401 is the control center of the computer device 400. It uses various interfaces and lines to connect the various parts of the entire computer device 400, executes various functions of the computer device 400 and processes data by running or loading software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, thereby monitoring the computer device 400 as a whole.

[0104] In the embodiment of the present application, the processor 401 in the computer device 400 will load instructions corresponding to the processes of one or more application programs into the memory 402 according to the following steps, and the processor 401 will run the application programs stored in the memory 402 to implement various functions:

[0105] The model to be rendered is voxelized into a number of voxel grids; a pixel map area with a predetermined resolution is divided into a predetermined number of blocks; any vertex N of each block obtained by the division is i The position of is mapped to the position P of each sampling camera in the three-dimensional coordinate system for volume sampling of the voxel grid j , where the volume sampling data obtained by volume sampling includes the cumulative concentration d of the voxel grid obtained along the sampling direction of the sampling camera, the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d ; At any vertex N of each block i The position of the vertex N is saved i Mapped position P j The volume sampling data obtained by the sampling camera is obtained; according to the viewing angle of the rendering camera, the volume sampling data obtained by the sampling camera is matched and then the model to be rendered is rendered.

[0106] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0107] Optional, such as Fig.12As shown, the computer device 400 further includes: a touch screen 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. The processor 401 is electrically connected to the touch screen 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407, respectively. Those skilled in the art can understand that Fig.12 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0108] The touch display screen 403 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 403 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, and these graphical user interfaces may be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 401, and can receive the command sent by the processor 401 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 401 to determine the type of touch event, and then the processor 401 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 403 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 403 can also be used as a part of the input unit 406 to realize the input function.

[0109] In the embodiment of the present application, the processor 401 executes the game application to generate a graphical user interface on the touch screen 403. The virtual scene on the graphical user interface includes at least one skill control area, and the skill control area includes at least one skill control. The touch screen 403 is used to present the graphical user interface and receive operation instructions generated by the user acting on the graphical user interface.

[0110] The radio frequency circuit 404 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer devices through wireless communication, and to send and receive signals between the network device or other computer devices.

[0111] The audio circuit 405 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 405 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 405 and converted into audio data, and then the audio data is output to the processor 401 for processing, and then sent to another computer device through the radio frequency circuit 404, or the audio data is output to the memory 402 for further processing. The audio circuit 405 may also include an earphone jack to provide communication between an external headset and the computer device.

[0112] The input unit 406 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0113] The power supply 407 is used to supply power to various components of the computer device 400. Optionally, the power supply 407 can be logically connected to the processor 401 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 407 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0114] although Fig.12 Not shown, the computer device 400 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

[0115] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0116] As can be seen from the above, the computer device provided in this embodiment, since any vertex N in the pixel map area is divided into a number of blocksi The position of i The sampling camera is used to perform volume sampling on the voxel grid to obtain the cumulative concentration d and forward depth f of the voxel grid. d and reverse depth b d When ray tracing is used, each pixel only needs to be sampled 6 times at most, while the ray tracing rendering solution needs to sample more than dozens of times during volume sampling. Therefore, the solution of the present application greatly reduces the amount of calculation on the sampling data. On the other hand, compared with the amount of pixels required to be recorded in a massive amount of memory when using ray tracing and 3D mapping (i.e., the cube of the pixels of each map), the technical solution of the present application only needs to process the volume sampling data corresponding to the map at the vertex of each block. The amount of these volume sampling data is several orders of magnitude less than the amount of data using ray tracing technology. Therefore, it significantly saves memory and video memory resources and can be applied to lightweight devices such as mobile terminals.

[0117] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0118] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any volume rendering method provided in the embodiment of the present application. For example, the computer program can execute the following steps:

[0119] The model to be rendered is voxelized into a number of voxel grids; a pixel map area with a predetermined resolution is divided into a predetermined number of blocks; any vertex N of each block obtained by the division is i The position of is mapped to the position P of each sampling camera in the three-dimensional coordinate system for volume sampling of the voxel grid j , where the volume sampling data obtained by volume sampling includes the cumulative concentration d of the voxel grid obtained along the sampling direction of the sampling camera, the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d ; At any vertex N of each block i The position of the vertex N is saved i Mapped position P j The volume sampling data obtained by the sampling camera is obtained; according to the viewing angle of the rendering camera, the volume sampling data obtained by the sampling camera is matched and then the model to be rendered is rendered.

[0120] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0121] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0122] Since the computer program stored in the storage medium can execute the steps in any volume rendering method provided in the embodiments of the present application, the beneficial effects that can be achieved by any volume rendering method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0123] The above is a detailed introduction to a volume rendering method, device, storage medium and computer equipment provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A volume rendering method, characterized in that: include: Voxelize the model to be rendered into a number of voxel grids; Dividing a pixel map area having a predetermined resolution so that the pixel map area is divided into a predetermined number of blocks; Mapping a predetermined number of blocks divided into the pixel map area to a square area centered at the origin of a two-dimensional coordinate system; Record any vertex N of each block i The coordinates (x i ,y i ); The vertex N i The position is mapped to a viewpoint on the spherical surface of the hemisphere, where the viewpoint is the position P of the sampling camera j The hemisphere is used as the starting point of the sampling direction of the sampling camera for volume sampling of the voxel grid. The hemisphere can at least surround the model to be rendered. The volume sampling data obtained by volume sampling includes the cumulative concentration d of the voxel grid obtained along the sampling direction of the sampling camera, the forward depth f of the voxel grid, and the total depth f of the voxel grid. d and the inverse depth b of the voxel grid d ; At the vertex N i The position P is saved in j Volume sampling data obtained by the sampling camera at ; According to the viewing angle of the rendering camera, the model to be rendered is rendered after matching the volume sampling data acquired by the sampling camera, including: matching the mapping coordinates (U, V) under the current vector of the rendering camera with the vertices of each block; According to the coordinates (x,y) of the vertices of the blocks in the square area that match the texture coordinates (U,V), i ,y i ) corresponds to the vertex N i The pixel map at the location is used as a rendering resource; and the model to be rendered is rendered according to the illumination data on the voxel grid and the volume sampling data of the rendering resource.

2. The volume rendering method according to claim 1, characterized in that: The vertex N i The position is mapped to a viewpoint on the spherical surface of the hemisphere, including: Find the vertex N i The coordinate x i With y i The mean value E1 of the sum, and the coordinate x i With y i The mean of the difference is E2; With E1-0.5, 1-E1|-E2| and E2 as the parameters of the normalization function, the function value of the normalization function is obtained, and the function value is used as the coordinate of the viewpoint in the three-dimensional coordinate system (p x , p y , p z ), the E1| is the absolute value of the E1, and the E2| is the absolute value of the E2.

3. The volume rendering method according to claim 1, characterized in that: At the vertex N i The position P is saved in j The volume sampling data obtained by the sampling camera at the location includes: At the vertex N i The pixel map corresponding to the position P j The cumulative concentration d of the voxel grid obtained by the sampling camera at the voxel grid and the forward depth f of the voxel grid d and the inverse depth b of the voxel grid d The R channel value, G channel value and B channel value of the RGB channels of the pixel map are respectively stored.

4. The volume rendering method according to claim 1, characterized in that: The step of rendering the model to be rendered after matching the volume sampling data acquired by the sampling camera according to the viewing angle of the rendering camera comprises: According to the current vector of the rendering camera and the inverse world matrix of the model to be rendered, the mapping coordinates (U, V) under the current vector state are obtained; Matching the texture coordinates (U, V) with the vertices of each block; If the texture coordinates (U, V) can be matched with the coordinates (x i ,y i ) matches, then select the coordinate (x i ,y i ) corresponds to vertex N i The pixel map at is used as the rendering resource; The color information after the pixel map is fused with the scene where the model to be rendered is located is calculated according to the illumination data on the voxel grid and the volume sampling data of the rendering resource.

5. The volume rendering method according to claim 4, characterized in that: The step of calculating color information of the pixel map after fusion with the scene where the model to be rendered is located according to the illumination data on the voxel grid and the volume sampling data of the rendering resource comprises: According to the vertex N i The depth of the pixel map at the position P, the depth of the scene where the model to be rendered is located, and the radius of the hemisphere, and d' is calculated according to the Beer-Lambert formula and the Henyey-Greestein formula. j The scattered light energy L of the voxel sampled at b and projected light energy L hg , the hemisphere is the vertex N i The position map is the position P j is used to surround the hemisphere of the model to be rendered, and d' is the hemisphere at the position P j The percentage of the cumulative concentration of the voxels sampled at is left after the scene is clipped; According to the formula C = S1 * L b *L hg *d' calculates the color information after the pixel map is merged with the scene where the model to be rendered is located, and S1 is the brightness irradiated to the model to be rendered.

6. A volume rendering device, characterized in that: include: A voxelization module, used to voxelize the model to be rendered into a number of voxel grids; A tile block division module, used to divide a pixel tile area with a predetermined resolution into a predetermined number of tiles; A two-dimensional mapping module, used for mapping a predetermined number of blocks divided into the pixel map area to a square area centered at the origin of the two-dimensional coordinate system; A recording module is used to record any vertex N of each block. i The coordinates (x i ,y i ); A mapping module is used to transform the vertex N i The position is mapped to a viewpoint on the spherical surface of the hemisphere, where the viewpoint is the position P of the sampling camera j The hemisphere is used as the starting point of the sampling direction of the sampling camera for volume sampling of the voxel grid. The hemisphere can at least surround the model to be rendered. The volume sampling data obtained by volume sampling includes the cumulative concentration d of the voxel grid obtained along the sampling direction of the sampling camera, the forward depth f of the voxel grid, and the total depth f of the voxel grid. d and the inverse depth b of the voxel grid d ; The data storage module is used to store the data at the vertex N i The position P is saved in j Upsampling the volume sampling data obtained by the camera; A rendering module, used to render the model to be rendered after matching the volume sampling data acquired by the sampling camera according to the viewing angle of the rendering camera, including: matching the mapping coordinates (U, V) under the current vector of the rendering camera with the vertices of each block; According to the coordinates (x,y) of the vertices of the blocks in the square area that match the texture coordinates (U,V), i ,y i ) corresponds to the vertex N i The pixel map at the location is used as a rendering resource; and the model to be rendered is rendered according to the illumination data on the voxel grid and the volume sampling data of the rendering resource.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the steps in the volume rendering method according to any one of claims 1 to 5.

8. A computer device, characterized in that: The computer device includes a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the steps in the volume rendering method according to any one of claims 1 to 5 by calling the computer program stored in the memory.