Method, apparatus and computer readable storage medium for generating a voxel object

CN116485969BActive Publication Date: 2026-10-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310190136.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2026-10-20
Estimated Expiration
2043-02-22

AI Technical Summary

Technical Problem

[0003]在对现有技术的研究和实践过程中发现,现有的以三坐标轴方向渲染三维模型并写入三维纹理进行体素化的体素对象生成方法,需要对三维模型进行多次渲染,在三维模型面数较高将会使得渲染资源消耗过高,进而导致体素对象生成效率较低

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116485969B_ABST
    Figure CN116485969B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a kind of voxel object generation method, device and computer readable storage medium;Through the UV unfolding of the voxel array model of target object, UV information is obtained;The main camera parameter in target virtual scene is acquired, and the orthogonal camera shooting parameter is generated according to main camera parameter;Target object is rendered based on orthogonal camera shooting parameter processing, and target map is obtained;Based on the position of orthogonal camera shooting parameter and target object, voxel array model is placed in target virtual scene;According to UV information and depth information, the target depth information corresponding to each voxel model is determined, and the multiple voxel models are covered to the surface of target object according to target depth information, and target voxel model is obtained;Based on UV information and color information, the color parameter of target voxel model is determined, and target voxel model is rendered based on color parameter processing, and target voxel object is obtained.Therefore, the efficiency of voxel object generation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, specifically to a method, apparatus and computer-readable storage medium for generating voxel objects. Background Technology

[0002] With the rapid development of internet technology, the application of 3D technology is becoming increasingly widespread, for example, in games, movies, and other scenarios implemented using 3D models. To improve the display effect of 3D models, visual effects design is needed, such as voxelizing the 3D model to create visual effects based on the voxel model. In existing voxel object generation methods, the 3D model is often rendered along the three coordinate axes (x, y, z) of the target space scene. After rasterizing the 3D model, a 3D texture is written into the target space scene based on the spatial position of the pixels of the 3D model to perform voxelization.

[0003] During the research and practice of existing technologies, it was found that the existing method of generating voxel objects by rendering 3D models in three coordinate axes and writing them into 3D textures requires multiple renderings of the 3D model. When the number of faces in the 3D model is high, the rendering resources will be consumed too much, resulting in low voxel object generation efficiency. Summary of the Invention

[0004] This application provides a method, apparatus, and computer-readable storage medium for generating voxel objects, which can improve the efficiency of voxel object generation.

[0005] This application provides a method for generating voxel objects, including:

[0006] The UV unwrapping of the voxel array model corresponding to the target object is performed to obtain the UV information of the voxel array model. The voxel array model is composed of voxel models arranged together. The target object is a three-dimensional model object in the target virtual scene.

[0007] Obtain the main camera parameters in the target virtual scene, and generate orthogonal camera shooting parameters for the virtual orthogonal camera to shoot the target object based on the main camera parameters;

[0008] The target object is rendered based on the orthogonal camera shooting parameters to obtain a target texture of the target object, the target texture including the depth information and color information of the target object;

[0009] Based on the orthogonal camera shooting parameters and the position of the target object in the target virtual scene, the voxel array model is placed in the target virtual scene;

[0010] Based on the UV information and the depth information, the target depth information corresponding to each voxel model in the voxel array model is determined, and multiple voxel models are overlaid onto the surface of the target object based on the target depth information to obtain a target voxel model overlaid on the surface of the target object.

[0011] Based on the UV information and the color information, the color parameters corresponding to the target voxel model are determined, and the target voxel model is rendered based on the color parameters to obtain the target voxel object corresponding to the target object.

[0012] Accordingly, embodiments of this application provide a voxel object generation apparatus, including:

[0013] The unfolding unit is used to perform UV unwrapping on the voxel array model corresponding to the target object to obtain the UV information of the voxel array model. The voxel array model is composed of voxel models arranged together. The target object is a three-dimensional model object in the target virtual scene.

[0014] The acquisition unit is used to acquire the main camera parameters in the target virtual scene, and generate orthogonal camera shooting parameters for the virtual orthogonal camera that shoots the target object based on the main camera parameters;

[0015] The rendering unit is used to render the target object based on the shooting parameters of the orthogonal camera to obtain a target texture of the target object, wherein the target texture includes the depth information and color information of the target object;

[0016] A placement unit is used to place the voxel array model in the target virtual scene based on the shooting parameters of the orthogonal camera and the position of the target object in the target virtual scene;

[0017] The overlay unit is used to determine the target depth information corresponding to each voxel model in the voxel array model according to the UV information and the depth information, and to overlay multiple voxel models onto the surface of the target object according to the target depth information to obtain a target voxel model overlaid on the surface of the target object.

[0018] The determining unit is used to determine the color parameters corresponding to the target voxel model based on the UV information and the color information, and to perform rendering processing on the target voxel model based on the color parameters to obtain the target voxel object corresponding to the target object.

[0019] In one embodiment, the covering unit includes:

[0020] The matching relationship determination subunit is used to determine the matching relationship between the voxel model and the pixels in the target texture based on the correspondence between the target object and the voxel array model in the shooting direction of the virtual orthogonal camera;

[0021] The center point location information acquisition subunit is used to acquire the center point location information of each voxel model based on the UV information.

[0022] The depth sampling subunit is used to perform depth sampling processing on the depth information according to the center point position information and the matching relationship to obtain the target depth information corresponding to each voxel model in the voxel array model.

[0023] In one embodiment, the depth sampling subunit includes:

[0024] The vertex spatial position information acquisition module is used to acquire the vertex spatial position information of the voxel array model in the target virtual scene;

[0025] The spatial location information determination module is used to determine the voxel spatial location information of each voxel model in the target virtual scene based on the vertex spatial location information and the center point location information;

[0026] The target depth information determination module is used to determine the target depth information corresponding to each voxel model in the voxel array model based on the voxel spatial position information and the matching relationship.

[0027] In one embodiment, the covering unit includes:

[0028] The first special effects control parameter acquisition subunit is used to acquire the first special effects control parameters corresponding to the target object;

[0029] The parameter adjustment subunit is used to perform parameter adjustment processing on the voxel model according to the first special effect control parameter;

[0030] The translation subunit is used to translate the parameter-adjusted voxel model in the shooting direction of the virtual orthogonal camera based on the target depth information, so as to obtain a target voxel model covering the surface of the target object.

[0031] In one embodiment, the translation subunit includes:

[0032] The first depth information threshold determination module is used to determine the first depth information threshold based on the scene bounding box size information of the target virtual scene;

[0033] The voxel filtering module is used to filter the voxel model after parameter adjustment based on the first depth information threshold and the target depth information to obtain the filtered voxel model corresponding to the target object.

[0034] The voxel translation module is used to translate the selected voxel model in the shooting direction of the virtual orthogonal camera according to the target depth information corresponding to the selected voxel model.

[0035] In one embodiment, the determining unit includes:

[0036] The second depth information threshold determination subunit is used to determine the second depth information threshold corresponding to the target object based on the scene bounding box size information of the target virtual scene.

[0037] The target pixel recognition subunit is used to identify the target pixel corresponding to the target object in the pixels of the target texture based on the target depth information and the second depth information threshold.

[0038] The color parameter calculation subunit is used to calculate the color parameters corresponding to the target voxel model based on the UV information and the color information corresponding to the target pixel.

[0039] In one embodiment, the color parameter calculation subunit includes:

[0040] The coordinate information acquisition module is used to acquire the UV coordinate information corresponding to each target voxel model based on the UV information;

[0041] The candidate color information search module is used to search for target color information that matches the target voxel model in the color information corresponding to the target pixel based on the UV coordinate information;

[0042] The color parameter determination module is used to determine the color parameters corresponding to the target voxel model based on the target color information.

[0043] In one embodiment, the orthogonal camera shooting parameters include first position information and shooting direction vector, and the placement unit includes:

[0044] The model rotation subunit is used to perform model rotation processing on the voxel array model based on the shooting direction vector in the shooting parameters of the orthogonal camera;

[0045] The model placement subunit is used to place the rotated voxel array model between the target object and the virtual orthogonal camera based on the first position information in the orthogonal camera shooting parameters.

[0046] In one embodiment, the acquisition unit includes:

[0047] The location information extraction subunit is used to extract the location information of the virtual main camera in the target virtual scene from the main camera parameters to obtain the second location information.

[0048] The information acquisition subunit is used to acquire the object center point position information and bounding box size information of the target object in the target virtual scene;

[0049] The parameter determination subunit is used to determine the orthogonal camera shooting parameters of the virtual orthogonal camera for shooting the target object based on the second position information, the object center point position information, and the bounding box size information.

[0050] In one embodiment, the parameter determining subunit includes:

[0051] The direction vector calculation module is used to calculate the direction vector of the virtual orthogonal camera that captures the target object in the target virtual scene based on the second position information and the position information of the object center point, so as to obtain the shooting direction vector;

[0052] The position information calculation module is used to calculate the position of the virtual orthogonal camera in the target virtual scene based on the shooting direction vector, the position information of the object center point, and the bounding box size information, and obtain the first position information;

[0053] The parameter setting module is used to use the shooting direction vector and the first position information as the orthogonal camera shooting parameters of the virtual orthogonal camera.

[0054] In one embodiment, the voxel object generation apparatus further includes:

[0055] The second special effects control parameter acquisition unit is used to acquire the second special effects control parameters for each target voxel model in the target voxel object.

[0056] The parameter adjustment processing unit is used to perform parameter adjustment processing on the target voxel model based on the special effects control parameters to obtain the target voxel object after special effects control.

[0057] Furthermore, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the voxel object generation methods provided in embodiments of this application.

[0058] Furthermore, this application also provides a computer device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the voxel object generation method provided in this application.

[0059] This application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in the voxel object generation method provided in this application.

[0060] This application embodiment obtains the UV information of a voxel array model by performing UV unwrapping on the voxel array model corresponding to the target object. The voxel array model is composed of arranged voxel models, and the target object is a 3D model object in the target virtual scene. The main camera parameters in the target virtual scene are obtained, and orthogonal camera shooting parameters for a virtual orthogonal camera to shoot the target object are generated based on the main camera parameters. The target object is rendered based on the orthogonal camera shooting parameters to obtain a target texture of the target object, which includes the depth and color information of the target object. Based on the orthogonal camera shooting parameters and the position of the target object in the target virtual scene, the voxel array model is placed in the target virtual scene. Based on the UV and depth information, the target depth information corresponding to each voxel model in the voxel array model is determined, and multiple voxel models are overlaid onto the surface of the target object based on the target depth information to obtain a target voxel model overlaid on the surface of the target object. Based on the UV and color information, the color parameters corresponding to the target voxel model are determined, and the target voxel model is rendered based on the color parameters to obtain the target voxel object corresponding to the target object. In this way, by generating a virtual orthogonal camera corresponding to the target object in the target virtual scene, the target object is rendered through the virtual orthogonal camera to obtain the depth and color information of the target object. The voxel array model corresponding to the target object is placed in the target virtual scene. Then, based on the depth information and the UV information corresponding to the voxel array model, the voxel model is overlaid on the corresponding position on the surface of the target object. Based on the color and UV information, the voxel model overlaid on the surface of the target object is rendered to obtain the target voxel object corresponding to the target object. This eliminates the need to render the target object multiple times when generating the voxel object of the target object, and realizes the voxelization display process of the target object with low rendering resource consumption, thereby improving the efficiency of voxel object generation. Attached Figure Description

[0061] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0062] Figure 1 This is a schematic diagram illustrating an implementation scenario of a voxel object generation method provided in an embodiment of this application;

[0063] Figure 2 This is a flowchart illustrating a voxel object generation method provided in an embodiment of this application;

[0064] Figure 3 This is a UV unwrapping diagram of a voxel object generation method provided in an embodiment of this application;

[0065] Figure 4a This is a spatial location diagram of a voxel object generation method provided in an embodiment of this application;

[0066] Figure 4b This is a schematic diagram illustrating the specific process of a voxel object generation method provided in an embodiment of this application;

[0067] Figure 4c This is another spatial location diagram of a voxel object generation method provided in an embodiment of this application;

[0068] Figure 5a This is another specific flowchart illustrating a voxel object generation method provided in an embodiment of this application;

[0069] Figure 5b This is a schematic diagram showing the special effects of a voxel object generation method provided in an embodiment of this application;

[0070] Figure 5c This is a schematic diagram of the system structure of a voxel object generation method provided in an embodiment of this application;

[0071] Figure 6 This is another flowchart illustrating a voxel object generation method provided in an embodiment of this application;

[0072] Figure 7 This is a schematic diagram of the structure of the voxel object generation device provided in the embodiments of this application;

[0073] Figure 8 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation

[0074] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0075] This application provides a voxel object generation method, apparatus, and computer-readable storage medium. The voxel object generation apparatus can be integrated into a computer device, which may be a server or a terminal, etc.

[0076] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery network (CDN) acceleration services, and big data and artificial intelligence platforms. The terminal can include, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.

[0077] Please see Figure 1 Taking the integration of a voxel object generation device into a computer device as an example, Figure 1This is a schematic diagram illustrating an implementation scenario of the voxel object generation method provided in this application. The computer device can be a server or a terminal. The computer device can perform UV unwrapping on the voxel array model corresponding to the target object to obtain the UV information of the voxel array model. The voxel array model is composed of arranged voxel models, and the target object is a 3D model object in the target virtual scene. The device then obtains the parameters of the main camera in the target virtual scene and generates orthogonal camera shooting parameters for a virtual orthogonal camera to capture the target object based on the main camera parameters. Finally, the device renders the target object based on the orthogonal camera shooting parameters to obtain the target texture of the target object. The target texture includes the depth and color information of the target object. Based on the shooting parameters of the orthogonal camera and the position of the target object in the target virtual scene, the voxel array model is placed in the target virtual scene. According to the UV information and depth information, the target depth information corresponding to each voxel model in the voxel array model is determined, and multiple voxel models are overlaid on the surface of the target object according to the target depth information to obtain the target voxel model overlaid on the surface of the target object. Based on the UV information and color information, the color parameters corresponding to the target voxel model are determined, and the target voxel model is rendered based on the color parameters to obtain the target voxel object corresponding to the target object.

[0078] It should be noted that the embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving. Figure 1 The illustrated scenario of the voxel object generation method is merely an example. The implementation environment scenario of the voxel object generation method described in this application is for the purpose of more clearly illustrating the technical solution of this application and does not constitute a limitation on the technical solution provided in this application. Those skilled in the art will understand that with the evolution of voxel object generation and the emergence of new business scenarios, the technical solution provided in this application is also applicable to similar technical problems.

[0079] The solutions provided in this application are specifically illustrated through the following embodiments. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.

[0080] This embodiment will be described from the perspective of a voxel object generation device, which can be integrated into a computer device, such as a server. This application does not impose any limitations on this.

[0081] Please see Figure 2 , Figure 2 This is a flowchart illustrating the voxel object generation method provided in an embodiment of this application. The voxel object generation method includes:

[0082] In step 101, the voxel array model corresponding to the target object is UV unwrapped to obtain the UV information of the voxel array model.

[0083] The voxel array model can be a 3D model composed of multiple voxel models arranged together. A voxel is short for volume pixel, the smallest unit of 3D spatial segmentation. The target object can be a 3D model object in a target virtual scene. This 3D model object can be an object in 3D space, such as a person, animal, or game character. The target virtual scene can be a virtual 3D space scene, for example, a 3D scene in a game engine. The UV information can include the positional relationship of each voxel model in the voxel array model in 2D space, including the coordinates of the voxel models mapped to 2D space. In the UV information, each voxel model has corresponding UV coordinates. UV is short for UVW (because W coordinates are not commonly used, it can be simply called UV). It refers to the relationship between texture map coordinates and the XYZ coordinates of the voxel model in 3D space. UV defines the positional information of each point in the UV map. UV unwrapping, also called UV decomposition, refers to the process of tiling a face of a 3D model onto a 2D canvas.

[0084] Among them, individual voxel 3D models (3D cubic grids) can be arrayed within 3D software. For example, the image below is a perspective view of a 50x50 voxel array with a total of 2500 voxels.

[0085] Optionally, there are several ways to perform UV unwrapping on the voxel array model corresponding to the target object. For example, please refer to... Figure 3 , Figure 3 This is a UV unfolding diagram of a voxel object generation method provided in an embodiment of this application. The voxel array model is composed of multiple voxel models. The voxel array model can be subjected to planar projection processing to obtain the first UV information of the voxel array model. Based on the first UV information, the vertex coordinates of each voxel model in the first UV information are obtained, and the center point coordinates of each voxel model in the first UV information are calculated based on the vertex coordinates. Based on the center point coordinates of each voxel in the first UV information, the second UV information is obtained.

[0086] The first UV information can include the first UV coordinates of each voxel model in the voxel array model in the planar projection. These first UV coordinates can be the coordinates of each voxel model within the region specified in the first UV information. The region of each voxel model in the first UV information can be bounded by the four vertices of the voxel model within the first UV information. The pixel shader can read the texture corresponding to the target object based on the first UV information, thereby displaying the image corresponding to the target object on the voxel model. The second UV information includes the second UV coordinates corresponding to the voxel models in the voxel array model. In the first UV information, one voxel model corresponds to one second UV coordinate. These second UV coordinates can be the coordinates of the center point of the voxel model's vertex coordinates within the first UV information. The vertex shader can calculate the center point coordinates of each voxel model in the target virtual scene based on the first UV information.

[0087] In step 102, the main camera parameters in the target virtual scene are obtained, and the orthogonal camera shooting parameters of the virtual orthogonal camera shooting the target object are generated based on the main camera parameters.

[0088] The main camera parameters can be the shooting parameters of a virtual main camera in the target virtual scene, including information such as the virtual main camera's position within the target virtual scene. This virtual main camera can be the main camera in the target virtual scene, i.e., the game window camera, used to capture content in the target virtual scene for display to the user. The virtual orthographic camera can be a perspective camera, with its field of view being a quadrangular cone. The virtual main camera can adjust the size of objects based on their distance from the object being photographed. The virtual orthographic camera can be an orthographic camera in the target virtual scene. The orthographic camera's field of view can be a cuboid, and it captures the projection of the object being photographed, without changing its field of view due to the distance between the orthographic camera and the object. The orthographic camera shooting parameters can be the shooting parameters of a virtual orthographic camera, including information such as the virtual orthographic camera's position and orientation within the target virtual scene. In order to display target objects in a voxelized manner, a virtual orthogonal camera that can fully capture the target object needs to be generated in the target virtual scene. To do this, the shooting parameters of the virtual orthogonal camera to be generated in the target virtual scene can be determined based on the position of the target object and the virtual main camera in the target virtual scene. Thus, the virtual orthogonal camera corresponding to the target object can be created based on the orthogonal camera shooting parameters.

[0089] There are several ways to generate the orthogonal camera shooting parameters of the virtual orthogonal camera for shooting the target object based on the main camera parameters. For example, the position information of the virtual main camera in the target virtual scene can be extracted from the main camera parameters to obtain the second position information. The position information of the object center point and the bounding box size information of the target object in the target virtual scene can be obtained. Based on the second position information, the object center point position information and the bounding box size information, the orthogonal camera shooting parameters of the virtual orthogonal camera for shooting the target object can be determined.

[0090] The first location information can be the location information of the virtual main camera in the target virtual scene, that is, the spatial location of the virtual main camera. This location information can be information describing the location, such as coordinates. The object center point location information can be the location information of the center point of the target object in the target virtual scene, which can be used to characterize the position of the target object in the target virtual scene. The bounding box size information can be the size information of the bounding box of the target object. The bounding box of the target object can be constructed by sampling a bounding box algorithm. This size information can be information describing the size of the bounding box of the target object, such as the length, width, and height of the bounding box of the target object.

[0091] There are several ways to determine the orthogonal camera shooting parameters of the virtual orthogonal camera that is shooting the target object based on the second position information, the object center point position information, and the bounding box size information. For example, the direction vector of the virtual orthogonal camera in the target virtual scene can be calculated based on the second position information and the object center point position information to obtain the shooting direction vector. The position of the virtual orthogonal camera in the target virtual scene can be calculated based on the shooting direction vector, the object center point position information, and the bounding box size information to obtain the first position information. The shooting direction vector and the first position information can then be used as the orthogonal camera shooting parameters of the virtual orthogonal camera.

[0092] The shooting direction vector can be information describing the shooting direction of the virtual orthogonal camera in the target virtual scene, or it can be the projection direction of the orthogonal camera. The first position information can be the position information of the virtual orthogonal camera in the target virtual scene.

[0093] There are several ways to calculate the direction vector of the virtual orthogonal camera in the target virtual scene based on the second position information and the object center point position information. For example, the position of the virtual orthogonal camera can be on the same plane as the virtual main camera and the target object. For example, please refer to [reference needed]. Figure 4a , Figure 4aThis is a spatial position diagram of a voxel object generation method provided in an embodiment of this application. Taking a three-dimensional rabbit model as an example, the virtual main camera's position in the target virtual scene, i.e., the second position information, is P. cam The location information of the center point of the target object can be represented as P. obj Then we can obtain the vector v = P obj -P cam Since the virtual orthogonal camera uses orthogonal projection, and the pitch angle of the projection direction is 0, the vector v can be projected onto the horizontal plane (z = 0). Then, the projected vector v is normalized to obtain the direction vector of the virtual orthogonal camera in the target virtual scene. That is, the shooting direction vector can be expressed as:

[0094] v ortho_ =normalize(v x v y ,0)

[0095] After calculating the direction vector of the virtual orthogonal camera in the target virtual scene based on the second position information and the object center point position information, the position of the virtual orthogonal camera in the target virtual scene can be calculated based on the shooting direction vector, the object center point position information, and the bounding box size information, thus obtaining the first position information. There are several ways to calculate the position of the virtual orthogonal camera in the target virtual scene based on the shooting direction vector, the object center point position information, and the bounding box size information. For example, to ensure the virtual orthogonal camera can completely capture the target object, a position that allows for complete capture can be determined based on the bounding box size of the target object. For instance, the virtual orthogonal camera can be placed in front of the target object to avoid intersection or occlusion. For further information, please refer to [link / reference needed]. Figure 4a The virtual orthographic camera can be positioned in front of the bounding box of the target object. Optionally, to capture complete images of the target object from multiple angles, the maximum size of the target object's bounding box can be obtained, and the distance between the virtual orthographic camera and the target object can be determined as this maximum size. For example, the length, width, and height of the bounding box corresponding to the target object can be constructed into a vector B = (B... x B y B z If the position of the virtual orthogonal camera is such that..., then the position of the virtual orthogonal camera can be represented as...

[0096] P ortho_ =P obj -max(B x B y B z )·v ortho_

[0097] The orthogonal projection size of the virtual orthogonal camera is max(B). x B y B z ), max(B x B y B z ) indicates taking B x B y B z The maximum value among the length, width, and height of the bounding box of the virtual orthogonal camera is selected so that the distance between the virtual orthogonal camera and the target object is the largest among the length, width, and height of the target object's bounding box. This ensures that the virtual orthogonal camera does not intersect with the target object, and the shooting range of the virtual orthogonal camera can surround the bounding box of the target object, thus allowing the target object to be captured completely.

[0098] Therefore, the shooting direction vector and the first position information can be used as the shooting parameters of the virtual orthogonal camera. Based on these orthogonal camera shooting parameters, a virtual orthogonal camera that can completely capture the target object can be generated in the target virtual scene.

[0099] Optionally, the target object can be displayed in the target virtual scene in several ways. For example, a voxel model can be overlaid on the surface of the target object, or the target object can be displayed without stopping its display in the target virtual scene, only showing the voxel model corresponding to the target object. If the target object is not displayed, the hiding option for the target object needs to be enabled in the game engine; in this case, the target object will not be rendered. If the target object needs to be displayed, the hiding option corresponding to the target object can be disabled, thereby rendering the target object in the target virtual environment. In one embodiment, please refer to... Figure 4b , Figure 4b This is a schematic diagram of a voxel object generation method provided in an embodiment of this application. The process in the diagram can be executed by a central processing unit (CPU). The CPU can determine whether the target object needs to be displayed. When the target object needs to be displayed, the target object can be rendered in the target virtual scene through a virtual main camera. When the target object does not need to be displayed, the main camera parameters in the target virtual scene can be directly obtained, and the orthogonal camera shooting parameters of the virtual orthogonal camera that shoots the target object can be generated based on the main camera parameters.

[0100] In step 103, the target object is rendered based on the orthogonal camera shooting parameters to obtain the target texture of the target object.

[0101] The target texture can be a texture obtained by rendering the target object using a virtual orthographic camera. It can include the target object's depth and color information. The depth information can be the pixel depth of each pixel in the target texture corresponding to the target object. This pixel depth represents the depth of the currently rendered pixel, i.e., the distance between that pixel and the virtual orthographic camera. The color information can be the color value (RGB value) of each pixel in the target texture. For example, the target texture can be a four-channel color space [RGBA, representing Red, Green, Blue, and Alpha]. During the rendering process of the target object, the color information of the target object can be written to the color channel (RGB channel), and the depth information can be written to the depth channel (Alpha channel, or A channel for short), thus obtaining the target texture.

[0102] Optionally, before rendering the target object, the initial depth of each pixel in the depth channel of the texture can be set to the highest bit value, for example, infinity. When rendering the target object, other objects in the virtual scene can be ignored, and only the target object is rendered. Thus, in the target texture captured by the virtual orthographic camera, the depth information for areas that are not the target object (i.e., the background) can be infinity, while the depth information for areas belonging to the target object is not infinity; it can be a value smaller than the maximum value of the bounding box (length, width, height, and center) of the virtual scene. In this way, the depth information can be used to determine whether each pixel in the target texture is background or a target object.

[0103] In step 104, based on the shooting parameters of the orthogonal camera and the position of the target object in the target virtual scene, the voxel array model is placed in the target virtual scene.

[0104] There are several ways to place the voxel array model in the target virtual scene based on the orthogonal camera shooting parameters and the position of the target object in the target virtual scene. For example, taking the orthogonal camera shooting parameters of the virtual orthogonal camera as an example, including the first position information and the shooting direction vector, the voxel array model can be rotated based on the shooting direction vector in the orthogonal camera shooting parameters, and the rotated voxel array model can be placed between the target object and the virtual orthogonal camera based on the first position information in the orthogonal camera shooting parameters.

[0105] There are several ways to rotate the voxel array model based on the shooting direction vector in the shooting parameters of the orthogonal camera. For example, in order to facilitate the voxelization display of the target object, the direction of the voxel array model can be rotated to be the same as the direction vector of the virtual orthogonal camera, so that the direction vector of the virtual orthogonal camera is perpendicular to the plane of the voxel array model.

[0106] After rotating the voxel array model based on the shooting direction vector in the orthogonal camera shooting parameters, the rotated voxel array model can be placed between the target object and the virtual orthogonal camera based on the first position information in the orthogonal camera shooting parameters. There are several ways to place the rotated voxel array model between the target object and the virtual orthogonal camera based on the first position information in the orthogonal camera shooting parameters; for example, please refer to... Figure 4c , Figure 4c This is another spatial location diagram of a voxel object generation method provided in this application embodiment. The voxel array model after model rotation processing can be placed at the location of the virtual orthogonal camera, that is, the location corresponding to the first position information. In the projection view of the virtual orthogonal camera, the voxel array model can completely occlude the target object.

[0107] Optionally, the rotated voxel array model can be placed between the virtual orthogonal camera and the target object, and the distance between the rotated voxel array model and the virtual orthogonal camera can be recorded for subsequent voxel array model rendering operations.

[0108] Therefore, please continue to refer to this. Figure 4b This method allows the use of variables such as virtual orthogonal camera shooting parameters, depth and color information in the target texture, the spatial positions of the four vertices in the voxel array model, the size of the voxel model, and other special effects control parameters as material parameters for rendering the voxel array model. Based on these material parameters, the voxel array model is rendered and the rendered image is output, achieving voxelized display of the target object. Simultaneously, the voxel shape of the target object can be controlled to achieve visual effects and enhance the visual display effect. Specifically, the special effects control parameters can be parameters that control the display process of the voxelized target object. These can include dithering parameters, scaling parameters, and custom appearance control parameters. The dithering parameter controls the dithering attributes of the voxel model, including dithering degree and frequency. The scaling parameter controls the scaling attributes of the voxel model, including scaling ratio and scaling direction. The custom appearance control parameters can customize and control the color, glow, and other material attributes of the voxel model.

[0109] In step 105, based on UV information and depth information, the target depth information corresponding to each voxel model in the voxel array model is determined, and multiple voxel models are overlaid onto the surface of the target object based on the target depth information to obtain the target voxel model overlaid on the surface of the target object.

[0110] The target depth information can be the depth information corresponding to the voxel model, the depth information of the corresponding pixels of the voxel model in the target texture in the voxel array model, or the distance from each voxel model in the voxel array model to the corresponding position on the surface of the target object. The target voxel model can be the voxel model covering the surface of the target object, that is, the voxel model of the target object that constitutes the voxel shape.

[0111] There are several ways to determine the target depth information corresponding to each voxel model in the voxel array model based on UV information and depth information. For example, the matching relationship between the voxel model and the pixels in the target texture can be determined based on the correspondence between the target object and the voxel array model in the shooting direction of the virtual orthogonal camera. The center point position information of each voxel model can be obtained based on the UV information. The depth sampling process is performed in the depth information based on the center point position information and the matching relationship to obtain the target depth information corresponding to each voxel model in the voxel array model.

[0112] Here, the shooting direction can be the direction corresponding to the shooting direction vector of the virtual orthogonal camera, and the matching relationship can be the mapping relationship between voxel models and pixels in the target texture. For example, assuming there is a region 'a' in the target object, based on the correspondence between the target object and the voxel array model in the shooting direction of the virtual orthogonal camera, the voxel model 'b' corresponding to region 'a' can be determined in the voxel array model. And based on the correspondence between the target texture and the target object, the pixel 'c' corresponding to region 'a' can be determined in the pixels of the target texture. Therefore, there is a matching relationship between voxel model 'b' and pixel 'c' in the target texture. The center point position information can be the position information of the center point of the voxel model in the UV information. For example, please refer to [reference needed]. Figure 3 The location information of the center point can be the coordinates of the voxel model in the second UV information.

[0113] There are several ways to obtain the target depth information corresponding to each voxel model in the voxel array model by performing depth sampling processing on the depth information based on the center point position information and the matching relationship. For example, the vertex spatial position information of the voxel array model in the target virtual scene can be obtained. Based on the vertex spatial position information and the center point position information, the voxel spatial position information of each voxel model in the target virtual scene can be determined. Based on the voxel spatial position information and the matching relationship, the target depth information corresponding to each voxel model in the voxel array model can be determined.

[0114] Specifically, the vertex spatial position information can be the position information of the four vertices of the voxel array model placed in the target virtual scene. These four vertices can include the top-left, top-right, bottom-left, and bottom-right vertices of the voxel array model. The vertex spatial position information can also be the spatial coordinates of the four vertices of the voxel array model placed in the target virtual scene, specifically the spatial coordinates of the top-left, top-right, bottom-left, and bottom-right vertices. The voxel spatial position information can also be the spatial position information of each voxel model in the target virtual scene; for example, it could be the spatial coordinates of the center point of the voxel model in the target virtual scene.

[0115] There are several ways to determine the voxel spatial position information of each voxel model in the target virtual scene based on vertex spatial position information and center point position information. For example, a linear interpolation algorithm can be used to calculate the voxel spatial position information of each voxel model in the target virtual scene based on the center point position information of each voxel model and the vertex spatial position information of the voxel array model. For example, assuming that the center point position information can be the second UV coordinates corresponding to each voxel array model, and the spatial position information can be the coordinates of the center point of the voxel model in the target virtual scene, i.e., the center point coordinates, please refer to [reference needed]. Figure 5a , Figure 5a This is another specific flowchart illustrating a voxel object generation method provided in this application embodiment. The process shown in the diagram can be executed by a graphics processing unit (GPU). The CPU can obtain the second UV information and the vertex spatial position information of the voxel array model to interpolate and calculate the center point coordinates of the voxel model. Specifically, it is assumed that the vertex spatial position information of the voxel array model is the spatial position coordinates P of the upper left vertex. lt The spatial coordinates of the upper right vertex P rt The spatial coordinates of the lower left vertex, P lb The spatial coordinates of the lower right vertex P rb Therefore, a linear interpolation algorithm can be used to calculate the center point coordinates of the voxel model. For example, the interpolation calculation process can be represented as follows:

[0116] P temp1 =lerp(P lt ,P rt (UV0.x)

[0117] P temp2 =lerp(P 1b ,P rb (UV0.x)

[0118] P center =lerp(Ptemp1 ,P temp2 ,UV0.y)

[0119] Where lerp(a,b,alpha) can be represented as a linear interpolation function, which can be a bilinear interpolation function. a and b represent the range of linear interpolation calculations, alpha can be the interpolation weight, UV0.x can represent the interpolation weight in the horizontal direction of the second UV information, i.e., the value of the horizontal coordinate of each second UV coordinate in the second UV information, and UV0.y can represent the interpolation weight in the vertical direction of the second UV information, i.e., the value of the vertical coordinate of each second UV coordinate in the second UV information. P temp1 It can be represented as a linear interpolation result between the spatial coordinates of the top-left vertex and the spatial coordinates of the top-right vertex, P. temp2 It can be represented as the linear interpolation result between the spatial coordinates of the lower left vertex and the spatial coordinates of the lower right vertex, P. center It can be represented as the coordinates of the center point of each voxel model.

[0120] After determining the voxel spatial position information of each voxel model in the target virtual scene based on the vertex spatial position information and the center point position information, the target depth information corresponding to each voxel model in the voxel array model can be determined according to the voxel spatial position information and matching relationships. There are several ways to determine the target depth information corresponding to each voxel model in the voxel array model based on the voxel spatial position information and matching relationships. For example, based on the matching relationships, the pixels matching the voxel spatial position information of each voxel model in the voxel array model can be searched in the target texture, and the target depth information corresponding to each voxel model in the voxel array model can be obtained based on the depth information of that pixel in the depth channel.

[0121] After determining the target depth information for each voxel model in the voxel array model based on UV and depth information, multiple voxel models can be overlaid onto the surface of the target object according to the target depth information, resulting in a target voxel model overlaid on the surface of the target object. There are several ways to overlay multiple voxel models onto the surface of the target object based on the target depth information; for example, please refer to [link / reference]. Figure 5a Based on the target depth information, each vertex in the voxel model can be translated along the shooting direction of the virtual orthogonal camera to overlay the voxel model in the voxel array onto the surface of the target object. Optionally, the translation result of each vertex can be used as the output of the vertex shader and can be output to the pixel shader for subsequent voxel model rendering steps.

[0122] Optionally, when the voxel array model after model rotation is placed between the virtual orthogonal camera and the target object, the distance between the voxel array model after model rotation and the virtual orthogonal camera in the shooting direction can be recorded. The target depth information corresponding to the voxel model can be adjusted according to the distance. Thus, multiple voxel models can be covered onto the surface of the target object according to the adjusted depth information to obtain a target voxel model covered on the surface of the target object.

[0123] Optionally, there are several other ways to overlay multiple voxel models onto the surface of the target object based on the target depth information. For example, the first special effects control parameters corresponding to the target object can be obtained, and the voxel models can be adjusted according to the first special effects control parameters. Based on the target depth information, the voxel models after parameter adjustment can be translated in the shooting direction of the virtual orthogonal camera to obtain the target voxel model overlaid on the surface of the target object.

[0124] The first special effects control parameter can be a parameter for controlling special effects during the rendering of the voxel array model. It can include special effects parameters such as dithering parameters, scaling parameters, and custom appearance control parameters. The dithering parameter can control the dithering attribute of the voxel model, the scaling parameter can control the scaling attribute of the voxel model, and the custom appearance control parameter can customize and control the material attributes such as color and glow of the voxel model.

[0125] In one embodiment, the first effect control parameter may include scaling and jittering around the center point of the voxel model; for details, please refer to [link / reference]. Figure 5a It can obtain the spatial position information of the vertices of the voxel model in the target virtual scene, that is, the vertex coordinates P. vert And the coordinates of the center point of the voxel model in the target virtual scene, so that the vertex coordinates P can be determined around the center point coordinates of the voxel model. vert Scaling is performed, and a noise function N is used to randomly offset the scaling result of the voxel model's vertices. After parameter adjustment of the voxel model according to the first effect control parameter, the coordinates of the vertices of the parameter-adjusted voxel model can be expressed as follows:

[0126] P' vert =(P vert -P center )·S voxel +V·N·S voxel +P vert

[0127] Among them, P' vert P can represent the coordinates of the vertices of the voxel model after parameter adjustment. centerThis can be represented as the center point coordinates of the voxel model in the target virtual scene. There are various noise functions; for example, a randomized procedural noise function from within the game engine can be used, or the UV coordinates in the first UV information can be shifted over time, allowing the noise value to be read from the shifted noise map. V can represent the jitter parameter, used to control the degree of jitter in the voxel model; V = 0 indicates no jitter. S voxel It can be represented as the size of a voxel model.

[0128] It should be noted that when there is no need to set special effects for the voxel model and only the target object needs to be displayed in voxel form, the special effects parameters of the voxel model do not need to be adjusted. The specific settings can be made according to actual business needs, and this application embodiment does not limit them here.

[0129] After adjusting the parameters of the voxel model according to the first special effects control parameters, the adjusted voxel model can be translated along the shooting direction of the virtual orthogonal camera based on the target depth information to obtain a target voxel model covering the surface of the target object. There are several ways to translate the adjusted voxel model along the shooting direction of the virtual orthogonal camera based on the target depth information. For example, a first depth information threshold can be determined based on the scene bounding box size of the target virtual scene. The adjusted voxel model can then be filtered based on the first depth information threshold and the target depth information to obtain a filtered voxel model corresponding to the target object. Finally, the filtered voxel model can be translated along the shooting direction of the virtual orthogonal camera based on the target depth information corresponding to the filtered voxel model.

[0130] The scene bounding box size information can be the size of the bounding box of the target virtual scene, including its length, width, and height. The first depth information threshold can be a critical value for depth information. When the depth information is greater than this threshold, the pixel corresponding to that depth information can be considered background, and the corresponding voxel model can be discarded. When the depth information is not greater than this threshold, the pixel corresponding to that depth information can be considered a target object, and the corresponding voxel model can be retained. The filtered voxel model can be the voxel model after discarding voxel models of type background.

[0131] There are several ways to determine the first depth information threshold based on the scene bounding box size information of the target virtual scene. For example, in order to render voxel models that do not need to cover the surface of the target object (i.e., voxel models corresponding to the background pixels) and reduce the resource consumption of voxel model rendering, voxel models with target depth information greater than the scene bounding box can be discarded. To this end, the length, width and height of the bounding box of the target virtual scene can be obtained from the scene bounding box size information, and the length, width and height of the bounding box of the target virtual scene can be compared, so that the largest value among the length, width and height is determined as the first depth information threshold.

[0132] After determining the first depth information threshold based on the scene bounding box size of the target virtual scene, the voxel models after parameter adjustment can be filtered based on the first depth information threshold and the target depth information. There are several ways to filter the voxel models based on the first depth information threshold and the target depth information. For example, the target depth information can be compared with the first depth information threshold, thus discarding voxel models with target depth information greater than the first depth threshold and retaining those with target depth information no greater than the first depth threshold, resulting in the filtered voxel models. This avoids rendering voxel models that do not need to cover the surface of the target object, reducing the resource consumption of voxel model rendering.

[0133] After filtering the voxel models after parameter adjustment based on the first depth information threshold and the target depth information, the filtered voxel models can be translated along the shooting direction of the virtual orthogonal camera according to the target depth information corresponding to the filtered voxel models. There are several ways to translate the filtered voxel models along the shooting direction of the virtual orthogonal camera based on the target depth information. For example, the distance between the filtered voxel models and their corresponding positions on the surface of the target object can be determined based on the target depth information, and the filtered voxel models can be translated onto the surface of the target object along the shooting direction of the virtual orthogonal camera based on this distance.

[0134] In step 106, based on UV information and color information, the color parameters corresponding to the target voxel model are determined, and the target voxel model is rendered based on the color parameters to obtain the target voxel object corresponding to the target object.

[0135] The color parameter can be information describing the color of the pixels displayed in the target voxel model. The target voxel object can be an object obtained by voxelizing the target object, i.e., a target object in voxel form, which can be composed of voxel models.

[0136] There are several ways to determine the color parameters of the target voxel model based on UV and color information. For example, the second depth information threshold corresponding to the target object can be determined based on the scene bounding box size information of the target virtual scene. Based on the target depth information and the second depth information threshold, the target pixel corresponding to the target object can be identified in the pixels of the target texture. Based on the UV information and the color information corresponding to the target pixel, the color parameters corresponding to the target voxel model can be calculated.

[0137] The second depth information threshold can be a critical value for depth information. When the depth information is greater than the critical value, it indicates that the pixel corresponding to the depth information is a background area captured by the virtual orthogonal camera. When the depth information is not greater than the critical value, it indicates that the pixel corresponding to the depth information is the area where the target object is located, captured by the virtual orthogonal camera. Optionally, the second depth information threshold can be the largest value among the length, width, and height of the bounding box of the target virtual scene. The target pixel can be the pixel corresponding to the target object.

[0138] There are several ways to determine the second depth information threshold corresponding to the target object based on the scene bounding box size information of the target virtual scene. For example, please refer to [link / reference]. Figure 5a To reduce the resource consumption of voxel model rendering, which does not need to cover the surface of the target object, the length, width, and height of the bounding box of the target virtual scene can be obtained from the scene bounding box size information. The length, width, and height of the bounding box of the target virtual scene are compared, and the largest value among the length, width, and height is determined as the second depth information threshold. Based on this second depth information threshold, pixels belonging to the background area captured by the virtual orthogonal camera can be discarded, thereby reducing the consumption of rendering resources.

[0139] After determining the second depth information threshold corresponding to the target object based on the scene bounding box size information of the target virtual scene, the target pixel corresponding to the target object can be identified in the pixels of the target texture based on the target depth information and the second depth information threshold. There are several ways to identify the target pixel corresponding to the target object in the pixels of the target texture based on the target depth information and the second depth information threshold; for example, please refer to [link / reference]. Figure 5a The target depth information can be compared with a second depth threshold. Pixels with target depth information greater than the second depth threshold can be discarded, while pixels with target depth information no greater than the second depth threshold can be retained. This avoids rendering voxel models that do not need to cover the surface of the target object, reducing the resource consumption of voxel model rendering.

[0140] There are several ways to calculate the color parameters of the target voxel model based on UV information and the color information corresponding to the target pixel. For example, the UV coordinate information of each target voxel model can be obtained based on the UV information. The target color information that matches the target voxel model can be searched in the color information corresponding to the target pixel based on the UV coordinate information. The color parameters of the target voxel model can then be determined based on the target color information.

[0141] The UV coordinate information can include the coordinates of each target voxel model in the UV information. For example, it can be the UV coordinates of each target voxel model in the first UV information, i.e., the first UV coordinates. The target color information can be the color information corresponding to the target voxel model.

[0142] There are several ways to search for target color information that matches the target voxel model in the color information corresponding to the target pixel based on UV coordinate information. For example, at least one candidate pixel that is close to the UV coordinate information of the voxel model in the pixel space can be found in the target pixels of the target texture, and the target color information corresponding to the target voxel model can be calculated based on the color information of the candidate pixel.

[0143] Here, the candidate pixel can be a pixel in the pixel space that is close to the UV coordinate information corresponding to the voxel model. The number of candidate pixels corresponding to the voxel model can be set according to actual needs, for example, it can be 2 or 4. When computing resources are sufficient, more candidate pixels can be selected to obtain target color information that is closer to the color of the target object. Optionally, in order to obtain smoother color information corresponding to the voxel model, each UV coordinate information can be set to correspond to four candidate pixels. Then, a bilinear interpolation algorithm can be used to fuse the four candidate pixels corresponding to the UV coordinate information to obtain the target color information corresponding to each UV coordinate information.

[0144] There are several ways to calculate the target color information corresponding to the target voxel model based on the color information of the candidate pixel. For example, the color information of the candidate pixel corresponding to each UV coordinate information of the voxel model can be fused. For instance, bilinear interpolation can be performed on the color information of the candidate pixel corresponding to each UV coordinate information to obtain the target color information corresponding to each UV coordinate information, that is, the target color information corresponding to the target voxel model.

[0145] After finding the target color information matching the target voxel model in the color information corresponding to the target pixels based on the UV coordinate information, the color parameters corresponding to the target voxel model can be determined based on the target color information. There are several ways to determine the color parameters of the target voxel model based on the target color information. For example, one can obtain the appearance effect parameters corresponding to each voxel model, determine the color adjustment parameters from these appearance effect parameters, and adjust the target color information based on these color adjustment parameters to obtain the color parameters corresponding to the target voxel model. For instance, suppose that business requirements necessitate a color gradient display for the voxel model during the voxelization process. The appearance effect parameters of the voxel model can be designed based on the color gradient changes. For example, these parameters could be color value change functions that control the changes in pixel color information. Based on these color value change functions, the target color information can be adjusted to obtain the color parameters corresponding to the target voxel model. This allows for real-time rendering of the voxel model based on the color parameters, achieving the color gradient display effect of the voxel model during the voxelization process.

[0146] Optionally, after rendering the target voxel model based on color parameters to obtain the target voxel object corresponding to the target object, various visual effects of the target voxel object corresponding to the target object can be achieved by controlling the shape and appearance of the target voxel model. For example, the second effect control parameters for each target voxel model in the target voxel object can be obtained, and the target voxel model can be adjusted based on the effect control parameters to obtain the target voxel object after effect control.

[0147] The second special effect control parameter can be a parameter for controlling the special effects of the voxel model in the target voxel object. It can include special effect parameters such as jitter parameters, scaling parameters, and custom appearance control parameters. Based on the second special effect control parameter, the scaling and vertex offset of the voxel model in the target voxel object can be controlled, thereby achieving visual effects such as dissolving, disappearing, interference, jittering, and flashing of the target voxel object in the target virtual scene. In addition, no modification to the material of the target object is required during the special effect implementation process.

[0148] In one embodiment, the voxel object generation method provided in this application can be used to achieve the visual effect of the target object gradually appearing during shaking. For example, please refer to... Figure 5b , Figure 5bThis is a schematic diagram illustrating the special effects display of a voxel object generation method provided in this application embodiment. Taking a 3D model of a rabbit as the target object as an example, in the first stage of the special effects control process, the option to hide the target object can be enabled in the game engine, thereby hiding the target object in the target virtual scene. Then, the voxel model in the voxel array model is translated to the surface of the target object using the voxel object generation method provided in this application embodiment, and the volume and jitter of the voxel model are gradually increased, so that a jittering voxel-shaped target object gradually appears in the target virtual scene. In the second stage, the option to hide the target object can be disabled in the game engine, so that the target object can be displayed in the target virtual scene. At this time, the jittering voxel array model can completely cover the target object, and the sudden appearance of the target object will not be seen by the virtual camera. In the third stage, the volume and jitter of the voxel model covering the surface of the target object can be gradually reduced. As the voxel model shrinks, the voxel model will no longer obscure the target object, and the target object will gradually be revealed. Thus, a complete special effects process of gradually revealing the target object is completed. It should be noted that the specific special effects control parameters can be designed according to actual business needs, and this application does not impose any limitations on them. Therefore, through the voxel object generation method provided in this application embodiment, a voxel array model corresponding to the target object can be pre-made, and the voxel array model can be projected onto the surface of the target object, thereby generating the target voxel object corresponding to the target object with low consumption. Thus, by adjusting parameters such as the size, deformation, and material of the voxel model in the voxel array model, special effects control can be applied to the target voxel object, thereby achieving various different visual effects of the target object and improving the visual display effect.

[0149] In one embodiment, the voxel object generation method improved in this application can be integrated into the resource complex of a game engine to implement a visual effects scheme based on real-time rendering by the game engine. For example, please refer to... Figure 5c , Figure 5c This is a schematic diagram of the system structure of a voxel object generation method provided in an embodiment of this application. The resource complex can be composed of a voxel array model, a shading program, and a control program. The system composition allows the resource complex to be generated in the virtual scene of the game engine. The target object to be voxelized can be selected, and the voxel model in the voxel array model can be overlaid onto the surface of the target object based on the resource complex and the game engine rendering module to achieve voxelization of the target object. At the same time, special effects, appearance and other control parameters can be set according to business needs, so that the shape and appearance of the voxel model can be adjusted by controlling the control parameters to achieve various different visual effects.

[0150] As described above, this embodiment of the application obtains the UV information of the voxel array model by performing UV unwrapping on the voxel array model corresponding to the target object. The voxel array model is composed of arranged voxel models, and the target object is a 3D model object in the target virtual scene. The main camera parameters in the target virtual scene are obtained, and orthogonal camera shooting parameters for a virtual orthogonal camera that captures the target object are generated based on the main camera parameters. The target object is rendered based on the orthogonal camera shooting parameters to obtain a target texture map of the target object, which includes the depth and color information of the target object. Based on the orthogonal camera shooting parameters and the position of the target object in the target virtual scene, the voxel array model is placed in the target virtual scene. Based on the UV information and depth information, the target depth information corresponding to each voxel model in the voxel array model is determined, and multiple voxel models are overlaid onto the surface of the target object based on the target depth information to obtain a target voxel model overlaid on the surface of the target object. Based on the UV information and color information, the color parameters corresponding to the target voxel model are determined, and the target voxel model is rendered based on the color parameters to obtain the target voxel object corresponding to the target object. In this way, by generating a virtual orthogonal camera corresponding to the target object in the target virtual scene, the target object is rendered through the virtual orthogonal camera to obtain the depth and color information of the target object. The voxel array model corresponding to the target object is placed in the target virtual scene. Then, based on the depth information and the UV information corresponding to the voxel array model, the voxel model is overlaid on the corresponding position on the surface of the target object. Based on the color and UV information, the voxel model overlaid on the surface of the target object is rendered to obtain the target voxel object corresponding to the target object. This eliminates the need to render the target object multiple times when generating the voxel object of the target object, and realizes the voxelization display process of the target object with low rendering resource consumption, thereby improving the efficiency of voxel object generation.

[0151] Based on the method described in the above embodiments, the following examples will provide further detailed explanations.

[0152] In this embodiment, the voxel object generation device will be specifically integrated into a computer device as an example for explanation. The voxel object generation method is executed by a server, and the target virtual scene is a 3D scene in a game engine as an example for detailed description.

[0153] For a better description of the embodiments of this application, please refer to Figure 6 , Figure 6 Another flowchart illustrating the voxel object generation method provided in this application embodiment is shown below.

[0154] In step 201, the server performs UV unwrapping on the voxel array model corresponding to the target object to obtain the UV information of the voxel array model, obtains the main camera parameters in the target virtual scene, and generates the orthogonal camera shooting parameters of the virtual orthogonal camera that shoots the target object based on the main camera parameters.

[0155] Optionally, the server can perform UV unwrapping on the voxel array model corresponding to the target object in several ways, for example, please refer to... Figure 3 The voxel array model is composed of multiple voxel models. The server can perform planar projection processing on the voxel array model to obtain the first UV information of the voxel array model. Based on the first UV information, the vertex coordinates of each voxel model in the first UV information are obtained, and the center point coordinates of each voxel model in the first UV information are calculated based on the vertex coordinates. Based on the center point coordinates of each voxel in the first UV information, the second UV information is obtained.

[0156] There are several ways for the server to generate the orthogonal camera shooting parameters of the virtual orthogonal camera for shooting the target object based on the main camera parameters. For example, the server can extract the position information of the virtual main camera in the target virtual scene from the main camera parameters to obtain the second position information, obtain the position information of the object center point and the bounding box size information of the target object in the target virtual scene, and determine the orthogonal camera shooting parameters of the virtual orthogonal camera for shooting the target object based on the second position information, the object center point position information and the bounding box size information.

[0157] There are several ways for the server to determine the orthogonal camera shooting parameters of the virtual orthogonal camera that is shooting the target object based on the second position information, the object center point position information, and the bounding box size information. For example, the server can calculate the direction vector of the virtual orthogonal camera in the target virtual scene based on the second position information and the object center point position information to obtain the shooting direction vector. Based on the shooting direction vector, the object center point position information, and the bounding box size information, the server can calculate the position of the virtual orthogonal camera in the target virtual scene to obtain the first position information. The shooting direction vector and the first position information are then used as the orthogonal camera shooting parameters of the virtual orthogonal camera.

[0158] The server can calculate the direction vector of the virtual orthogonal camera in the target virtual scene based on the second location information and the object's center point location information in several ways. For example, the virtual orthogonal camera can be positioned on the same plane as the virtual main camera and the target object. (See reference...) Figure 4a Taking a 3D rabbit model as an example, let's assume the position of the virtual main camera in the target virtual scene, i.e., the second position information, is P. camThe location information of the center point of the target object can be represented as P. obj Then we can obtain the vector v = P obj -P cam Since the virtual orthogonal camera uses orthogonal projection, and the pitch angle of the projection direction is 0, the server can project the vector v onto the horizontal plane (z = 0), and then normalize the projected vector v to obtain the direction vector of the virtual orthogonal camera in the target virtual scene. That is, the shooting direction vector can be expressed as...

[0159] v ortho_ =normalize(v x v y ,0)

[0160] After calculating the direction vector of the virtual orthogonal camera in the target virtual scene based on the second location information and the object's center point location information, the server can then calculate the virtual orthogonal camera's position in the target virtual scene based on the shooting direction vector, the object's center point location information, and the bounding box size information, thus obtaining the first location information. There are several ways the server can calculate the virtual orthogonal camera's position in the target virtual scene based on the shooting direction vector, the object's center point location information, and the bounding box size information. For example, to ensure the virtual orthogonal camera can completely capture the target object, the server can determine a position where the target object can be completely captured based on the bounding box size of the target object. For instance, the virtual orthogonal camera can be placed in front of the target object to avoid intersection or occlusion. For further information, please refer to [link / reference needed]. Figure 4a The virtual orthographic camera can be positioned in front of the bounding box of the target object. Optionally, to capture complete images of the target object from multiple angles, the maximum size of the target object's bounding box can be obtained, and the distance between the virtual orthographic camera and the target object can be determined as this maximum size. For example, the length, width, and height of the bounding box corresponding to the target object can be constructed into a vector B = (B... x B y B z If the position of the virtual orthogonal camera is such that..., then the position of the virtual orthogonal camera can be represented as...

[0161] P ortho_ =P obj -max(B x B y B z )·v ortho_

[0162] The orthogonal projection size of the virtual orthogonal camera is max(B). x B y Bz ), max(B x B y B z ) indicates taking B x B y B z The maximum value among the length, width, and height of the bounding box of the virtual orthogonal camera is selected so that the distance between the virtual orthogonal camera and the target object is the largest among the length, width, and height of the target object's bounding box. This ensures that the virtual orthogonal camera does not intersect with the target object, and the shooting range of the virtual orthogonal camera can surround the bounding box of the target object, thus allowing the target object to be captured completely.

[0163] In this way, the server can use the shooting direction vector and the first position information as the shooting parameters of the virtual orthogonal camera, and thus generate a virtual orthogonal camera in the target virtual scene that can completely capture the target object based on the shooting parameters of the orthogonal camera.

[0164] In step 202, the server renders the target object based on the orthogonal camera shooting parameters to obtain the target texture of the target object. Based on the shooting direction vector in the orthogonal camera shooting parameters, the voxel array model is rotated. Based on the first position information in the orthogonal camera shooting parameters, the rotated voxel array model is placed between the target object and the virtual orthogonal camera.

[0165] The target texture can include the depth and color information of the target object. The target texture can be a four-channel RGBA texture. When rendering the target object, the server can write the color information of the target object into the color channel (RGB channel) and the depth information into the depth channel (A channel) to obtain the target texture.

[0166] Among them, the server can perform model rotation processing on the voxel array model based on the shooting direction vector in the shooting parameters of the orthogonal camera in various ways. For example, in order to facilitate the voxelization display of the target object, the server can rotate the direction of the voxel array model to be the same as the direction vector of the virtual orthogonal camera, so that the direction vector of the virtual orthogonal camera is perpendicular to the plane of the voxel array model.

[0167] After rotating the voxel array model based on the shooting direction vector in the orthogonal camera's shooting parameters, the server can then place the rotated voxel array model between the target object and the virtual orthogonal camera based on the first position information in the orthogonal camera's shooting parameters. There are several ways the server can place the rotated voxel array model between the target object and the virtual orthogonal camera based on the first position information in the orthogonal camera's shooting parameters; for example, please refer to... Figure 4c The voxel array model after rotation can be placed at the location of the virtual orthogonal camera, that is, at the location corresponding to the first position information. In the projection view of the virtual orthogonal camera, the voxel array model can completely occlude the target object.

[0168] In step 203, the server determines the matching relationship between the voxel model and the pixels in the target texture based on the correspondence between the target object and the voxel array model in the shooting direction of the virtual orthogonal camera, and obtains the center point position information of each voxel model based on UV information.

[0169] The matching relationship can be a mapping between voxel models and pixels in the target texture. For example, assuming there is a region 'a' in the target object, based on the correspondence between the target object and the voxel array model in the shooting direction of the virtual orthogonal camera, the server can determine the voxel model 'b' corresponding to region 'a' in the voxel array model. And based on the correspondence between the target texture and the target object, the server can determine the pixel 'c' corresponding to region 'a' in the pixels of the target texture. Therefore, there is a matching relationship between voxel model 'b' and pixel 'c' in the target texture. The center point location information can be the location information of the center point of the voxel model in the UV information. For example, please refer to [reference needed]. Figure 3 The center point location information can be the coordinates of the voxel model in the second UV information, i.e., the second UV coordinates.

[0170] In step 204, the server obtains the vertex spatial position information of the voxel array model in the target virtual scene. Based on the vertex spatial position information and the center point position information, the server determines the voxel spatial position information of each voxel model in the target virtual scene. Based on the voxel spatial position information and the matching relationship, the server determines the target depth information corresponding to each voxel model in the voxel array model.

[0171] There are several ways for the server to determine the voxel spatial position information of each voxel model in the target virtual scene based on vertex spatial position information and center point position information. For example, the server can use a linear interpolation algorithm to calculate the voxel spatial position information of each voxel model in the target virtual scene based on the center point position information of each voxel model and the vertex spatial position information of the voxel array model. For example, assuming that the center point position information can be the second UV coordinates corresponding to each voxel array model, and the spatial position information can be the coordinates of the center point of the voxel model in the target virtual scene, i.e., the center point coordinates, please refer to [reference needed]. Figure 5a , Figure 5aThis is another specific flowchart illustrating a voxel object generation method provided in this application embodiment. The process shown in the diagram can be executed by a graphics processing unit (GPU). The CPU can obtain the second UV information and the vertex spatial position information of the voxel array model to interpolate and calculate the center point coordinates of the voxel model. Specifically, it is assumed that the vertex spatial position information of the voxel array model is the spatial position coordinates P of the upper left vertex. lt The spatial coordinates of the upper right vertex P rt The spatial coordinates of the lower left vertex, P lb The spatial coordinates of the lower right vertex P rb Therefore, a linear interpolation algorithm can be used to calculate the center point coordinates of the voxel model. For example, the interpolation calculation process can be represented as follows:

[0172] P temp1 =lerp(P lt ,P rt (UV0.x)

[0173] P temp2 =lerp(P lb ,P rb (UV0.x)

[0174] P center =lerp(P temp1 ,P temp2 ,UV0.y)

[0175] Where lerp(a,b,alpha) can be represented as a linear interpolation function, which can be a bilinear interpolation function. a and b represent the range of linear interpolation calculations, alpha can be the interpolation weight, UV0.x can represent the interpolation weight in the horizontal direction of the second UV information, i.e., the value of the horizontal coordinate of each second UV coordinate in the second UV information, and UV0.y can represent the interpolation weight in the vertical direction of the second UV information, i.e., the value of the vertical coordinate of each second UV coordinate in the second UV information. P temp1 It can be represented as a linear interpolation result between the spatial coordinates of the top-left vertex and the spatial coordinates of the top-right vertex, P. temp2 It can be represented as the linear interpolation result between the spatial coordinates of the lower left vertex and the spatial coordinates of the lower right vertex, P. center It can be represented as the coordinates of the center point of each voxel model.

[0176] After determining the voxel spatial position information of each voxel model in the target virtual scene based on vertex spatial position information and center point position information, the server can determine the target depth information corresponding to each voxel model in the voxel array model according to the voxel spatial position information and matching relationships. There are several ways for the server to determine the target depth information corresponding to each voxel model in the voxel array model based on the voxel spatial position information and matching relationships. For example, the server can search for pixels in the target texture that match the voxel spatial position information of each voxel model in the voxel array model according to the matching relationships, and obtain the target depth information corresponding to each voxel model in the voxel array model based on the depth information of that pixel in the depth channel.

[0177] In step 205, the server obtains the first special effects control parameters corresponding to the target object, performs parameter adjustment processing on the voxel model according to the first special effects control parameters, and translates the parameter-adjusted voxel model in the shooting direction of the virtual orthogonal camera based on the target depth information to obtain the target voxel model covering the surface of the target object.

[0178] In one embodiment, the first effect control parameter may include scaling and jittering around the center point of the voxel model; for details, please refer to [link / reference]. Figure 5a The server can obtain the spatial location information of the vertices of the voxel model in the target virtual scene, that is, the vertex coordinates P. vert And the coordinates of the center point of the voxel model in the target virtual scene, so that the vertex coordinates P can be determined around the center point coordinates of the voxel model. vert Scaling is performed, and a noise function N is used to randomly offset the scaling result of the voxel model's vertices. After parameter adjustment of the voxel model according to the first effect control parameter, the coordinates of the vertices of the parameter-adjusted voxel model can be expressed as follows:

[0179] P' vert =(P vert -P center )·S voxel +V·N·S voxel +P vert

[0180] Among them, P' vert P can represent the coordinates of the vertices of the voxel model after parameter adjustment. centerThis can be represented as the center point coordinates of the voxel model in the target virtual scene. There are various noise functions; for example, a randomized procedural noise function from within the game engine can be used, or the UV coordinates in the first UV information can be shifted over time, allowing the noise value to be read from the shifted noise map. V can represent the jitter parameter, used to control the degree of jitter in the voxel model; V = 0 indicates no jitter. S voxel It can be represented as the size of a voxel model.

[0181] It should be noted that when there is no need to set special effects for the voxel model and only the target object needs to be displayed in voxel form, the server does not need to adjust the special effects parameters of the voxel model. The specific settings can be made according to actual business needs, and this application embodiment does not limit it here.

[0182] After adjusting the voxel model according to the first special effects control parameters, the server can translate the adjusted voxel model along the shooting direction of the virtual orthogonal camera based on the target depth information, thus obtaining a target voxel model covering the surface of the target object. There are several ways the server can translate the adjusted voxel model along the shooting direction of the virtual orthogonal camera based on the target depth information. For example, the server can determine a first depth information threshold based on the scene bounding box size of the target virtual scene, filter the adjusted voxel model based on the first depth information threshold and the target depth information, obtain a filtered voxel model corresponding to the target object, and then translate the filtered voxel model along the shooting direction of the virtual orthogonal camera based on the target depth information corresponding to the filtered voxel model.

[0183] In step 206, the server determines the second depth information threshold corresponding to the target object based on the scene bounding box size information of the target virtual scene, and identifies the target pixel corresponding to the target object in the pixels of the target texture based on the target depth information and the second depth information threshold.

[0184] There are several ways for the server to determine the second depth information threshold corresponding to the target object based on the scene bounding box size information of the target virtual scene. For example, please refer to [link / reference]. Figure 5a In order to render voxel models that do not need to cover the surface of the target object and reduce the resource consumption of voxel model rendering, the server can obtain the length, width and height of the bounding box of the target virtual scene from the scene bounding box size information, and compare the length, width and height of the bounding box of the target virtual scene. The largest value among the length, width and height is determined as the second depth information threshold. Based on the second depth information threshold, pixels belonging to the background area captured by the virtual orthogonal camera can be discarded, thereby reducing the consumption of rendering resources.

[0185] After determining the second depth information threshold corresponding to the target object based on the scene bounding box size information of the target virtual scene, the server can then identify the target pixel corresponding to the target object within the pixels of the target texture based on the target depth information and the second depth information threshold. There are several ways the server can identify the target pixel corresponding to the target object within the pixels of the target texture based on the target depth information and the second depth information threshold; for example, please refer to [further details omitted]. Figure 5a The server can compare the target depth information with a second depth threshold, discarding pixels whose target depth information is greater than the second depth threshold and retaining pixels whose target depth information is not greater than the second depth threshold. This avoids rendering voxel models that do not need to cover the surface of the target object, reducing the resource consumption of voxel model rendering.

[0186] In step 207, the server calculates the color parameters corresponding to the target voxel model based on the UV information and the color information corresponding to the target pixel, and performs rendering processing on the target voxel model based on the color parameters to obtain the target voxel object corresponding to the target object.

[0187] There are several ways for the server to calculate the color parameters of the target voxel model based on UV information and the color information corresponding to the target pixel. For example, the server can obtain the UV coordinate information corresponding to each target voxel model based on the UV information, search for the target color information that matches the target voxel model in the color information corresponding to the target pixel based on the UV coordinate information, and determine the color parameters of the target voxel model based on the target color information.

[0188] There are several ways for the server to search for target color information that matches the target voxel model in the color information corresponding to the target pixel based on the UV coordinate information. For example, the server can find at least one candidate pixel in the target pixel of the target texture that is close to the UV coordinate information of the voxel model in the pixel space, and calculate the target color information corresponding to the target voxel model based on the color information of the candidate pixel.

[0189] There are several ways for the server to calculate the target color information corresponding to the target voxel model based on the color information of the candidate pixel. For example, the server can perform fusion processing on the color information of the candidate pixels corresponding to each UV coordinate information of the voxel model. For instance, the server can perform bilinear interpolation processing on the color information of the candidate pixels corresponding to each UV coordinate information to obtain the target color information corresponding to each UV coordinate information, that is, the target color information corresponding to the target voxel model.

[0190] After the server searches for target color information matching the target voxel model in the color information corresponding to the target pixels based on the UV coordinate information, it can determine the color parameters corresponding to the target voxel model based on the target color information. There are several ways the server can determine the color parameters corresponding to the target voxel model based on the target color information. For example, the server can obtain the appearance effect parameters corresponding to each voxel model, determine the color adjustment parameters from these appearance effect parameters, and adjust the target color information based on these color adjustment parameters to obtain the color parameters corresponding to the target voxel model. For instance, suppose that business requirements require a color gradient display of the voxel model during the voxelization process. The appearance effect parameters of the voxel model can be designed based on the color gradient changes. For example, it can be a color value change function that controls the change of pixel color information. Therefore, the target color information can be adjusted based on this color value change function to obtain the color parameters corresponding to the target voxel model. This allows for real-time rendering of the voxel model based on the color parameters, achieving the color gradient display effect of the voxel model during the voxelization process.

[0191] In step 208, the server obtains the second special effects control parameters for each target voxel model in the target voxel object, and performs parameter adjustment processing on the target voxel model based on the special effects control parameters to obtain the target voxel object after special effects control.

[0192] The second special effect control parameter can be a parameter for controlling the special effects of the voxel model in the target voxel object. It can include special effect parameters such as jitter parameters, scaling parameters, and custom appearance control parameters. Based on the second special effect control parameter, the scaling and vertex offset of the voxel model in the target voxel object can be controlled, thereby achieving visual effects such as dissolving, disappearing, interference, jittering, and flashing of the target voxel object in the target virtual scene. In addition, no modification to the material of the target object is required during the special effect implementation process.

[0193] In one embodiment, the voxel object generation method improved in this application can be integrated into the resource complex of a game engine to implement a visual effects scheme based on real-time rendering by the game engine. For example, please refer to... Figure 5c The resource complex can be composed of a voxel array model, a shader program, and a control program. The system composition allows the server to generate the resource complex in the virtual scene of the game engine and select the target object to be voxelized. Based on the resource complex and the game engine rendering module, the voxel model in the voxel array model can be overlaid onto the surface of the target object to achieve voxelization of the target object. At the same time, special effects, appearance and other control parameters can be set according to business needs. Thus, the shape and appearance of the voxel model can be adjusted by controlling the parameters to achieve various different visual effects.

[0194] As described above, in this embodiment, the server performs UV unwrapping on the voxel array model corresponding to the target object to obtain the UV information of the voxel array model, acquires the main camera parameters in the target virtual scene, and generates orthogonal camera shooting parameters for the virtual orthogonal camera that shoots the target object based on the main camera parameters. The server renders the target object based on the orthogonal camera shooting parameters to obtain the target texture of the target object. Based on the shooting direction vector in the orthogonal camera shooting parameters, the server rotates the voxel array model. Based on the first position information in the orthogonal camera shooting parameters, the server places the rotated voxel array model between the target object and the virtual orthogonal camera. The server determines the matching relationship between the voxel model and the pixels in the target texture based on the correspondence between the target object and the voxel array model in the shooting direction of the virtual orthogonal camera, and acquires the center point position information of each voxel model based on the UV information. The server acquires the vertex spatial position information of the voxel array model in the target virtual scene, and determines the voxel space of each voxel model in the target virtual scene based on the vertex spatial position information and the center point position information. Based on the spatial location information of voxels and matching relationships, the server determines the target depth information corresponding to each voxel model in the voxel array model. The server obtains the first special effects control parameters corresponding to the target object, adjusts the parameters of the voxel model according to the first special effects control parameters, and translates the parameter-adjusted voxel model in the shooting direction of the virtual orthogonal camera based on the target depth information to obtain the target voxel model covering the surface of the target object. The server determines the second depth information threshold corresponding to the target object according to the scene bounding box size information of the target virtual scene, and identifies the target pixel corresponding to the target object in the pixels of the target texture according to the target depth information and the second depth information threshold. The server calculates the color parameters corresponding to the target voxel model based on the UV information and the color information corresponding to the target pixel, and renders the target voxel model based on the color parameters to obtain the target voxel object corresponding to the target object. The server obtains the second special effects control parameters for each target voxel model in the target voxel object, adjusts the parameters of the target voxel model based on the special effects control parameters, and obtains the target voxel object after special effects control.Therefore, by generating a virtual orthogonal camera corresponding to the target object in the target virtual scene, the target object is rendered through the virtual orthogonal camera to obtain the depth and color information of the target object. The voxel array model corresponding to the target object is placed in the target virtual scene. Then, based on the depth information and the UV information of the voxel array model, the voxel model is overlaid on the corresponding position on the surface of the target object. Based on the color and UV information, the voxel model overlaid on the surface of the target object is rendered to obtain the target voxel object corresponding to the target object. This eliminates the need to render the target object multiple times when generating the voxel object of the target object, realizing the voxelization display process of the target object with low rendering resource consumption. At the same time, the pixels in the target texture are filtered by the depth information of each pixel to discard pixels belonging to the background area, avoiding rendering voxel models that do not need to be overlaid on the surface of the target object, further reducing the resource consumption of voxel model rendering, and thus improving the efficiency of voxel object generation. Furthermore, different visual effects can be achieved by controlling the parameters of the voxel model during the voxelization display of the target object. At the same time, the effects of the target voxel object can be controlled by adjusting the size, deformation, material and other parameters of the voxel model in the voxel array model, thereby achieving a variety of different visual effects of the target object and improving the visual display effect.

[0195] To better implement the above methods, embodiments of the present invention also provide a voxel object generation apparatus, which can be integrated into a computer device, which can be a server.

[0196] For example, such as Figure 7 The diagram shown is a schematic representation of the voxel object generation apparatus provided in this embodiment. The voxel object generation apparatus may include an unfolding unit 301, an acquisition unit 302, a rendering unit 303, a placement unit 304, an overlay unit 305, and a determination unit 306, as follows:

[0197] The unfolding unit 301 is used to perform UV unfolding on the voxel array model corresponding to the target object to obtain the UV information of the voxel array model. The voxel array model is composed of voxel models arranged together. The target object is a three-dimensional model object in the target virtual scene.

[0198] The acquisition unit 302 is used to acquire the main camera parameters in the target virtual scene, and generate the orthogonal camera shooting parameters of the virtual orthogonal camera that shoots the target object based on the main camera parameters;

[0199] The rendering unit 303 is used to render the target object based on the shooting parameters of the orthogonal camera to obtain a target texture of the target object, which includes the depth information and color information of the target object.

[0200] Placement unit 304 is used to place the voxel array model in the target virtual scene based on the shooting parameters of the orthogonal camera and the position of the target object in the target virtual scene;

[0201] The covering unit 305 is used to determine the target depth information corresponding to each voxel model in the voxel array model according to the UV information and the depth information, and to cover multiple voxel models onto the surface of the target object according to the target depth information to obtain a target voxel model covered on the surface of the target object.

[0202] The determining unit 306 is used to determine the color parameters corresponding to the target voxel model based on the UV information and the color information, and to perform rendering processing on the target voxel model based on the color parameters to obtain the target voxel object corresponding to the target object.

[0203] In one embodiment, the covering unit 305 includes:

[0204] The matching relationship determination subunit is used to determine the matching relationship between the voxel model and the pixels in the target texture based on the correspondence between the target object and the voxel array model in the shooting direction of the virtual orthogonal camera.

[0205] The center point location information acquisition subunit is used to acquire the center point location information of each voxel model based on the UV information.

[0206] The depth sampling subunit is used to perform depth sampling processing on the depth information based on the center point position information and the matching relationship to obtain the target depth information corresponding to each voxel model in the voxel array model.

[0207] In one embodiment, the depth sampling subunit includes:

[0208] The vertex spatial position information acquisition module is used to acquire the vertex spatial position information of the voxel array model in the target virtual scene;

[0209] The spatial location information determination module is used to determine the voxel spatial location information of each voxel model in the target virtual scene based on the vertex spatial location information and the center point location information;

[0210] The target depth information determination module is used to determine the target depth information corresponding to each voxel model in the voxel array model based on the voxel spatial location information and the matching relationship.

[0211] In one embodiment, the covering unit 305 includes:

[0212] The first special effects control parameter acquisition subunit is used to acquire the first special effects control parameters corresponding to the target object;

[0213] The parameter adjustment subunit is used to adjust the parameters of the voxel model according to the first special effect control parameter.

[0214] The translation subunit is used to translate the parameter-adjusted voxel model in the shooting direction of the virtual orthogonal camera based on the target depth information, so as to obtain a target voxel model covering the surface of the target object.

[0215] In one embodiment, the translation subunit includes:

[0216] The first depth information threshold determination module is used to determine the first depth information threshold based on the scene bounding box size information of the target virtual scene.

[0217] The voxel filtering module is used to filter the voxel model after parameter adjustment based on the first depth information threshold and the target depth information to obtain the filtered voxel model corresponding to the target object.

[0218] The voxel translation module is used to translate the selected voxel model in the shooting direction of the virtual orthogonal camera based on the target depth information corresponding to the selected voxel model.

[0219] In one embodiment, the determining unit 306 includes:

[0220] The second depth information threshold determination subunit is used to determine the second depth information threshold corresponding to the target object based on the scene bounding box size information of the target virtual scene.

[0221] The target pixel recognition subunit is used to identify the target pixel corresponding to the target object in the pixels of the target texture based on the target depth information and the second depth information threshold.

[0222] The color parameter calculation subunit is used to calculate the color parameters corresponding to the target voxel model based on the UV information and the color information corresponding to the target pixel.

[0223] In one embodiment, the color parameter calculation subunit includes:

[0224] The coordinate information acquisition module is used to acquire the UV coordinate information corresponding to each target voxel model based on the UV information.

[0225] The candidate color information search module is used to search for target color information that matches the target voxel model in the color information corresponding to the target pixel based on the UV coordinate information.

[0226] The color parameter determination module is used to determine the color parameters corresponding to the target voxel model based on the target color information.

[0227] In one embodiment, the orthogonal camera's shooting parameters include first position information and a shooting direction vector, and the placement unit 304 includes:

[0228] The model rotation sub-unit is used to perform model rotation processing on the voxel array model based on the shooting direction vector in the shooting parameters of the orthogonal camera.

[0229] The model placement subunit is used to place the rotated voxel array model between the target object and the virtual orthogonal camera based on the first position information in the orthogonal camera's shooting parameters.

[0230] In one embodiment, the acquisition unit 302 includes:

[0231] The location information extraction subunit is used to extract the location information of the virtual main camera in the target virtual scene from the main camera parameters, and obtain the second location information.

[0232] The information acquisition subunit is used to acquire the object center point location information and bounding box size information of the target object in the target virtual scene.

[0233] The parameter determination subunit is used to determine the orthogonal camera shooting parameters of the virtual orthogonal camera that shoots the target object based on the second position information, the object center point position information, and the bounding box size information.

[0234] In one embodiment, the parameter determines the subunit, including:

[0235] The orientation vector calculation module is used to calculate the orientation vector of the virtual orthogonal camera that captures the target object in the virtual scene of the target object based on the second position information and the position information of the object's center point, so as to obtain the shooting orientation vector.

[0236] The position information calculation module is used to calculate the position of the virtual orthogonal camera in the target virtual scene based on the shooting direction vector, the position information of the object center point, and the bounding box size information, and obtain the first position information;

[0237] The parameter setting module is used to use the shooting direction vector and the first position information as the orthogonal camera shooting parameters of the virtual orthogonal camera.

[0238] In one embodiment, the voxel object generation apparatus further includes:

[0239] The second special effects control parameter acquisition unit is used to acquire the second special effects control parameters for each target voxel model in the target voxel object.

[0240] The parameter adjustment processing unit is used to perform parameter adjustment processing on the target voxel model based on the special effect control parameters to obtain the target voxel object after special effect control.

[0241] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.

[0242] As can be seen from the above, in this embodiment, the unfolding unit 301 performs UV unwrapping on the voxel array model corresponding to the target object to obtain the UV information of the voxel array model. The voxel array model is composed of arranged voxel models, and the target object is a 3D model object in the target virtual scene. The acquisition unit 302 acquires the main camera parameters in the target virtual scene and generates orthogonal camera shooting parameters for the virtual orthogonal camera that shoots the target object based on the main camera parameters. The rendering unit 303 renders the target object based on the orthogonal camera shooting parameters to obtain the target texture of the target object. The target texture includes the depth information and color information of the target object. The placement unit 304 places the voxel array model in the target virtual scene based on the shooting parameters of the orthogonal camera and the position of the target object in the target virtual scene; the overlay unit 305 determines the target depth information corresponding to each voxel model in the voxel array model according to the UV information and depth information, and overlays multiple voxel models onto the surface of the target object according to the target depth information to obtain the target voxel model overlaid on the surface of the target object; the determination unit 306 determines the color parameters corresponding to the target voxel model based on the UV information and color information, and performs rendering processing on the target voxel model based on the color parameters to obtain the target voxel object corresponding to the target object. In this way, by generating a virtual orthogonal camera corresponding to the target object in the target virtual scene, the target object is rendered through the virtual orthogonal camera to obtain the depth and color information of the target object. The voxel array model corresponding to the target object is placed in the target virtual scene. Then, based on the depth information and the UV information corresponding to the voxel array model, the voxel model is overlaid on the corresponding position on the surface of the target object. Based on the color and UV information, the voxel model overlaid on the surface of the target object is rendered to obtain the target voxel object corresponding to the target object. This eliminates the need to render the target object multiple times when generating the voxel object of the target object, and realizes the voxelization display process of the target object with low rendering resource consumption, thereby improving the efficiency of voxel object generation.

[0243] This application also provides a computer device, such as... Figure 8As shown, it illustrates a structural diagram of a computer device involved in an embodiment of this application. This computer device may be a server, specifically:

[0244] The computer device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 8 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0245] Processor 401 is the control center of the computer device, connecting various parts of the computer device through various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in memory 402, and by calling data stored in memory 402. Optionally, processor 401 may include one or more processing cores; preferably, processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into processor 401.

[0246] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and voxel object generation by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0247] The computer device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0248] The computer device may also include an input unit 404, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0249] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the computer device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:

[0250] The process involves UV unwrapping of the voxel array model corresponding to the target object to obtain its UV information. The voxel array model is composed of arranged voxel models, and the target object is a 3D model object in the target virtual scene. The process also includes obtaining the parameters of the main camera in the target virtual scene and generating orthogonal camera shooting parameters for a virtual orthogonal camera to capture the target object. Based on these parameters, the target object is rendered to obtain its target texture, which includes depth and color information. The voxel array model is placed in the target virtual scene based on the orthogonal camera shooting parameters and the target object's position. The target depth information for each voxel model in the voxel array model is determined based on the UV and depth information, and multiple voxel models are overlaid onto the surface of the target object to obtain the target voxel model overlaid on the target object's surface. Finally, the color parameters for the target voxel model are determined based on the UV and color information, and the target voxel model is rendered based on these color parameters to obtain the target voxel object corresponding to the target object.

[0251] The specific implementation of each of the above operations can be found in the preceding embodiments, and will not be repeated here. It should be noted that the computer device provided in this application embodiment and the voxel object generation method in the above embodiments belong to the same concept, and its specific implementation process can be found in the above method embodiments, and will not be repeated here.

[0252] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0253] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the voxel object generation methods provided in embodiments of this application. For example, the instructions can execute the following steps:

[0254] The process involves UV unwrapping of the voxel array model corresponding to the target object to obtain its UV information. The voxel array model is composed of arranged voxel models, and the target object is a 3D model object in the target virtual scene. The process also includes obtaining the parameters of the main camera in the target virtual scene and generating orthogonal camera shooting parameters for a virtual orthogonal camera to capture the target object. Based on these parameters, the target object is rendered to obtain its target texture, which includes depth and color information. The voxel array model is placed in the target virtual scene based on the orthogonal camera shooting parameters and the target object's position. The target depth information for each voxel model in the voxel array model is determined based on the UV and depth information, and multiple voxel models are overlaid onto the surface of the target object to obtain the target voxel model overlaid on the target object's surface. Finally, the color parameters for the target voxel model are determined based on the UV and color information, and the target voxel model is rendered based on these color parameters to obtain the target voxel object corresponding to the target object.

[0255] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0256] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the voxel object generation methods provided in the embodiments of this application, the beneficial effects that any of the voxel object generation methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0257] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above embodiments.

[0258] The present application provides a detailed description of a voxel object generation method, apparatus, and computer-readable storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present application. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present application. Therefore, the content of this specification should not be construed as a limitation of the present application.

Claims

1. A method for generating voxel objects, characterized in that, include: The UV unwrapping of the voxel array model corresponding to the target object is performed to obtain the UV information of the voxel array model. The voxel array model is composed of voxel models arranged together. The target object is a three-dimensional model object in the target virtual scene. Obtain the main camera parameters in the target virtual scene, and generate orthogonal camera shooting parameters for the virtual orthogonal camera to shoot the target object based on the main camera parameters; The target object is rendered based on the orthogonal camera shooting parameters to obtain a target texture of the target object, the target texture including the depth information and color information of the target object; Based on the orthogonal camera shooting parameters and the position of the target object in the target virtual scene, the voxel array model is placed in the target virtual scene; Based on the UV information and the depth information, the target depth information corresponding to each voxel model in the voxel array model is determined, and multiple voxel models are overlaid onto the surface of the target object based on the target depth information to obtain a target voxel model overlaid on the surface of the target object. Based on the UV information and the color information, the color parameters corresponding to the target voxel model are determined, and the target voxel model is rendered based on the color parameters to obtain the target voxel object corresponding to the target object.

2. The voxel object generation method as described in claim 1, characterized in that, The step of determining the target depth information corresponding to each voxel model in the voxel array model based on the UV information and the depth information includes: Based on the correspondence between the target object and the voxel array model in the shooting direction of the virtual orthogonal camera, determine the matching relationship between the voxel model and the pixels in the target texture; Based on the UV information, obtain the center point location information of each voxel model; Based on the center point location information and the matching relationship, depth sampling processing is performed on the depth information to obtain the target depth information corresponding to each voxel model in the voxel array model.

3. The voxel object generation method as described in claim 2, characterized in that, The step of performing depth sampling processing on the depth information based on the center point position information and the matching relationship to obtain the target depth information corresponding to each voxel model in the voxel array model includes: Obtain the vertex spatial position information of the voxel array model in the target virtual scene; Based on the vertex spatial position information and the center point position information, the voxel spatial position information of each voxel model in the target virtual scene is determined; Based on the voxel spatial location information and the matching relationship, the target depth information corresponding to each voxel model in the voxel array model is determined.

4. The voxel object generation method as described in claim 1, characterized in that, The step of overlaying multiple voxel models onto the surface of the target object based on the target depth information to obtain a target voxel model overlaid on the surface of the target object includes: Obtain the first special effects control parameters corresponding to the target object; The voxel model is adjusted according to the first special effects control parameters; Based on the target depth information, the voxel model after parameter adjustment is translated in the shooting direction of the virtual orthogonal camera to obtain a target voxel model covering the surface of the target object.

5. The voxel object generation method as described in claim 4, characterized in that, The step of translating the voxel model, after parameter adjustment, based on the target depth information, along the shooting direction of the virtual orthogonal camera includes: A first depth information threshold is determined based on the scene bounding box size information of the target virtual scene; Based on the first depth information threshold and the target depth information, the voxel model after parameter adjustment is filtered to obtain the filtered voxel model corresponding to the target object. Based on the target depth information corresponding to the selected voxel model, the selected voxel model is translated in the shooting direction of the virtual orthogonal camera.

6. The voxel object generation method as described in claim 1, characterized in that, The step of determining the color parameters corresponding to the target voxel model based on the UV information and the color information includes: The second depth information threshold corresponding to the target object is determined based on the scene bounding box size information of the target virtual scene; Based on the target depth information and the second depth information threshold, the target pixel corresponding to the target object is identified in the pixels of the target texture; Based on the UV information and the color information corresponding to the target pixel, the color parameters corresponding to the target voxel model are calculated.

7. The voxel object generation method as described in claim 6, characterized in that, The step of calculating the color parameters corresponding to the target voxel model based on the UV information and the color information corresponding to the target pixel includes: Based on the UV information, obtain the UV coordinate information corresponding to each target voxel model; Based on the UV coordinate information, the target color information that matches the target voxel model is searched in the color information corresponding to the target pixel; The color parameters corresponding to the target voxel model are determined based on the target color information.

8. The voxel object generation method as described in claim 1, characterized in that, The orthogonal camera shooting parameters include first position information and shooting direction vector. The step of placing the voxel array model in the target virtual scene based on the orthogonal camera shooting parameters and the position of the target object in the target virtual scene includes: Based on the shooting direction vector in the orthogonal camera shooting parameters, the voxel array model is rotated. Based on the first position information in the orthogonal camera shooting parameters, the voxel array model after model rotation processing is placed between the target object and the virtual orthogonal camera.

9. The voxel object generation method as described in claim 1, characterized in that, The step of generating orthogonal camera shooting parameters for a virtual orthogonal camera to shoot the target object based on the main camera parameters includes: The position information of the virtual main camera in the target virtual scene is extracted from the main camera parameters to obtain the second position information; Obtain the object center point position information and bounding box size information of the target object in the target virtual scene; Based on the second location information, the object center point location information, and the bounding box size information, the orthogonal camera shooting parameters of the virtual orthogonal camera for shooting the target object are determined.

10. The voxel object generation method as described in claim 9, characterized in that, The step of determining the orthogonal camera shooting parameters for the virtual orthogonal camera to shoot the target object based on the second location information, the object center point location information, and the bounding box size information includes: Based on the second location information and the object center point location information, the direction vector of the virtual orthogonal camera that captures the target object in the target virtual scene is calculated to obtain the shooting direction vector; Based on the shooting direction vector, the object center point position information, and the bounding box size information, the position of the virtual orthogonal camera in the target virtual scene is calculated to obtain the first position information; The shooting direction vector and the first position information are used as the orthogonal camera shooting parameters of the virtual orthogonal camera.

11. The voxel object generation method according to any one of claims 1 to 10, characterized in that, After rendering the target voxel model based on the color parameters to obtain the target voxel object corresponding to the target object, the process includes: Obtain the second special effects control parameters for each target voxel model in the target voxel object; Based on the special effects control parameters, the target voxel model is adjusted to obtain the target voxel object after special effects control.

12. A voxel object generation apparatus, characterized in that, include: The unfolding unit is used to perform UV unfolding on the voxel array model corresponding to the target object to obtain the UV information of the voxel array model. The voxel array model is composed of voxel models arranged together. The target object is a three-dimensional model object in the target virtual scene. The acquisition unit is used to acquire the main camera parameters in the target virtual scene, and generate orthogonal camera shooting parameters for the virtual orthogonal camera that shoots the target object based on the main camera parameters; The rendering unit is used to render the target object based on the shooting parameters of the orthogonal camera to obtain a target texture of the target object, wherein the target texture includes the depth information and color information of the target object; A placement unit is used to place the voxel array model in the target virtual scene based on the shooting parameters of the orthogonal camera and the position of the target object in the target virtual scene; The overlay unit is used to determine the target depth information corresponding to each voxel model in the voxel array model according to the UV information and the depth information, and to overlay multiple voxel models onto the surface of the target object according to the target depth information to obtain a target voxel model overlaid on the surface of the target object. The determining unit is used to determine the color parameters corresponding to the target voxel model based on the UV information and the color information, and to perform rendering processing on the target voxel model based on the color parameters to obtain the target voxel object corresponding to the target object.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the voxel object generation method according to any one of claims 1 to 11.

14. A computer device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the voxel object generation method according to any one of claims 1 to 11.

15. A computer program product, characterized in that, The computer program product includes a computer program / instruction that, when executed by a processor, implements the steps of the voxel object generation method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Three-dimensional object generation method and device, storage medium and electronic equipment

    CN114419279A

  • Three-dimensional model reconstruction method and device and computer readable storage medium

    CN115294275A