Virtual screen generation method and apparatus, electronic device, computer readable storage medium, and computer program product
By rastering the voxels of the virtual scene in advance and generating the surface spheres in the virtual screen generation, the problem of repeated processing of inter-frame voxels in the prior art is solved, and more efficient virtual screen generation is achieved.
Patent Information
- Application Number
- PCT/CN2024/104664
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-11
- Filing Date
- 2024-07-10
- Publication Date
- 2025-03-20
AI Technical Summary
When generating virtual screens in the prior art, since each frame of virtual screen needs to be rasterized separately, the repeated processing of voxels between different frames, resulting in waste of processing resources and low generation efficiency.
By obtaining the preset virtual scene and rastering each voxel from different normal directions, voxel element is obtained. Then, the target voxel element associated with the target virtual camera is selected from the multiple voxel element and is directly used to generate the target virtual screen.
It effectively avoids repeated processing of voxels between different frames, improves the efficiency of generating virtual pictures, and reduces the waste of processing resources.
Smart Images

Figure CN2024104664_20032025_PF_FP_ABST
Abstract
Description
Method, device, electronic device, computer-readable storage medium, and computer program product for generating virtual images
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application is based on the Chinese patent application with application number 2023111649630 and application date September 11, 2023, and claims the priority of the Chinese patent application. The entire content of the Chinese patent application is hereby introduced into this application as a reference. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, computer-readable storage medium, and computer program product for generating a virtual image. Background Art
[0004] In recent years, with the development of computer technology, industries such as gaming, film, and virtual reality have flourished. Virtual scenes are populated with virtual objects, virtual light sources, and virtual cameras. Virtual light sources illuminate virtual objects within the scene, while virtual cameras capture images from the perspective of the scene. Applications calculate the light reflected from the surfaces of virtual objects based on the illumination provided by the virtual light sources and the angle of the virtual camera, thereby rendering the scene.
[0005] In related technologies, for the generation of virtual images, rasterization of corresponding voxels is usually performed separately for each frame of virtual image to obtain the corresponding virtual image. In this way, since there may be overlap of voxels between different virtual images, rasterization of voxels is performed separately for each frame of virtual image, resulting in repeated execution of the same processing on repeated voxels between different frames, causing a waste of processing resources and resulting in low efficiency in generating virtual images.
[0006] Summary of the Invention
[0007] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium, and computer program product for generating a virtual screen, which can effectively improve the efficiency of generating a virtual screen.
[0008] The technical solution of the embodiment of the present application is implemented as follows:
[0009] The present invention provides a method for generating a virtual image, including:
[0010] Acquire a preset virtual scene, wherein the preset virtual scene includes a plurality of voxels, and the voxels include a plurality of voxel faces with different normal directions;
[0011] For each of the voxels, rasterizing the voxels along the normal directions of the voxels to obtain voxel bins corresponding to the voxel faces of the voxels, the voxel bins being used to describe virtual scene information of the voxels in the corresponding normal directions;
[0012] Selecting a target voxel surface associated with a target virtual camera in a preset virtual scene from the plurality of voxel surfaces;
[0013] Based on the target voxel surface, the preset virtual scene is rendered to obtain a target virtual scene.
[0014] The present invention provides a device for generating a virtual image, including:
[0015] An acquisition module is configured to acquire a preset virtual scene, wherein the preset virtual scene includes a plurality of voxels, and the voxels include a plurality of voxel surfaces with different normal directions;
[0016] a rasterization module configured to rasterize each voxel along each normal direction of the voxel to obtain voxel bins corresponding to each voxel surface of the voxel, wherein the voxel bins are used to describe virtual scene information of the voxel in the corresponding normal direction;
[0017] A selection module configured to select a target voxel surface associated with a target virtual camera in a preset virtual scene from the plurality of voxel surfaces;
[0018] The picture rendering module is configured to perform picture rendering on the preset virtual scene based on the target voxel surface element to obtain a target virtual picture.
[0019] An embodiment of the present application provides an electronic device, including:
[0020] a memory configured to store computer-executable instructions or computer programs;
[0021] The processor is configured to implement the method for generating a virtual screen provided in an embodiment of the present application when executing the computer executable instructions or computer program stored in the memory.
[0022] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions configured to cause a processor to execute the instructions to implement the method for generating a virtual screen provided in the embodiment of the present application.
[0023] The present invention provides a computer program product including a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the method for generating a virtual screen described in the present invention.
[0024] The embodiments of the present application have the following beneficial effects:
[0025] By obtaining a preset virtual scene and rasterizing each voxel in the preset virtual scene, the voxel surface corresponding to the voxel is obtained, thereby obtaining the full voxel surface of the preset virtual scene. When targeting any target virtual image frame of the preset virtual scene, the target voxel surface associated with the target virtual camera is directly selected from the multiple voxel surfaces to obtain the target virtual image. In this way, even if there may be overlap in voxels between different virtual images, since the full voxel surface of the preset virtual scene has been determined, the target virtual image can be generated by directly selecting the target voxel surface associated with the target virtual camera from the multiple voxel surfaces. Voxels that are repeated between different image frames will not be repeatedly processed, thereby effectively improving the efficiency of virtual image generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] FIG1 is a schematic diagram of the architecture of a virtual screen generation system provided in an embodiment of the present application;
[0027] FIG2 is a schematic diagram of the structure of an electronic device for generating a virtual screen provided by an embodiment of the present application;
[0028] FIG3 is a flow chart of steps 101 to 104 of a method for generating a virtual screen according to an embodiment of the present application;
[0029] FIG4 is a flow chart of steps 1011 to 1013 of a method for generating a virtual screen according to an embodiment of the present application;
[0030] FIG5 is a schematic diagram showing the principle of initial voxels in the method for generating a virtual image according to an embodiment of the present application;
[0031] FIG6 is a flow chart of steps 1021 to 1024 of a method for generating a virtual screen according to an embodiment of the present application;
[0032] FIG7 is a schematic diagram showing the principle of candidate object points in the method for generating a virtual image provided by an embodiment of the present application;
[0033] FIG8 is a flow chart of steps 1031A to 1033A of a method for generating a virtual screen according to an embodiment of the present application;
[0034] FIG9 is a flow chart of step 1031B of the method for generating a virtual screen according to an embodiment of the present application;
[0035] FIG10 is a flow chart of step 1031C of the method for generating a virtual screen according to an embodiment of the present application;
[0036] FIG11 is a flow chart of steps 1041 to 1045 of a method for generating a virtual screen according to an embodiment of the present application;
[0037] FIG12 is a schematic diagram of the voxel principle of the method for generating a virtual screen provided in an embodiment of the present application;
[0038] FIG13 is a schematic diagram showing the principle of voxelization processing of the method for generating a virtual image provided by an embodiment of the present application;
[0039] FIG14 is a schematic diagram showing the principle of a facet of a method for generating a virtual screen according to an embodiment of the present application;
[0040] FIG15 is a schematic diagram of the effect of a virtual screen in the related art;
[0041] FIG16 is a schematic diagram showing the effect of the first virtual screen provided in an embodiment of the present application;
[0042] FIG17 is a schematic diagram showing the effect of the second virtual screen provided in an embodiment of the present application;
[0043] FIG18 is a schematic diagram showing the effect of a surface element illumination cache in the related art;
[0044] FIG19 is a schematic diagram of the effect of the facet illumination cache provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0046] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0047] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0049] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0050] 1) Vertex Shader: A program in computer graphics that processes and transforms input vertex data. Typically executed on the GPU, a vertex shader performs calculations on each input vertex and outputs the transformed vertex data. When rendering 3D graphics, the vertex shader is typically the first stage in the rendering pipeline. Its primary function is to transform the input vertex data so that it can be projected onto the screen. Vertex shaders can perform various transformations, such as translation, rotation, scaling, and projection, to convert vertices from model space to world space, camera space, and screen space. In addition to transformations, vertex shaders can also perform other calculations, such as normal calculations, texture coordinate calculations, and lighting calculations. These calculations can be performed in the vertex shader for use in subsequent rendering stages.
[0051] 2) Rendering: This is the final stage of making the image conform to the 3D scene. Some also refer to it as shading, but generally, shading is referred to as shading, and rendering as rendering. Rendering and shading are two distinct concepts in 3D software. While their functions are similar, they differ. Shading is a display scheme that typically appears in the main window of 3D software. Like a wireframe, it aids visualization of the model. While shading mode clearly makes it easier to understand the model's structure than wireframe mode, it is simply a simple display. In digital imaging, this is known as shading. Advanced 3D software like Maya can also use shading to display simple lighting effects, shadows, and surface textures. Of course, high-quality shading requires a dedicated 3D graphics card, which accelerates and optimizes 3D graphics display. However, no matter how much optimization is applied, it cannot produce high-quality images. This is because shading uses a real-time display technology, and hardware limitations prevent it from displaying light effects such as reflections and refractions in real time. In real-world applications, models or scenes often need to be exported as image files, video signals, or film footage, which necessitates a rendering process. The rendering process in graphics can be broken down into two main tasks: visibility and shading. Rasterization can be considered a solution to the visibility problem. Visibility involves determining which parts of a 3D object are visible to the camera. Some parts of these objects can be disabled because they are either outside the camera's visible area or hidden by other objects.
[0052] 3) Pixels: Pixels are small squares in an image. These squares have a specific location and assigned color value. The color and location of the squares determine the image's appearance. Pixels can be considered indivisible units or elements within an image. Indivisible means they cannot be broken down into smaller units or elements; they exist as a single, single-colored grid. Each dot matrix image contains a certain number of pixels, which determine the size of the image displayed on the screen.
[0053] 4) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed can be in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.
[0054] 5) Virtual scene: It is a virtual scene displayed (or provided) when the application is running on the terminal. The virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiment of the present application does not limit the dimension of the virtual scene. For example, the virtual scene may include the sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities. The user can control the movement of virtual objects in the virtual scene.
[0055] 6) Voxel: Voxel stands for Volume Pixel. A volume containing voxels can be represented through volume rendering or by extracting polygonal isosurfaces with a given threshold outline. As the name suggests, voxels are the smallest unit of digital data used in three-dimensional space segmentation. Voxels are used in fields such as 3D imaging, scientific data, and medical imaging. Conceptually, they are similar to pixels, the smallest unit of two-dimensional space, used in image data in two-dimensional computer graphics.
[0056] 7) Camera Model: This describes the process of mapping coordinate points in a 3D world coordinate system to a 2D image plane. It serves as the link between points in 3D space and points on the 2D plane. Camera models include at least the pinhole camera model and the fisheye camera model. For example, the pinhole camera model contains four coordinate systems: the 3D world coordinate system, the 3D camera coordinate system, the 2D image physical coordinate system, and the 2D image pixel coordinate system.
[0057] 8) Virtual objects: These refer to objects that are moving or stationary in a virtual scene. Moving virtual objects include animals, vehicles, and people in the virtual scene. Stationary virtual objects include walls, rocks, and the ground in the virtual scene.
[0058] 9) Virtual light: refers to the light in the virtual scene emitted by the virtual light source used to illuminate the virtual scene. Virtual light includes direct light and indirect light. Among them, direct light is the virtual light emitted by the virtual light source, reflected from the virtual illumination point to the virtual camera, and indirect light is the virtual light emitted by the virtual light source, reflected at least once, to the virtual illumination point, and finally reflected from the virtual illumination point to the virtual camera.
[0059] 10) Virtual camera: It is a "camera" set up in computer animation software or virtual engine. The role of virtual camera in expressing viewpoint during animation is equivalent to that of traditional camera. The subjects of virtual camera and physical camera are completely different, but their functions are extremely similar. Physical camera shoots real people or actually built scenes, while virtual camera shoots models built in 3D software, which can realize infinite possibilities. Virtual camera is presented in the form of icon in virtual engine, and also has parameters such as lens, focal length, focus, aperture, depth of field, etc. It can realize camera actions such as "push, pull, shake, move, follow, swing, rise, fall, and comprehensive movement", and can achieve shooting effects that are difficult or even impossible to achieve with physical camera, such as passing through walls, keyholes, and objects. The parameters that need to be adjusted for physical camera are distributed on the body of the physical camera and require manual operation. The camera parameters of the virtual camera are buttons or numerical input bars integrated on the panel. The operator only needs to input parameters or drag the mouse. Sometimes a few key frames can determine the motion path of the virtual camera. In actual shooting, physical cameras often require stabilizers or motion control systems. Even so, the shaking of the picture still exists.
[0060] 11) Virtual Engine: A virtual engine refers to some already-written editable computer virtual systems or core components of some interactive real-time graphics applications. These systems provide virtual scene designers with various tools needed to write virtual scenes. The purpose is to enable designers to write programs easily and quickly. Virtual engines include rendering engines (rendering engines include two-dimensional rendering engines and three-dimensional rendering engines), physics engines, collision detection engines, sound engines, script engines, animation engines, artificial intelligence engines, network engines and scene management engines, etc.
[0061] 12) Virtual light source: It is a "light source" set up in computer animation software or virtual engines. The role of virtual light source in expressing viewpoints in animation production is equivalent to the physical light source in the traditional sense. The objects illuminated by virtual light source and physical light source are completely different, but the functions are extremely similar. Physical light source illuminates real-life characters or actually built scenes, while virtual light source illuminates models built in 3D software, which can realize unlimited possibilities.
[0062] 13) Rasterization: It is the process of converting vertex data into fragments. It has the function of converting the image into an image composed of grids. The characteristic is that each element corresponds to a pixel in the frame buffer. Rasterization is the process of converting vertex data into fragments. Each element in the fragment corresponds to a pixel in the frame buffer. Rasterization is actually a process of converting geometric primitives into two-dimensional images. This process includes two parts. The first part of the work: determining which integer grid areas in the window coordinates are occupied by basic primitives; the second part of the work: assigning a color value and a depth value to each area. The rasterization process produces fragments. The process of converting the mathematical description of an object and the color information related to the object into pixels for corresponding positions on the screen and the colors used to fill the pixels is called rasterization.
[0063] 14) Facet: It is a small plane used to describe the surface of an object, that is, the smallest unit used to describe the surface of an object. It has a certain area and stores the corresponding information of the object surface. The stored surface information can also be called facet parameters. The facet parameters may specifically include the position, radius, normal and albedo of the facet.
[0064] 15) Pixel Shader: A pixel shader is a program in computer graphics that processes and shades each pixel in the rendering pipeline. Typically executed on the GPU, a pixel shader performs calculations for each pixel and outputs a final color value. When rendering 3D graphics, the pixel shader is typically the last stage in the rendering pipeline. Its primary function is to calculate the final color value for each pixel based on input information such as texture, lighting, and material. The pixel shader can perform various calculations, such as texture sampling, lighting calculations, shadow calculations, and transparency calculations, to generate the final image.
[0065] 16) Scene Voxelization: This is a technique used to achieve efficient scene rendering and lighting calculations. It converts objects and geometric shapes in the scene into voxel representations for rendering and calculations in voxel space. The basic idea of voxelization is to convert objects and geometric shapes in the scene into voxel representations for rendering and calculations in voxel space. In voxel space, objects and geometric shapes in the scene can be represented using a voxel grid. A voxel grid is a three-dimensional grid where each grid cell represents a voxel and can store information such as the object's position, color, and normal.
[0066] During the implementation of the embodiments of this application, the applicant discovered that the related technology has the following problems:
[0067] In related technologies, for the generation of virtual images, rasterization of corresponding voxels is usually performed separately for each frame of virtual image to obtain the corresponding virtual image. In this way, since there may be overlap of voxels between different virtual images, rasterization of voxels is performed separately for each frame of virtual image, resulting in repeated execution of the same processing on repeated voxels between different frames, causing a waste of processing resources and resulting in low efficiency in generating virtual images.
[0068] Embodiments of the present application provide a method, device, electronic device, computer-readable storage medium, and computer program product for generating a virtual screen, which can effectively improve the efficiency of generating a virtual screen. The following describes an exemplary application of the virtual screen generation system provided by the embodiments of the present application.
[0069] See Figure 1, which is a schematic diagram of the architecture of a virtual screen generation system 100 provided in an embodiment of the present application. The terminal (terminal 400 is shown as an example) is connected to the server 200 through a network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0070] The terminal 400 is used for the user to use the client 410 and display a target virtual screen on a graphical interface 410-1 (graphic interface 410-1 is shown as an example). The terminal 400 and the server 200 are connected to each other via a wired or wireless network.
[0071] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal 400 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart TV, a smart watch, a car terminal, etc., but is not limited to this. The electronic device provided in the embodiment of the present application can be implemented as a terminal or as a server. The terminal and the server can be directly or indirectly connected by wired or wireless communication, which is not limited in the embodiment of the present application.
[0072] In some embodiments, the server 200 obtains a preset virtual scene, and for each voxel, rasterizes the voxel separately from each normal direction of the voxel to obtain voxel face elements corresponding to each voxel face of the voxel, and selects a target voxel face element associated with the target virtual camera from multiple voxel face elements, and sends the target voxel face element to the terminal 400. The terminal 400 colors the preset virtual scene based on the target voxel face element to obtain the target virtual picture.
[0073] In other embodiments, the server 200 obtains a preset virtual scene, and for each voxel, rasterizes the voxel separately from each normal direction of the voxel to obtain voxel face elements corresponding to each voxel face of the voxel, selects a target voxel face element associated with the target virtual camera from multiple voxel face elements, and colors the preset virtual scene based on the target voxel face element to obtain a target virtual picture, and sends the target virtual picture to the terminal 400.
[0074] In other embodiments, the embodiments of the present application can be implemented with the help of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or local area network to realize data calculation, storage, processing, and sharing.
[0075] Cloud technology is a general term for network, information, integration, management platform, and application technologies used in the cloud computing business model. It can form a resource pool that can be used flexibly and conveniently on demand. Cloud computing technology will become a key support. The backend services of technical network systems require a large amount of computing and storage resources.
[0076] Referring to Figure 2, Figure 2 is a structural diagram of an electronic device 500 for generating a virtual screen provided in an embodiment of the present application, wherein the electronic device 500 shown in Figure 2 can be the server 200 or the terminal 400 in Figure 1, and the electronic device 500 shown in Figure 2 includes: at least one processor 430, a memory 450, and at least one network interface 420. The various components in the electronic device 500 are coupled together through a bus system 440. It is understandable that the bus system 440 is also configured to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are labeled as bus system 440 in Figure 2.
[0077] The processor 430 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0078] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 430.
[0079] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0080] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0081] Operating system 451, including system programs configured to handle various basic system services and perform hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., configured to implement various basic services and handle hardware-based tasks;
[0082] The network communication module 452 is configured to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).
[0083] In some embodiments, the virtual screen generation device provided in the embodiments of the present application can be implemented in software. FIG2 shows a virtual screen generation device 455 stored in memory 450. The virtual screen generation device 455 can be software in the form of a program or plug-in, and includes the following software modules: an acquisition module 4551, a rasterization module 4552, a selection module 4553, and a screen rendering module 4554. These modules are logical and can be arbitrarily combined or further separated according to the functions implemented. The functions of each module will be described below.
[0084] In other embodiments, the virtual screen generation device provided in the embodiments of the present application can be implemented in hardware. As an example, the virtual screen generation device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the virtual screen generation method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0085] In some embodiments, the terminal or server can implement the method for generating a virtual screen provided in the embodiment of the present application by running a computer program or computer executable instructions. For example, the computer program can be a native program (e.g., a dedicated screen generation program) or a software module in the operating system, for example, a screen generation module that can be embedded in any program (such as an instant messaging client, a photo album program, an electronic map client, a navigation client); for example, it can be a local (Native) application (APP, Application), that is, a program that needs to be installed in the operating system to run. In short, the above-mentioned computer program can be any form of application, module or plug-in.
[0086] The method for generating a virtual screen provided in the embodiment of the present application will be described in conjunction with the exemplary application and implementation of the server or terminal provided in the embodiment of the present application.
[0087] Refer to Figure 3, which is a flow chart of steps 101 to 104 of the method for generating a virtual screen provided in an embodiment of the present application. The method for generating a virtual screen provided in an embodiment of the present application will be explained in conjunction with steps 101 to 104 shown in Figure 3. The method for generating a virtual screen provided in an embodiment of the present application can be implemented separately by a server or a terminal, or implemented jointly by a server and a terminal. The following will be explained using the server alone as an example.
[0088] In step 101, a preset virtual scene is obtained.
[0089] In some embodiments, the preset virtual scene includes a plurality of voxels, and the voxels include a plurality of voxel faces with different normal directions.
[0090] In some embodiments, a voxel is the smallest unit of a preset virtual scene in three-dimensional space division. A voxel is a volume element of a preset virtual scene. A voxel is a volume element surrounded by multiple voxel faces. A voxel face refers to an area on the surface of a voxel composed of voxel points with the same normal direction. A voxel includes multiple voxel faces with different normal directions.
[0091] In some embodiments, a virtual scene is a virtual scene displayed (or provided) when an application is running on a terminal. The virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiments of the present application do not limit the dimensions of the virtual scene. For example, a virtual scene can include the sky, land, ocean, etc., and the land can include environmental elements such as deserts and cities, and users can control virtual objects to move in the virtual scene.
[0092] As an example, the preset virtual scene includes a plurality of cube-shaped voxels, each cube-shaped voxel includes six voxel faces with different normal directions, and the normal directions corresponding to two adjacent voxel faces in the cube-shaped voxel are perpendicular.
[0093] In some embodiments, referring to FIG. 4 , FIG. 4 is a flow chart of steps 1011 to 1013 of the method for generating a virtual screen provided in an embodiment of the present application. Step 101 shown in FIG. 3 can be implemented through steps 1011 to 1013 shown in FIG. 4 .
[0094] In step 1011 , an initial virtual scene is acquired and voxelized to obtain a reference virtual scene including a target number of initial voxels.
[0095] In some embodiments, voxelization is a technology used to achieve efficient scene rendering and lighting calculations. It converts objects and geometric shapes in the scene into voxel representations so that they can be rendered and calculated in voxel space. The basic idea of voxelization is to convert objects and geometric shapes in the scene into voxel representations so that they can be rendered and calculated in voxel space. In voxel space, a voxel grid can be used to represent objects and geometric shapes in the scene. A voxel grid is a three-dimensional grid where each grid cell represents a voxel and can store information such as the position, color, and normal of an object.
[0096] In some embodiments, the initial voxel is the smallest unit of the reference virtual scene in the scene space division. The initial voxel is the volume element of the reference virtual scene. The initial voxel is a volume element surrounded by multiple voxel surfaces. The voxel surface refers to the area on the surface of the initial voxel composed of voxel points with the same normal direction. The initial voxel includes multiple voxel surfaces with different normal directions.
[0097] In some embodiments, the reference virtual scene is an initial virtual scene including a target number of initial voxels, the reference virtual scene is the initial virtual scene after voxel division, the scene content in the initial virtual scene and the reference virtual scene is exactly the same, the reference virtual scene includes a target number of initial voxels, the difference between the initial virtual scene and the reference virtual scene is that there are a target number of initial voxels in the reference virtual scene, and there are no target number of initial voxels in the initial virtual scene. For example, when the initial virtual scene is a virtual scene R, the initial virtual scene is divided into initial voxels R1 and initial voxels R2 to obtain reference voxels including initial voxels R1 and initial voxels R2.
[0098] In some embodiments, the above-mentioned voxelization of the initial virtual scene to obtain a reference virtual scene including a target number of initial voxels can be achieved as follows: obtaining a preset target number, dividing the initial virtual scene into the target number of initial voxels, and obtaining a reference virtual scene including the target number of initial voxels.
[0099] In some embodiments, the above-mentioned division of the initial virtual scene into a target number of initial voxels to obtain a reference virtual scene including the target number of initial voxels can be achieved as follows: obtaining the scene size of the initial virtual scene, dividing the scene size by the target number to obtain the size of the initial voxels, dividing the initial virtual scene into a target number of initial voxels with corresponding sizes to obtain a reference virtual scene including the target number of initial voxels, and the size of each initial voxel in the reference virtual scene is the same.
[0100] As an example, the reference virtual scene includes a plurality of initial voxels, for example, initial voxel A, initial voxel B, and initial voxel C. Then initial voxel A, initial voxel B, and initial voxel C constitute the entire reference virtual scene.
[0101] In some embodiments, the initial sizes of each initial voxel in the reference virtual scene may be the same or different, and each initial voxel corresponds to a different scene space in the reference virtual scene, and the scene spaces corresponding to each initial voxel in the reference virtual scene do not overlap, so that different initial voxels will not repeatedly express the same scene content of the reference virtual scene. After subsequent processing of each initial voxel, the purpose of processing the entire reference virtual scene can be achieved without causing repeated processing of the same scene content, thereby effectively improving the processing performance of the reference virtual scene.
[0102] In this way, by dividing the initial virtual scene into voxels of the same size, it is possible to ensure that computing resources are evenly distributed to each target, thereby improving processing efficiency. The same voxel size can simplify the subsequent calculation process because the same algorithm and calculation method can be used for processing, reducing complexity. Voxels of the same size can make more efficient use of storage space because they are arranged more regularly in the data structure. Uniform voxel division makes parallel processing easier because each voxel can be processed independently by different processing units. In 3D graphics rendering, voxelized scenes can help to perform lighting and shadow calculations faster because voxels of the same size can use the same rendering strategy.
[0103] In some embodiments, the above-mentioned scene space refers to the three-dimensional space of a three-dimensional virtual scene in the world space of a virtual engine. The above-mentioned world space can accommodate the scene space of at least one virtual scene, that is, the world space includes at least one scene space. Since the reference virtual scene includes multiple initial voxels, the scene space of that reference virtual scene includes the scene spaces corresponding to each initial voxel in the reference virtual scene.
[0104] In step 1012 , the initial camera position of the initial virtual camera in the reference virtual scene and the voxel position of each initial voxel in the reference virtual scene are obtained; and the distances between the initial camera position and each voxel position in the reference virtual scene are determined.
[0105] In some embodiments, the initial virtual camera in the reference virtual scene is used to collect image information of the reference virtual scene at the initial camera position in the reference virtual scene. The initial camera position refers to the scene position of the initial virtual camera in the reference virtual scene in the reference virtual scene.
[0106] As an example, the distance between the initial camera position and the voxel position can be expressed as:
[0107] Among them, L1 is used to indicate the distance between the initial camera position and the voxel position, x1 is used to indicate the horizontal coordinate of the initial camera position, y1 is used to indicate the vertical coordinate of the initial camera position, z1 is used to indicate the vertical coordinate of the initial camera position, x2 is used to indicate the horizontal coordinate of the voxel position, y2 is used to indicate the vertical coordinate of the voxel position, and z2 is used to indicate the vertical coordinate of the voxel position.
[0108] As an example, refer to Figure 5, which is a schematic diagram of the principle of the initial voxels of the virtual screen generation method provided by an embodiment of the present application. The reference virtual scene shown in Figure 5 includes multiple initial voxels 51 (12 are schematically shown in Figure 5). The virtual camera moves on the camera driving track 53 in the reference virtual scene to shoot the reference virtual scene from different angles. The distance between each track point on the camera driving track and the center position of the reference virtual scene is equal. The initial camera position 52 of the initial virtual camera in the reference virtual scene and the voxel position of each initial voxel 51 in the reference virtual scene are obtained; the distance between the initial camera position 52 and each voxel position 51 is determined.
[0109] In step 1013 , the size of each initial voxel in the reference virtual scene is adjusted based on the distance to obtain a preset virtual scene.
[0110] In some embodiments, the size of the adjusted initial voxel is positively correlated with the corresponding distance, that is, the larger the distance, the larger the size of the corresponding adjusted initial voxel, and the smaller the distance, the smaller the size of the corresponding adjusted initial voxel.
[0111] In some embodiments, the above step 1013 can be implemented as follows: obtain the distance between the initial camera position and the position of each voxel in the reference virtual scene, and the mapping relationship between the distance and the size of each voxel in the preset virtual scene; perform the following processing on each initial voxel in the reference virtual scene to obtain the preset virtual scene: determine the target size of the initial voxel based on the distance and mapping relationship between the initial camera position and the voxel positions corresponding to the initial voxel; adjust the size of the initial voxel in the reference virtual scene to the target size to obtain the voxel corresponding to the initial voxel.
[0112] In some embodiments, the distance between the initial camera position in the mapping relationship and the position of each voxel in the reference virtual scene is positively correlated with the size of each voxel.
[0113] In some embodiments, an initial camera position and orientation are set. A reference virtual scene is created, and an initial position and size are assigned to each voxel in the scene. For each voxel in the reference virtual scene, the distance between its position and the initial camera position is calculated. The position of each voxel and the corresponding distance are stored. According to the preset virtual scene, a mapping function or lookup table is defined, which maps the voxel distance to the target voxel size. The mapping relationship can be based on a variety of factors, such as distance, importance, visual importance, etc. All voxels in the reference virtual scene are traversed. For each voxel, its target size is determined using the calculated camera distance and the defined mapping relationship. The size of each voxel in the reference virtual scene is adjusted by modifying the voxel data structure, or by creating a new voxel to replace the original voxel. The resized voxels are combined into a new virtual scene, which is the preset virtual scene.
[0114] In this way, by obtaining the distance between the camera and the voxel and adjusting the voxel size according to the mapping relationship, the scene can be rendered more accurately, making the rendering result closer to the visual effect of the real world. It allows the voxel size to be dynamically adjusted according to the camera position, so that the scene rendering can be updated in real time according to the observer's perspective, enhancing immersion and interactivity. By adjusting the voxel size, rendering performance can be optimized at different viewing distances. For voxels far away from the camera, the details can be reduced, thereby reducing rendering costs. By pre-defining the mapping relationship of voxel size, the target size of each voxel can be quickly determined during the rendering process, reducing the amount of calculation and improving rendering efficiency. It can dynamically adjust the level of detail according to the camera distance, so that nearby objects display higher details, while distant objects are appropriately simplified, improving the overall visual effect.
[0115] In some embodiments, the above-mentioned mapping relationship includes multiple index entries. The above-mentioned determination of the size of each voxel in the preset virtual scene based on the distance between the initial camera position and each voxel position and the mapping relationship can be achieved in the following way: for the distance corresponding to each voxel position, from the multiple index entries of the mapping relationship, the index entry including the distance corresponding to the voxel position is determined as the target index entry, and the size in the target index entry is determined as the size of the corresponding voxel.
[0116] In this way, by obtaining the initial camera position of the initial virtual camera in the reference virtual scene and the voxel position of each initial voxel in the reference virtual scene, the distance between the initial camera position and each voxel position is determined, and based on the distance, the size of each initial voxel in the reference virtual scene is adjusted to obtain the preset virtual scene. Since the size of the adjusted initial voxel is positively correlated with the corresponding distance, the size of the initial voxel farther away from the initial virtual camera is larger, and the size of the initial voxel closer to the initial virtual camera is smaller, so that the voxels closer to the initial virtual camera in the preset virtual scene can cover more scene information of the initial virtual scene, so that the voxels closer to the initial virtual camera in the preset virtual scene have higher scene accuracy, and the voxels farther away from the initial virtual camera have lower scene accuracy, which effectively reduces the resource occupation of the preset virtual scene, so that the obtained preset virtual scene can be more in line with the real visual effect, and at the same time effectively improves the resource utilization of the preset virtual scene.
[0117] In step 102 , for each voxel, the voxel is rasterized along each normal direction of the voxel to obtain voxel facets corresponding to each voxel surface of the voxel.
[0118] In some embodiments, the voxel surface element is used to describe the virtual scene information of the voxel in the corresponding normal direction, and the virtual scene information includes the voxel scene surface coordinates, scene surface color, scene surface normal, scene surface transformation matrix, etc.
[0119] As an example, when the voxel is a cube-shaped voxel, the voxel includes voxel plane A, voxel plane B, voxel plane C, voxel plane D, voxel plane E and voxel plane F. The voxels are rasterized from each normal direction of the voxel to obtain voxel surface elements corresponding to voxel plane A, voxel plane B, voxel plane C, voxel plane D, voxel plane E and voxel plane F respectively.
[0120] In some embodiments, a preset virtual scene includes multiple virtual objects, each of which includes multiple object points. An object point refers to a virtual scene point located on a virtual object in the preset virtual scene. A virtual object refers to an object that is moving or stationary in the virtual scene. Moving virtual objects include animals, vehicles, and people in the virtual scene. Stationary virtual objects include walls, rocks, and the ground in the virtual scene.
[0121] In some embodiments, referring to FIG. 6 , FIG. 6 is a flow chart of steps 1021 to 1024 of the method for generating a virtual screen provided in an embodiment of the present application. Step 102 shown in FIG. 3 can be implemented through steps 1021 to 1024 shown in FIG. 6 .
[0122] In step 1021 , at least one candidate object point located within a voxel is determined from a plurality of object points in a preset virtual scene.
[0123] In some embodiments, the preset virtual scene includes multiple virtual objects, and the virtual object includes multiple object points. The object point refers to a virtual scene point located on the virtual object in the preset virtual scene. The virtual object is composed of multiple object points.
[0124] In some embodiments, the above-mentioned step 1021 can be implemented as follows: the following processing is performed for each object point in the preset virtual scene: the position of the object point is compared with the position range of the voxel to obtain a comparison result, and when the comparison result indicates that the position of the object point is within the position range of the voxel, the object point is determined as a candidate object point.
[0125] In this way, by comparing the position of each object point in the preset virtual scene with the position range of the voxel, when the comparison result indicates that the position of the object point is within the position range of the voxel, the object point is determined to be a candidate object point located within the voxel. Since the candidate object point located within the voxel can indicate the scene characteristics within the voxel, by determining the candidate object point located within the voxel, the scene characteristics of the corresponding voxel can be accurately reflected through the candidate object point, so that the voxel face element of the voxel determined later through the candidate object point is more accurate.
[0126] In some embodiments, each voxel in the preset virtual scene includes at least one object point.
[0127] In step 1022 , in the preset virtual scene, the following steps 1023 to 1024 are respectively executed for each voxel face of the voxel.
[0128] As an example, when the voxel is a cube-shaped voxel, the voxel includes voxel surface A, voxel surface B, voxel surface C, voxel surface D, voxel surface E and voxel surface F, and the following steps 1023 and 1024 are performed respectively for the voxel surface A, voxel surface B, voxel surface C, voxel surface D, voxel surface E and voxel surface F of the voxel.
[0129] In step 1023 , at least one target object point is selected from the at least one candidate object point, and the lines connecting the target object point and each point on the voxel surface do not pass through other candidate object points.
[0130] Continuing with the above example, when the candidate object points located within the voxel include candidate object point Q1 and candidate object point Q2, for the voxel plane A of the voxel, at least one target object point corresponding to voxel plane A is selected from candidate object point Q1 and candidate object point Q2. When the target object point corresponding to voxel plane A is candidate object point Q1, the lines connecting candidate object point Q1 and each point on the voxel plane do not pass through candidate object point Q2. When the target object point corresponding to voxel plane A is candidate object point Q2, the lines connecting candidate object point Q2 and each point on the voxel plane do not pass through candidate object point Q1.
[0131] In some embodiments, the above-mentioned step 1023 can be implemented as follows: when the number of candidate object points located in a voxel is one, the candidate object point is determined as the target object point; when the number of candidate object points located in a voxel is multiple, the following processing is performed on each candidate object point: when the lines connecting the candidate object point and each point on the voxel surface do not pass through other candidate object points, the candidate object point is determined as a reference object point; and the reference object point closest to the voxel surface is determined as the target object point.
[0132] In some embodiments, when the lines connecting the candidate object point and each point on the voxel surface do not pass through other candidate object points, it means that there are no other candidate object points in the voxel that form an occlusion between the candidate object point and the voxel surface, which means that there are no other candidate object points between the reference object point and the voxel surface that form an occlusion at any angle on the reference object point.
[0133] In some embodiments, for each voxel in the scene, all candidate object points inside it are identified and stored. For each voxel, the number of candidate object points inside it is calculated. If the number of candidate object points in the voxel is one, then this candidate object point is directly determined as the target object point. If the number of candidate object points in the voxel is multiple, then the following steps are performed for each candidate object point: For each candidate object point, check whether the line connecting it with each point on the voxel surface does not pass through other candidate object points. This can be achieved by calculating the distance between the line and other candidate object points. If the distance is greater than a certain threshold, it is considered that the line does not pass through other candidate object points. If the line connecting the candidate object point with each point on the voxel surface does not pass through other candidate object points, it is determined as a reference object point. Among all reference object points, find the point closest to the voxel surface and determine it as the target object point.
[0134] By filtering candidate object points within a voxel as target object points, the locations of objects in the scene can be more accurately determined, thereby improving overall scene accuracy. When a voxel contains only one candidate object point, directly identifying it as the target object point effectively reduces misidentification due to noise or other interference. When processing multiple candidate object points, only considering reference object points whose lines connecting the voxel plane do not pass through other candidate object points reduces the computational complexity of subsequent processing and optimizes performance. This prevents conflicts and overlaps between object points, ensuring that the target object point within each voxel is unique, facilitating object segmentation and recognition. In virtual reality or 3D visualization applications, accurately identifying target object points improves rendering visual quality and reduces visual distortion. When there are multiple candidate object points, selecting the reference object point closest to the voxel plane as the target object point supports more complex decision-making processes, such as path planning and collision detection. By screening and determining candidate object points, the robustness of the entire processing process is enhanced, making it less sensitive to minor changes in the input data. By filtering the final target object point, redundancy in scene data is reduced, facilitating storage and transmission.
[0135] In some embodiments, the above-mentioned determination of the reference object point closest to the voxel surface as the target object point can be achieved as follows: when the number of reference object points is one, the reference object point is determined as the target object point; when the number of reference object points is multiple, the reference object point closest to the voxel surface is determined as the target object point.
[0136] As an example, refer to Figure 7, which is a schematic diagram of the principle of candidate object points in the method for generating a virtual image provided by an embodiment of the present application. The candidate object points located in the voxel include candidate object point 71, candidate object point 72, candidate object point 73, candidate object point 74 and candidate object point 75. When the number of candidate object points located in the voxel is multiple, the following processing is performed on each candidate object point: when the line connecting the candidate object point 71 and each point on the voxel plane ABCD does not pass through other candidate object points, the candidate object point is determined as a reference object point; when the line connecting the candidate object point 72 and each point on the voxel plane ABCD does not pass through other candidate object points, the candidate object point is determined as a reference object point; When the line connecting candidate object point 73 and each point on voxel plane ABCD does not pass through other candidate object points, candidate object point 73 is determined as the reference object point; when the line connecting candidate object point 74 and each point on voxel plane ABCD does not pass through other candidate object points, candidate object point 74 is determined as the reference object point; when the line connecting candidate object point 75 and each point on voxel plane ABCD does not pass through other candidate object points, candidate object point 75 is determined as the reference object point, and the reference object point closest to the voxel plane is determined as the target object point.
[0137] In this way, when there are multiple candidate object points located in a voxel, when the lines connecting the candidate object point and each point on the voxel surface do not pass through other candidate object points, the candidate object point is determined as the reference object point, and the reference object point closest to the voxel surface is determined as the target object point, so that the determined target object point is the object point in the voxel that is closest to the voxel surface and is not blocked by other candidate object points, so that the determined target object point can accurately reflect the scene characteristics of the corresponding voxel surface, making the determined voxel surface element more accurate.
[0138] In other embodiments, the above step 1023 can also be implemented in the following manner: when the number of candidate object points located in a voxel is one, the candidate object point is determined as the target object point; when the number of candidate object points located in a voxel is multiple, the candidate object point closest to the voxel surface is determined as the target voxel point.
[0139] In this way, when there are multiple candidate object points located in a voxel, the object point closest to the voxel surface is directly determined as the target object point, so that the determined target object point is the closest to the voxel surface in the voxel, thereby more efficiently determining the target object point that can accurately reflect the scene characteristics of the corresponding voxel surface, making the determined voxel surface element more accurate.
[0140] In step 1024 , the voxels are rasterized based on the target object points to obtain voxel bins corresponding to the voxel plane.
[0141] In some embodiments, the above step 1024 can be implemented as follows: obtain vertex data of the target object point, the vertex data is used to indicate the geometric primitives of the target object point in the preset virtual scene, and rasterize the vertex data of the target object point in the voxel to obtain the voxel surface element corresponding to the voxel surface.
[0142] In some embodiments, rasterization is the process of converting vertex data into fragments, which has the function of converting an image into an image composed of grids, with the characteristic that each element corresponds to a pixel in the frame buffer. Rasterization is the process of converting vertex data into fragments. Each element in the fragment corresponds to a pixel in the frame buffer. Rasterization is actually a process of converting geometric primitives into two-dimensional images. The process includes two parts. The first part of the work: determining which integer grid areas in the window coordinates are occupied by basic primitives; the second part of the work: assigning a color value and a depth value to each area. The rasterization process produces fragments. The process of converting the mathematical description of an object and the color information related to the object into pixels for corresponding positions on the screen and the colors used to fill the pixels is called rasterization.
[0143] In some embodiments, vertex data associated with the determined target object point is obtained. Vertex data typically includes vertex position coordinates, texture coordinates, normals, and other information. The vertex data should define the geometric primitives of the target object point in the preset virtual scene, such as triangles and quadrilaterals. The types and vertex order of these primitives are determined for subsequent processing. The environment required for rasterization is set up, including the projection matrix, view matrix, clipping plane, and, if necessary, the material properties and textures used in the rasterization process. The vertex data is then sent to the rasterization stage, a process typically performed by a graphics processing unit (GPU). In this step, the vertex shader processes the vertex data, converting it from model space to clip space. The converted vertices are clipped, removing primitives that are outside the view frustum. The vertices are then mapped to screen space to determine their on-screen positions. Based on the vertex screen positions, the original geometric primitives (such as triangles) are assembled. Each primitive is fragmented to generate fragments, with each fragment corresponding to a pixel on the voxel face. The fragment shader program is executed on each fragment, which may include lighting calculations, texture mapping, and other functions. Determine the final color and depth values for the fragments. Perform a depth test on the generated fragments to determine which fragments should be rendered onto the voxel face. Based on the depth test results, the fragment color values are fused to produce the final voxel face. Convert the processed fragment data into a voxel face, which may include setting the voxel face's vertex data, texture coordinates, normals, etc. A voxel face is the result of voxelization and represents a face of a voxel in 3D space.
[0144] In this way, when there are multiple candidate object points located in a voxel, when the lines connecting the candidate object point and each point on the voxel surface do not pass through other candidate object points, the candidate object point is determined as the reference object point, and the reference object point closest to the voxel surface is determined as the target object point, so that the determined target object point is the object point in the voxel that is closest to the voxel surface and is not blocked by other candidate object points, so that the determined target object point can accurately reflect the scene characteristics of the corresponding voxel surface, making the determined voxel surface element more accurate.
[0145] In step 103 , a target voxel surface associated with a target virtual camera in a preset virtual scene is selected from a plurality of voxel surfaces.
[0146] In some embodiments, the target voxel surface associated with the target virtual camera refers to the voxel surface that can be captured by the target virtual camera corresponding to the target virtual screen in the preset virtual scene, that is, the target voxel surface is the voxel surface visible in the target virtual camera.
[0147] In some embodiments, referring to FIG8 , FIG8 is a flow chart of steps 1031A to 1033A of the method for generating a virtual screen provided in an embodiment of the present application. Step 103 shown in FIG3 can be implemented through steps 1031A to 1033A shown in FIG8 .
[0148] In step 1031A, the target camera position of the target virtual camera is obtained.
[0149] In some embodiments, the target virtual camera is used to collect image information of the target virtual image in a preset virtual scene.
[0150] In some embodiments, the target virtual camera and the initial virtual camera refer to virtual cameras that may be located at different virtual scene positions at different time points in a preset virtual scene.
[0151] As an example, referring to FIG. 5 , a target camera position 54 of a target virtual camera in a preset virtual scene is obtained.
[0152] In step 1032A, in the preset virtual scene, a virtual detection line corresponding to each voxel surface is generated with the center position of each voxel surface as the starting point and the target camera position as the end point.
[0153] In some embodiments, the detection information of the virtual detection line is used to indicate whether the virtual detection line corresponding to the voxel plane passes through other voxel planes in a preset virtual scene.
[0154] As an example, referring to FIG5 , taking the voxel surface 55 as an example, in the preset virtual scene, a virtual detection line corresponding to the voxel surface 55 is generated with the center position of the voxel surface 55 as the starting point and the target camera position 54 as the end point.
[0155] In step 1033A, based on the virtual detection line, a target voxel surface associated with the target virtual camera is selected from the voxel surfaces corresponding to each voxel surface.
[0156] In some embodiments, the above-mentioned step 1033A can be implemented by performing the following processing on the voxel face elements corresponding to each voxel surface: in the preset virtual scene, determining the detection information of the virtual detection line corresponding to the voxel surface; when the detection information indicates that the virtual detection line corresponding to the voxel surface does not pass through other voxel surfaces in the preset virtual scene, determining the voxel face element as the target voxel face element.
[0157] In some embodiments, when the detection information indicates that the virtual detection line corresponding to the voxel plane passes through other voxel planes in the preset virtual scene, the voxel plane is not determined as the target voxel plane.
[0158] As an example, referring to Figure 5, taking voxel surface 55 as an example, in the preset virtual scene, the detection information of the virtual detection line 56 corresponding to the voxel surface 55 is determined; when the detection information indicates that the virtual detection line 56 corresponding to the voxel surface 55 does not pass through other voxel surfaces in the preset virtual scene, the voxel surface element is determined as the target voxel surface element.
[0159] In this way, by determining the detection information of the virtual detection line corresponding to the voxel surface in the preset virtual scene, more accurate scene analysis and object detection can be achieved. When the detection information shows that the virtual detection line does not pass through other voxel surfaces in the scene, the possibility of misidentification or overlapping objects can be eliminated, thereby improving the accuracy of scene understanding. Determining the voxel surface as the target voxel surface can help optimize the data structure and make subsequent processing more efficient. By identifying the target voxel surface, unnecessary rendering calculations can be reduced and only key surfaces are rendered, thereby improving rendering efficiency. Excluding non-target voxel surfaces can make the scene visualization clearer and reduce visual clutter. Only processing virtual detection lines that do not intersect with other voxel surfaces reduces unnecessary calculations and improves the overall processing speed. In game or simulation environments, reducing the number of geometries that need to be rendered can significantly improve performance and ensure a smooth user experience.
[0160] In this way, when the detection information of the virtual detection line indicates that the virtual detection line corresponding to the voxel surface does not pass through other voxel surfaces in the preset virtual scene, it means that there is no obstruction between the target virtual camera and the voxel surface in the preset virtual scene, that is, in the preset virtual scene, the target virtual camera corresponding to the target virtual screen can collect the voxel surface element. At this time, this voxel surface element is determined as the target voxel surface element, so that the preset virtual scene can be subsequently colored based on the target voxel surface element to obtain the target virtual screen, thereby avoiding voxel surfaces other than the target voxel surface element from participating in the screen coloring calculation process, effectively improving the screen coloring efficiency.
[0161] In some embodiments, before executing step 103 , the following process may be performed: obtaining screen information of the target virtual screen.
[0162] In some embodiments, the picture information is used to indicate whether the target virtual picture is the first video frame in the video corresponding to the preset virtual scene, and the above-mentioned first video frame refers to the video frame with the earliest playback time in the video corresponding to the preset virtual scene.
[0163] In some embodiments, referring to FIG. 9 , FIG. 9 is a flow chart of step 1031B of the method for generating a virtual screen provided in an embodiment of the present application. Step 103 shown in FIG. 3 can be implemented through step 1031B shown in FIG. 9 .
[0164] In step 1031B, in response to the picture information indicating that the target virtual picture is the first video frame, a target voxel bin associated with the target virtual camera is selected from a plurality of voxel bins.
[0165] In some embodiments, when the picture information indicates that the target virtual picture is the first video frame, at this time, since there is no video frame with an earlier playback time than the target virtual picture, it is impossible to generate the target virtual picture with the help of the video frame with an earlier playback time. Therefore, the target voxel face associated with the target virtual camera is selected from multiple voxel faces to generate the target virtual picture through the target voxel face.
[0166] In some embodiments, after obtaining the target virtual screen's image information, the following processing may be performed: In response to the image information indicating that the target virtual screen is not the first video frame, obtaining a reference virtual screen in the video; obtaining a reference camera position of a reference virtual camera in a preset virtual scene, and obtaining a target camera position of a target virtual camera in the preset virtual scene.
[0167] In some embodiments, the reference virtual camera is used to collect image information of the reference virtual image in a preset virtual scene, and the target virtual camera is used to collect image information of the target virtual image in the preset virtual scene.
[0168] In some embodiments, the target virtual camera, the initial virtual camera, and the reference virtual camera refer to virtual cameras in a preset virtual scene that are located at different virtual scene positions at different time points.
[0169] As an example, referring to FIG. 5 , a reference camera position 57 of a reference virtual camera in a preset virtual scene and a target camera position 54 of a target virtual camera in the preset virtual scene are acquired.
[0170] In some embodiments, the reference virtual picture is a virtual picture frame preceding the target virtual picture in the video.
[0171] As an example, the video includes video frame A, video frame B, and video frame C played from early to late. Then, when the target virtual picture is video frame B, the corresponding reference virtual picture is video frame A.
[0172] In some embodiments, referring to FIG. 10 , FIG. 10 is a flow chart of step 1031C of the method for generating a virtual screen provided in an embodiment of the present application. Step 103 shown in FIG. 3 can be implemented by step 1031C shown in FIG. 10 .
[0173] In step 1031C, in response to the distance between the reference camera position and the target camera position being greater than or equal to a distance threshold, a target voxel bin associated with the target virtual camera is selected from the plurality of voxel bins.
[0174] In some embodiments, when the distance between the reference camera position and the target camera position is greater than or equal to a distance threshold, it indicates that there is a large deviation in the shooting angles of the reference camera position and the target camera position for the preset virtual scene, that is, there is a large discrepancy between the images of the preset virtual scene captured by the reference virtual camera and the target virtual camera, respectively. At this time, the target virtual image cannot reuse the reference virtual image, so that the target voxel surface element associated with the target virtual camera can be selected from multiple voxel surfaces, and the target voxel surface element determines the corresponding target virtual image.
[0175] In this way, by checking whether the current video frame is the first frame, visual consistency between video frames can be guaranteed and abrupt screen transitions can be avoided. Obtaining the reference virtual screen and the target virtual camera position helps maintain the continuity of the scene, allowing users to experience a smooth transition when watching the video. Dynamically selecting the target voxel face based on the distance between the reference camera and the target camera position makes scene rendering more flexible and adaptable to changes. If it is not the first video frame, there is no need to recalculate the entire scene, which can save computing resources. Only voxel faces associated with the target virtual camera are processed, which reduces the rendering burden and improves rendering efficiency. By selecting the voxel face most relevant to the target virtual camera, the rendering results can be optimized to provide clearer visual effects. Allowing position differences between the reference camera and the target camera supports camera movement and dynamic changes in the scene.
[0176] In some embodiments, after obtaining a reference camera position of a reference virtual camera in a preset virtual scene and a target camera position of a target virtual camera in the preset virtual scene, in response to a distance between the reference camera position and the target camera position being less than a distance threshold, the reference virtual picture is determined as the target virtual picture.
[0177] In some embodiments, when the distance between the reference camera position and the target camera position is less than a distance threshold, it indicates that there is a small deviation in the shooting angles of the reference camera position and the target camera position for the preset virtual scene, that is, there is a small discrepancy between the images of the preset virtual scene captured by the reference virtual camera and the target virtual camera, respectively. At this time, the target virtual image can reuse the reference virtual image, thereby directly determining the reference virtual image as the target virtual image.
[0178] In this way, when the picture information indicates that the target virtual picture is not the first video frame of the video, and the distance between the reference camera position and the target camera position is less than the distance threshold, it means that there is a small deviation between the shooting angles of the reference camera position and the target camera position for the preset virtual scene. The reference virtual picture is directly determined as the target virtual picture, thereby realizing the reuse of the target virtual picture, thereby effectively saving the time for generating the target virtual picture and effectively improving the generation efficiency of the target virtual picture.
[0179] In step 104 , the preset virtual scene is rendered based on the target voxel surface to obtain a target virtual scene.
[0180] In some embodiments, the target voxel bin includes a plurality of bin points, which are basic units constituting the target voxel bin.
[0181] In some embodiments, referring to FIG. 11 , FIG. 11 is a flow chart of steps 1041 to 1045 of the method for generating a virtual screen provided in an embodiment of the present application. Step 104 shown in FIG. 3 can be implemented through steps 1041 to 1045 shown in FIG. 11 .
[0182] In step 1041 , the target virtual camera is used to collect image information of a target virtual image in a preset virtual scene, and an initial virtual image of the preset virtual scene is generated based on the image information.
[0183] In some embodiments, pixels in the initial virtual image correspond one-to-one with pixels in the target virtual image. Each pixel in the initial virtual image has a corresponding pixel in the target virtual image. For example, if an image needs to be scaled during image processing, each pixel in the initial image is mapped to a new pixel in the scaled image, maintaining a direct relationship between the original pixel and the scaled pixel. This mapping relationship enables image processing algorithms to more accurately control the visual output of the image.
[0184] In some embodiments, the image information is used to indicate virtual scene information in a preset virtual scene that can be captured by a target virtual camera, and the virtual scene information includes the color, texture, etc. of corresponding virtual scene elements.
[0185] In some embodiments, the above-mentioned screen information includes sub-screen information that corresponds one-to-one to the pixel points of the initial virtual screen. The above-mentioned generation of the initial virtual screen of the preset virtual scene based on the screen information can be achieved in the following way: for each sub-screen information, the sub-screen information is determined as the pixel information of the corresponding pixel point, and the pixel information of the pixel point is pixel-wise spliced to obtain the initial virtual screen of the preset virtual scene.
[0186] In some embodiments, the above-mentioned pixel stitching refers to the process of stitching pixel points according to the corresponding arrangement rules in the preset virtual scene to obtain a virtual picture, and the arrangement rules of the pixel points in the virtual picture meet the corresponding arrangement rules in the preset virtual scene.
[0187] In step 1042 , the following steps 1043 to 1044 are respectively executed for each pixel point in the initial virtual picture to obtain the target virtual picture.
[0188] As an example, the initial virtual picture includes pixel A, pixel B, and pixel C. The following steps 1043 to 1044 are respectively performed for pixel A, pixel B, and pixel C in the initial virtual picture to obtain the target virtual picture.
[0189] In step 1043 , a target bin point associated with the pixel point is selected from a plurality of bin points of the target voxel bin, and the illumination intensity of the target bin point is obtained.
[0190] In some embodiments, the target surface element point associated with the pixel point refers to the surface element point passing through the line connecting the pixel point and the target camera position, that is, the target surface element point is imaged on the pixel point of the object after being captured by the target virtual camera at the target camera position.
[0191] In some embodiments, the above-mentioned step 1043 selects the target face element point associated with the pixel point from multiple face element points of the target voxel face element, which can be achieved as follows: obtain the target camera position of the target virtual camera in the preset virtual scene, and generate a virtual detection line corresponding to the pixel point in the preset virtual scene with the pixel point as the starting point and the target camera position as the end point; for each face element point, when the virtual detection line corresponding to the pixel point passes through the face element point, the face element point is determined as the target face element point.
[0192] In some embodiments, when the virtual detection line corresponding to the pixel point does not pass through the bin point, the bin point is not determined as the target bin point.
[0193] In some embodiments, the virtual detection line may also be an extension of a line segment starting from a pixel point and ending at the target camera position.
[0194] In some embodiments, the position information of the target virtual camera is obtained from a preset virtual scene, which generally includes the three-dimensional coordinates of the camera. For each pixel point, a ray or similar algorithm is used to generate a virtual detection line starting from the pixel point and toward the target virtual camera position. This line can be regarded as a ray that extends from the pixel point to the camera position in three-dimensional space. All surface element points (points on the voxel surface element) in the preset virtual scene are traversed. For each surface element point, check whether the previously generated virtual detection line passes through the point. If the virtual detection line passes through a certain surface element point, the surface element point is marked as the target surface element point.
[0195] In step 1044 , when the value of the illumination intensity is not equal to zero, the bin color value of the target bin point is obtained, and based on the bin color value, the pixel point is shaded to obtain a shaded pixel point.
[0196] In some embodiments, when the illumination intensity is not equal to zero, it indicates that the target surface element point can be imaged on the corresponding pixel point. At this time, the pixel point can be colored based on the surface element color value of the target surface element point to obtain a colored pixel point.
[0197] In some embodiments, the above-mentioned step 1044 of coloring the pixel points based on the facet color value to obtain colored pixel points can be achieved as follows: obtaining multiple light intensity-adjustment coefficient index entries, and determining the target index entry containing the light intensity of the target facet point from the multiple light intensity-adjustment coefficient index entries; determining the adjustment coefficient in the target index entry as the target adjustment coefficient of the pixel point; determining the product of the facet color value and the target adjustment coefficient as the reference color value, and setting the color value of the pixel point to the reference color value to obtain a colored pixel point.
[0198] In some embodiments, the light intensity is negatively correlated with the adjustment coefficient, that is, the greater the light intensity, the smaller the corresponding adjustment coefficient, and thus the reference color value corresponding to the product value of the facet color value and the target adjustment coefficient is smaller, making the reference color value brighter; the smaller the light intensity, the larger the corresponding adjustment coefficient, and thus the reference color value corresponding to the product value of the facet color value and the target adjustment coefficient is larger, making the reference color value darker.
[0199] In this way, the facet color value is adjusted by the illumination intensity of the target facet point and the target adjustment coefficient, and the pixel points are colored using the obtained reference color value, so that the color presented by the colored pixel points can more accurately reflect the color of the target facet point in the preset virtual scene, effectively improving the presentation effect of the target virtual picture.
[0200] In step 1045, when the value of the light intensity is equal to zero, the target color value is obtained, and the color value of the pixel point is set to the target color value to obtain a colored pixel point.
[0201] In some embodiments, the target color value is different from the bin color value, and the target color value is used to indicate that the pixel point is not visible in the target virtual image.
[0202] As an example, when the color value is represented by an RGB value, the target color value may be (0, 0, 0). In conventional visual effects, when the light intensity is equal to zero, the color usually appears black to indicate an invisible effect in the picture.
[0203] In this way, by obtaining a preset virtual scene and rasterizing each voxel in the preset virtual scene to obtain the voxel bin corresponding to the voxel, the full voxel bin of the preset virtual scene is obtained. When targeting any target virtual image frame of the preset virtual scene, the target voxel bin associated with the target virtual camera is directly selected from the multiple voxel bins to obtain the target virtual image. In this way, even if there may be overlap in voxels between different virtual images, since the full voxel bin of the preset virtual scene has been determined in advance, the target virtual image can be generated by directly selecting the target voxel bin associated with the target virtual camera from the multiple voxel bins. Voxels that are repeated between different image frames do not undergo the same processing repeatedly, thereby effectively improving the efficiency of virtual image generation.
[0204] Below, an exemplary application of the embodiment of the present application in an actual virtual scene rendering application scenario will be described.
[0205] Global illumination technology has always been a key and challenging area in computer graphics. While some technologies have been implemented on PCs, due to performance limitations, a mature solution for mobile global illumination is still lacking. This application example utilizes a surface finite element global illumination algorithm from PCs, with extensive modifications and performance optimizations to achieve stable, real-time global illumination on mobile devices.
[0206] In terms of facet generation, a combination of voxelization and rasterization is adopted. During the vertex shading process, each mesh vertex in the scene is traversed in three directions along the XYZ axes, the vertex closest to the current plane is found, and key information such as world space coordinates, normals, and colors are stored. In the facet generation process, this information can be directly read to generate facets in a global range at one time, avoiding the problems of high performance overhead, slow scene convergence, and inability to control generation density through object geometry information brought about by the traditional solution of generating each frame from the screen space, and has good anisotropy. In the voxelization process, the farther away from the camera, the sparser the generated facets, which further reduces performance overhead. In the final lighting acquisition process, for the lighting acquisition points in the screen space, the embodiment of the present application reuses the scene rendering results of the previous frame, reduces the number of times the facet cache is traversed, increases information, and further improves performance.
[0207] The embodiment of the present application first voxelizes the scene and establishes a grid coordinate system (the grid resolution can cover the entire scene). Specifically, the 3D discrete space Z3 can be represented as a set of grid points in the 3D space. Any point P in the discrete space can be represented by its Cartesian coordinates P (x, y, z), and the grid space is one of them. The embodiment of the present application uses a bounding box covering the entire scene to establish a grid space N3, and divides the entire space into a grid of length, width and height N*N*N according to a certain resolution N. The length cell of each grid in the x direction is x , the length of each grid cell in the y direction y , the length of each grid cell in the z direction z It can be calculated according to the following formula, where L represents the length of the entire bounding box in that direction.
[0208] Among them, L x Used to indicate the length of the bounding box in the x direction, L y Used to indicate the length of the bounding box in the y direction, L z Used to indicate the length of the bounding box in the z direction.
[0209] With the concept of the grid coordinate system, the embodiment of the present application can map the coordinates of any point in the world space to the grid coordinate system. For example, if the coordinates of any point are (X0, Y0, Z0), and the grid coordinate system is established only in the first quadrant, the corresponding grid coordinate system (X, Y, Z) can be simplified as follows:
[0210] Among them, Cell x Used to indicate the length of each grid in the x direction, Cell y Used to indicate the length of each grid in the y direction, Cell zUsed to indicate the length of each grid in the y direction.
[0211] Depth occlusion culling is an acceleration structure of the traditional rasterization pipeline. It only rasterizes the meshes visible from the current view and is enabled by default. Since this embodiment of the application needs to traverse all mesh vertices in the scene, we set r.AllowO cclusionQueries = True in the configuration file to disable culling.
[0212] In the rasterization pipeline, the three directions of the grid coordinate system: X, Y, and Z are processed separately, that is, three rasterizations are performed in the three directions, and the projection surface and resolution are the grid coordinate system in this direction. At the same time, since the voxel is a cube with six planes, the embodiment of the present application opens six texture maps to record information in the six directions of X, Y, Z, -X, -Y, and -Z respectively. For example, in the positive direction of the X axis, the YZ plane is the projection surface for rasterization. The embodiment of the present application can store the front and back information of the selected grid vertex in the texture in the X direction or -X direction, so two textures of the front and back are required for each direction, for a total of six.
[0213] In some embodiments, referring to FIG12, FIG12 is a schematic diagram of the principle of the voxel of the method for generating a virtual screen provided by an embodiment of the present application. FIG12 is illustrated by taking the positive direction of the x-axis pointing outside the screen as an example. FIG12 shows the rasterization of a certain voxel in the direction of the x-axis pointing outside the screen. In the rasterization process, the vertex shader will first traverse the vertices of each mesh (for example, vertex 1, vertex 2, vertex 3, vertex 4 and vertex 5 as shown in FIG12), and pass the data of the mesh vertex (such as coordinates, colors, normals, transformation matrices, etc.) to the pixel shader. FIG12 shows that the vertex shader passes 5 vertices (vertex 1, vertex 2, vertex 3, vertex 4 and vertex 5) to the pixel shader, indicating that there are five vertices in this direction that fall within the range of this voxel. The embodiment of the present application traverses the positions of these five vertices in a pipelined manner, starting from vertex 1 to vertex 5. Taking vertex 1 as an example, the embodiment of the present application simultaneously obtains the front and back attributes of vertex 1 in the vertex shader. If vertex 1 is on the front side, the vertex coordinates of vertex 1 are divided by the voxel side length to obtain the division result, the division result is decimalized to obtain the relative offset of vertex 1 within the voxel, and the difference between the x component of the relative offset and 1 is determined as the target distance of vertex 1 relative to the x front side. If vertex 1 is on the back side, the vertex coordinates of vertex 1 are divided by the voxel side length to obtain the division result, the division result is decimalized to obtain the relative offset of vertex 1 within the voxel, and the x component of the relative offset is determined as the target distance of vertex 1 relative to the x back side. The currently stored minimum distance is obtained, and the minimum distance is compared with the target distance corresponding to vertex 1 to obtain a comparison result. When the comparison result indicates that the target distance is less than the minimum distance, the attributes of vertex 1 are written into the map of the corresponding direction, and the minimum distance is updated. In this embodiment of the application, the position, normal, abedo, primID, and Emissive information of vertex 1 are stored in the map in the corresponding X direction. If vertex 1 is on the reverse side, this information is stored in the map in the negative X direction. If vertex 1 is on the front side, this information is stored in the map in the positive X direction. In this way, after rasterization in three directions, the information of the vertex closest to each voxel face in each voxel will be stored in the maps in all six directions. During the facet generation process, we can directly obtain the data from the map at one time.
[0214] In some embodiments, see FIG13 , which is a schematic diagram illustrating the voxelization process of the method for generating a virtual image provided by an embodiment of the present application. Since the length, width, and height of each grid in the grid coordinate system can be freely set, the embodiment of the present application uses a multi-level grid approach for voxelization. In this embodiment, the first-level grid is set within 50 meters from the camera, which has the highest accuracy. Each grid is 2*2*2 in size. The second-level grid is set between 50 meters and 250 meters from the camera. Each grid is 4*4*4 in size. The third-level grid is set between 250 meters and the boundary of the grid coordinate system. Each grid is 8*8*8 in size. The closer the voxel is to the camera, the smaller the radius. The farther the voxel is from the camera, the larger the radius. This achieves higher accuracy close up and lower accuracy far away. Referring to FIG13 , the first-level, second-level, and third-level grids each include 64 voxels. The fourth-level grid can include 8 voxels. The fifth-level grid can include 1 voxel. Furthermore, the voxel size in the first-level grid is smaller than that in the second-level grid, the voxel size in the second-level grid is smaller than that in the third-level grid, and the voxel size in the fourth-level grid is smaller than that in the fifth-level grid.
[0215] In some embodiments, see Figure 14, which is a schematic diagram of the principle of the bin of the virtual screen generation method provided by the embodiment of the present application. The embodiment of the present application introduces the rendering result of the previous frame into the finite element GI. The software ray following will return the position coordinates of the point where the light hits. The traditional solution is to traverse the bins around this position and take the weighted average of the lighting information as the color of the point. This solution of obtaining all color information from bins has limitations. Since the expression of the scene is discrete, some high-precision scene information may not be obtained, such as the four color planes mentioned above (see Figure 14, plane 41 with color A, plane 42 with color B, plane 43 with color C, and plane 44 with color D). Since only one color can be obtained as the final color, for the light whose hitting point is within the screen, the embodiment of the present application sets a value x between 0 and 1. The probability of the light having x is to average the bins according to the traditional solution, and there is a probability of (1-x) to reuse the rendering result of the previous frame, and read the final color of the pixel in the previous frame as the color returned by the light. Since rays are cast every frame, and there are many of them with random directions, many rays are cast onto the plane, and some rays will directly use the color of the point as the return value, which greatly alleviates the information loss problem caused by scene discretization.
[0216] In some embodiments, referring to FIG15 , FIG15 is a schematic diagram of the effect of the first virtual screen in the related art. The distribution of the facets 61 in the screen space of the virtual screen shown in FIG15 presents a disorderly distribution. Referring to FIG16 , FIG16 is a schematic diagram of the effect of the virtual screen provided in an embodiment of the present application. The facets 62 closer to the virtual camera are larger in size, and the facets 63 farther from the virtual camera are smaller in size, showing a negative correlation between the facet size and the distance between the virtual camera.
[0217] In some embodiments, referring to FIG17 , FIG17 is a schematic diagram of the effect of the second virtual screen provided in an embodiment of the present application. The facet 65 closer to the virtual camera is larger in size, and the facet 64 farther from the virtual camera is smaller in size, showing a negative correlation between the facet size and the distance between the virtual camera. At the same time, the facet 64 and the facet 65 are distributed in an orderly manner, which is more orderly than the facet distribution in FIG16 .
[0218] In some embodiments, referring to Figures 18 to 19, Figure 18 is a schematic diagram of the effect of the surface element illumination cache in the related art, and Figure 19 is a schematic diagram of the effect of the surface element illumination cache provided by the embodiment of the present application. It can be observed that the effect of the surface element illumination cache provided by the embodiment of the present application has more detailed information, fewer black spots, and faster convergence than the related art. Referring to Figure 18, the surface element illumination cache in the related art has black spots at the virtual scene position 67. Referring to Figure 19, the effect of the surface element illumination cache provided by the embodiment of the present application does not have black spots at the corresponding virtual scene position 68.
[0219] In this way, by obtaining a preset virtual scene and rasterizing each voxel in the preset virtual scene to obtain the voxel bin corresponding to the voxel, the full voxel bin of the preset virtual scene is obtained. When targeting any target virtual image frame of the preset virtual scene, the target voxel bin associated with the target virtual camera is directly selected from the multiple voxel bins to obtain the target virtual image. In this way, even if there may be overlap in voxels between different virtual images, since the full voxel bin of the preset virtual scene has been determined in advance, the target virtual image can be generated by directly selecting the target voxel bin associated with the target virtual camera from the multiple voxel bins. Voxels that are repeated between different image frames do not undergo the same processing repeatedly, thereby effectively improving the efficiency of virtual image generation.
[0220] It is understandable that in the embodiments of the present application, when data related to preset virtual scenes is involved, when the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0221] The following further describes an exemplary structure of a virtual screen generation device 455 provided in an embodiment of the present application implemented as a software module. In some embodiments, as shown in FIG2 , the software modules in the virtual screen generation device 455 stored in the memory 450 may include: an acquisition module 4551 configured to acquire a preset virtual scene, wherein the preset virtual scene includes a plurality of voxels, and the voxels include a plurality of voxel planes with different normal directions; a rasterization module 4552 configured to rasterize each voxel along each normal direction of the voxel to obtain voxel planes corresponding to each voxel plane of the voxel, wherein the voxel plane is used to describe the virtual scene information of the voxel in the corresponding normal direction; a selection module 4553 configured to select a target voxel plane associated with a target virtual camera in the preset virtual scene from the plurality of voxel planes; and a screen coloring module 4554 configured to perform screen coloring on the preset virtual scene based on the target voxel plane to obtain a target virtual screen.
[0222] In some embodiments, the acquisition module is further configured to acquire an initial virtual scene, and voxelize the initial virtual scene to obtain a reference virtual scene including a target number of initial voxels; acquire an initial camera position of an initial virtual camera in the reference virtual scene, and a voxel position of each of the initial voxels in the reference virtual scene; determine the distance between the initial camera position and each of the voxel positions in the reference virtual scene, and based on the distance, adjust the size of each of the initial voxels in the reference virtual scene to obtain the preset virtual scene.
[0223] In some embodiments, the acquisition module is further configured to acquire the distance between the initial camera position and the position of each voxel in the reference virtual scene, and the mapping relationship between the distance and the size of each voxel in the preset virtual scene, wherein the distance between the initial camera position and the position of each voxel in the reference virtual scene in the mapping relationship is negatively correlated with the size of each voxel; the following processing is performed on each initial voxel in the reference virtual scene to obtain the preset virtual scene: based on the distance between the initial camera position and the voxel position corresponding to the initial voxel and the mapping relationship, the target size of the initial virtual voxel is determined; the size of the initial voxel in the reference virtual scene is adjusted to the target size to obtain the voxel corresponding to the initial voxel.
[0224] In some embodiments, the preset virtual scene includes multiple virtual objects, and the virtual objects include multiple object points. The rasterization module is further configured to determine at least one candidate object point located within the voxel from the multiple object points of the preset virtual scene; in the preset virtual scene, the following processing is performed on each voxel surface of the voxel: at least one target object point is selected from the at least one candidate object point, and the lines connecting the target object point and each point on the voxel surface do not pass through other candidate object points; based on the target object point, the voxel is rasterized to obtain the voxel surface element corresponding to the voxel surface.
[0225] In some embodiments, the rasterization module is further configured to, when the number of candidate object points located within the voxel is one, determine the candidate object point as the target object point; when the number of candidate object points located within the voxel is multiple, perform the following processing on each candidate object point: when the lines connecting the candidate object point and each point on the voxel surface do not pass through other candidate object points, determine the candidate object point as a reference object point; and determine the reference object point closest to the voxel surface as the target object point.
[0226] In some embodiments, the selection module is further configured to obtain the target camera position of the target virtual camera in the preset virtual scene, and the target virtual camera is used to collect image information of the target virtual image in the preset virtual scene; in the preset virtual scene, a virtual detection line corresponding to each voxel surface is generated with the center position of each voxel surface as the starting point and the target camera position as the end point; based on the virtual detection line, the target voxel surface element associated with the target virtual camera is selected from the voxel surface elements corresponding to each voxel surface.
[0227] In some embodiments, the above-mentioned selection module is further configured to perform the following processing for each voxel surface corresponding to the voxel surface: in the preset virtual scene, determine the detection information of the virtual detection line corresponding to the voxel surface; when the detection information indicates that the virtual detection line corresponding to the voxel surface does not pass through other voxel surfaces in the preset virtual scene, determine the voxel surface as the target voxel surface.
[0228] In some embodiments, the above-mentioned virtual screen generation device also includes: an information acquisition module, configured to obtain screen information of the target virtual screen, and the screen information is used to indicate whether the target virtual screen is the first video frame in the video corresponding to the preset virtual scene; the above-mentioned selection module is also configured to select the target voxel face associated with the target virtual camera from the multiple voxel face elements in response to the screen information indicating that the target virtual screen is the first video frame.
[0229] In some embodiments, the device for generating the above-mentioned virtual screen further includes: a position acquisition module, configured to acquire a reference virtual screen in the video in response to the screen information indicating that the target virtual screen is not the first video frame, wherein the reference virtual screen is a virtual screen frame previous to the target virtual screen in the video; acquire a reference camera position of a reference virtual camera in the preset virtual scene, and a target camera position of a target virtual camera in the preset virtual scene; wherein the reference virtual camera is used to collect screen information of the reference virtual screen in the preset virtual scene, and the target virtual camera is used to collect screen information of the target virtual screen in the preset virtual scene; the above-mentioned selection module is further configured to select a target voxel face associated with the target virtual camera from a plurality of voxel face elements in response to the distance between the reference camera position and the target camera position being greater than or equal to a distance threshold.
[0230] In some embodiments, the apparatus for generating a virtual screen further includes: a determination module configured to determine the reference virtual screen as the target virtual screen in response to the distance between the reference camera position and the target camera position being less than the distance threshold.
[0231] In some embodiments, the above-mentioned screen coloring module is further configured to collect screen information of the target virtual screen in the preset virtual scene through a target virtual camera, and generate an initial virtual screen of the preset virtual scene based on the screen information, wherein the pixel points of the initial virtual screen correspond one-to-one to the pixel points of the target virtual screen; the following processing is performed on each pixel point in the initial virtual screen to obtain the target virtual screen: from the multiple surface element points of the target voxel surface element, a target surface element point associated with the pixel point is selected, and the illumination intensity of the target surface element point is obtained; when the value of the illumination intensity is not equal to zero, the surface element color value of the target surface element point is obtained, and the pixel point is colored based on the surface element color value to obtain a colored pixel point; when the value of the illumination intensity is equal to zero, the target color value is obtained, and the color value of the pixel point is set to the target color value to obtain the colored pixel point, and the target color value is different from the surface element color value.
[0232] In some embodiments, the above-mentioned screen coloring module is further configured to obtain the target camera position of the target virtual camera in the preset virtual scene, and in the preset virtual scene, with the pixel point as the starting point and the target camera position as the end point, generate a virtual detection line corresponding to the pixel point; for each of the surface element points, when the virtual detection line corresponding to the pixel point passes through the surface element point, the surface element point is determined as the target surface element point.
[0233] In some embodiments, the above-mentioned screen coloring module is also configured to obtain multiple light intensity-adjustment coefficient index entries, and determine the target index entry containing the light intensity of the target surface element point from the multiple light intensity-adjustment coefficient index entries; determine the adjustment coefficient in the target index entry as the target adjustment coefficient of the pixel point; determine the product of the surface element color value and the target adjustment coefficient as the reference color value, and set the color value of the pixel point to the reference color value to obtain the colored pixel point.
[0234] The present invention provides a computer program product including a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the method for generating a virtual screen described in the present invention.
[0235] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the method for generating a virtual screen provided in an embodiment of the present application, for example, the method for generating a virtual screen as shown in Figure 3.
[0236] In some embodiments, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), a flash memory, a magnetic surface memory, an optical disk, or a CD-ROM; or it may be various electronic devices including one or any combination of the above memories.
[0237] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0238] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0239] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0240] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
[0241] In summary, the embodiments of the present application have the following beneficial effects:
[0242] (1) By obtaining a preset virtual scene and performing rasterization on each voxel in the preset virtual scene, the voxel face corresponding to the voxel is obtained, thereby obtaining the full voxel face of the preset virtual scene. When targeting any target virtual image of the preset virtual scene, the target voxel face associated with the target virtual camera is directly selected from the multiple voxel faces to obtain the target virtual image. In this way, even if there may be overlap of voxels between different virtual images, since the full voxel face of the preset virtual scene has been determined in advance, the target voxel face associated with the target virtual camera can be directly selected from the multiple voxel faces to achieve the generation of the target virtual image. The repeated voxels between different image frames will not be repeatedly processed in the same way, thereby effectively improving the generation efficiency of the virtual image.
[0243] (2) By obtaining the initial camera position of the initial virtual camera in the reference virtual scene and the voxel position of each initial voxel in the reference virtual scene, the distance between the initial camera position and each voxel position is determined, and based on the distance, the size of each initial voxel in the reference virtual scene is adjusted to obtain the preset virtual scene. Since the size of the adjusted initial voxel is negatively correlated with the corresponding distance, the size of the initial voxel farther from the initial virtual camera is smaller, and the size of the initial voxel closer to the initial virtual camera is larger, so that the voxels closer to the initial virtual camera in the preset virtual scene can cover more scene information of the initial virtual scene, so that the voxels closer to the initial virtual camera in the preset virtual scene have higher scene accuracy, and the voxels farther from the initial virtual camera have lower scene accuracy, which effectively reduces the resource occupation of the preset virtual scene, so that the obtained preset virtual scene can be more consistent with the real visual effect, and at the same time effectively improves the resource utilization of the preset virtual scene.
[0244] (3) When there are multiple candidate object points located in a voxel, and the lines connecting the candidate object point and each point on the voxel surface do not pass through other candidate object points, the candidate object point is determined as the reference object point, and the reference object point closest to the voxel surface is determined as the target object point, so that the determined target object point is the object point in the voxel that is closest to the voxel surface and is not blocked by other candidate object points, so that the determined target object point can accurately reflect the scene characteristics of the corresponding voxel surface, making the determined voxel surface element more accurate.
[0245] (4) When there are multiple candidate object points within a voxel, the object point closest to the voxel surface is directly determined as the target object point, so that the determined target object point is the closest to the voxel surface within the voxel, thereby more efficiently determining the target object point that can accurately reflect the scene characteristics of the corresponding voxel surface, making the determined voxel surface element more accurate.
[0246] (5) When the detection information of the virtual detection line indicates that the virtual detection line corresponding to the voxel surface does not pass through other voxel surfaces in the preset virtual scene, it means that there is no obstruction between the target virtual camera and the voxel surface in the preset virtual scene, that is, in the preset virtual scene, the target virtual camera corresponding to the target virtual screen can collect the voxel surface element. At this time, this voxel surface element is determined as the target voxel surface element, so that the preset virtual scene can be colored based on the target voxel surface element to obtain the target virtual screen, thereby avoiding voxel surfaces other than the target voxel surface element from participating in the screen coloring calculation process, thereby effectively improving the screen coloring efficiency.
[0247] (6) When the picture information indicates that the target virtual picture is not the first video frame of the video, and the distance between the reference camera position and the target camera position is less than the distance threshold, it means that there is a small deviation between the shooting angles of the reference camera position and the target camera position for the preset virtual scene. The reference virtual picture is directly determined as the target virtual picture, thereby realizing the reuse of the target virtual picture, thereby effectively saving the time for generating the target virtual picture and effectively improving the generation efficiency of the target virtual picture.
[0248] (7) The facet color value is adjusted by the illumination intensity of the target facet point and the target adjustment coefficient, and the pixel points are colored using the obtained reference color value, so that the color presented by the colored pixel points can more accurately reflect the color of the target facet point in the preset virtual scene, effectively improving the presentation effect of the target virtual picture.
[0249] (8) The light intensity is negatively correlated with the adjustment coefficient, that is, the greater the light intensity, the smaller the corresponding adjustment coefficient, and thus the smaller the reference color value corresponding to the product of the facet color value and the target adjustment coefficient, making the reference color value brighter; the smaller the light intensity, the larger the corresponding adjustment coefficient, and thus the larger the reference color value corresponding to the product of the facet color value and the target adjustment coefficient, making the reference color value darker.
[0250] (9) When the distance between the reference camera position and the target camera position is greater than or equal to the distance threshold, it means that there is a large deviation between the shooting angles of the reference camera position and the target camera position for the preset virtual scene, that is, there is a large discrepancy between the images of the preset virtual scene captured by the reference virtual camera and the target virtual camera respectively. At this time, the target virtual image cannot reuse the reference virtual image, so that the target voxel surface element associated with the target virtual camera can be selected from multiple voxel surface elements, and the target voxel surface element determines the corresponding target virtual image, thereby effectively improving the display accuracy of the target virtual image.
[0251] (10) The embodiment of the present application introduces the rendering result of the previous frame into the finite element GI. The software ray following will return the position coordinates of the point where the light hits. The traditional solution is to traverse the surface elements around this position and take the weighted average of the lighting information as the color of the point. This solution of obtaining all color information from the surface elements has limitations. Since the expression of the scene is discrete, some high-precision scene information may not be obtained. For example, for the four-color plane mentioned above, only one color can be obtained. For the light whose hitting point is within the screen, the embodiment of the present application sets a value x between 0 and 1. The light has a probability of x to average the surface elements according to the traditional solution, and has a probability of (1-x) to reuse the rendering result of the previous frame, and read the final color of the pixel in the previous frame as the color returned by the light. Since the light is projected in each frame, and the number is large and the direction is random. There are many rays projected onto the plane, and some rays will directly use the color of the point as the return value, which greatly alleviates the information loss problem caused by the discretization of the scene.
[0252] (11) In terms of facet generation, a combination of voxelization and rasterization is adopted. During the vertex shading process, each mesh vertex in the scene is traversed in three directions along the XYZ axes, the vertex closest to the current plane is found, and key information such as world space coordinates, normals, and colors are stored. During the facet generation process, this information can be directly read to generate facets in the global range at one time, avoiding the problems of high performance overhead, slow scene convergence, and inability to control generation density through object geometry information in traditional solutions for each frame generated from the screen space, and having good anisotropy. In the voxelization process, the farther away from the camera, the sparser the generated facets, further reducing performance overhead. In the final lighting acquisition process, for the lighting acquisition points in the screen space, the embodiment of the present application reuses the scene rendering results of the previous frame, reduces the number of times the facet cache is traversed, increases information, and further improves performance.
[0253] (12) By checking whether the current video frame is the first frame, the visual consistency between video frames can be guaranteed and abrupt screen transitions can be avoided. Obtaining the reference virtual screen and the target virtual camera position helps to maintain the continuity of the scene, allowing users to experience a smooth transition when watching the video. Dynamically selecting the target voxel face element based on the distance between the reference camera and the target camera position makes scene rendering more flexible and adaptable to changes. If it is not the first video frame, there is no need to recalculate the entire scene, which can save computing resources. Only the voxel face elements associated with the target virtual camera are processed, which reduces the rendering burden and improves rendering efficiency. By selecting the voxel face elements most relevant to the target virtual camera, the rendering results can be optimized to provide clearer visual effects. Allowing position differences between the reference camera and the target camera supports the movement and dynamic changes of the camera in the scene.
[0254] (13) By determining the detection information of the virtual detection line corresponding to the voxel surface in the preset virtual scene, more accurate scene analysis and object detection can be achieved. When the detection information shows that the virtual detection line does not pass through other voxel surfaces in the scene, the possibility of misidentification or overlapping objects can be eliminated, thereby improving the accuracy of scene understanding. Determining the voxel surface element as the target voxel surface element can help optimize the data structure and make subsequent processing more efficient. By identifying the target voxel surface element, unnecessary rendering calculations can be reduced and only key surfaces can be rendered, thereby improving rendering efficiency. Excluding non-target voxel surfaces can make the scene visualization clearer and reduce visual clutter. Only processing virtual detection lines that do not intersect with other voxel surfaces reduces unnecessary calculations and improves the overall processing speed. In a game or simulation environment, reducing the number of geometric bodies that need to be rendered can significantly improve performance and ensure a smooth user experience.
[0255] (14) By screening candidate object points within a voxel as target object points, the position of objects in the scene can be determined more accurately, thereby improving the accuracy of the overall scene. When there is only one candidate object point within a voxel, it is directly determined as the target object point, which can effectively reduce the misidentification caused by noise or other interference factors. When processing multiple candidate object points, by only considering those reference object points whose lines connecting the voxel surface do not pass through other candidate object points, the computational complexity of subsequent processing can be reduced and performance can be optimized. Conflicts or overlaps between object points can be avoided, ensuring that the target object point within each voxel is unique, which is conducive to object segmentation and recognition. In virtual reality or three-dimensional visualization applications, by accurately identifying the target object point, the visual effect of the rendering can be improved and visual distortion can be reduced. When there are multiple candidate object points, by selecting the reference object point closest to the voxel surface as the target object point, more complex decision-making processes such as path planning and collision detection can be supported. By screening and judging the candidate object points, the robustness of the entire processing process is enhanced, making it insensitive to small changes in the input data. By screening the final target object point, redundancy in the scene data can be reduced, making it easier to store and transmit.
[0256] (15) By obtaining the distance between the camera and the voxel and adjusting the voxel size according to the mapping relationship, the scene can be rendered more accurately, making the rendering result closer to the visual effect of the real world. The voxel size can be dynamically adjusted according to the camera position, so that the scene rendering can be updated in real time according to the observer's perspective, enhancing immersion and interactivity. By adjusting the voxel size, the rendering performance can be optimized at different observation distances. For voxels far away from the camera, the details can be reduced, thereby reducing the rendering cost. By pre-defining the mapping relationship of the voxel size, the target size of each voxel can be quickly determined during the rendering process, reducing the amount of calculation and improving rendering efficiency. The level of detail can be dynamically adjusted according to the camera distance, so that nearby objects display higher details, while distant objects are appropriately simplified, improving the overall visual effect.
[0257] (16) By dividing the initial virtual scene into voxels of the same size, it is possible to ensure that computing resources are evenly distributed to each target, thereby improving processing efficiency. The same voxel size can simplify the subsequent calculation process because the same algorithm and calculation method can be used for processing, reducing complexity. Voxels of the same size can make more efficient use of storage space because they are arranged more regularly in the data structure. Uniform voxel division makes parallel processing easier because each voxel can be processed independently by different processing units. In three-dimensional graphics rendering, voxelized scenes can help to perform lighting and shadow calculations faster because voxels of the same size can use the same rendering strategy.
[0258] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A method for generating a virtual picture, the method comprising: Acquire a preset virtual scene, wherein the preset virtual scene includes a plurality of voxels, and the voxels include a plurality of voxel faces with different normal directions; For each of the voxels, rasterizing the voxels in each of the normal directions of the voxels to obtain voxel face elements corresponding to each of the voxel faces of the voxels, wherein the voxel face elements are used to describe virtual scene information of the voxels in the corresponding normal directions; Selecting a target voxel surface element associated with a target virtual camera in the preset virtual scene from the plurality of voxel surfaces elements; Based on the target voxel face, the preset virtual scene is rendered to obtain a target virtual scene.
2. The method according to claim 1, wherein: The step of obtaining a preset virtual scene includes: Acquire an initial virtual scene, and voxelize the initial virtual scene to obtain a reference virtual scene including a target number of initial voxels; Acquire an initial camera position of an initial virtual camera in the reference virtual scene, and a voxel position of each initial voxel in the reference virtual scene; The distances between the initial camera position and the positions of the voxels in the reference virtual scene are determined, and based on the distances, the sizes of the initial voxels in the reference virtual scene are adjusted to obtain the preset virtual scene.
3. The method according to claim 2, wherein: The step of adjusting the size of each of the initial voxels in the reference virtual scene based on the distance to obtain the preset virtual scene includes: Acquire a mapping relationship between the distance between the initial camera position and each voxel position in the reference virtual scene and the size of each voxel in the preset virtual scene, wherein the distance between the initial camera position and each voxel position in the reference virtual scene in the mapping relationship is positively correlated with the size of each voxel; The following processing is performed on each of the initial voxels in the reference virtual scene to obtain the preset virtual scene: Determine a target size of the initial voxel based on a distance between the initial camera position and the voxel position corresponding to the initial voxel and the mapping relationship; The size of the initial voxel in the reference virtual scene is adjusted to the target size to obtain the voxel corresponding to the initial voxel.
4. The method according to claim 3, wherein: The determining the target size of the initial voxel based on the distance between the initial camera position and the voxel position corresponding to the initial voxel and the mapping relationship includes: From the plurality of index entries of the mapping relationship, determine the index entry including the distance corresponding to the voxel position as the target index entry; The size in the target index entry is determined as the target size.
5. The method according to claim 2, wherein: The voxelization process is performed on the initial virtual scene to obtain a reference virtual scene including a target number of initial voxels, including: Acquire the scene size of the initial virtual scene, and divide the scene size by the number of objects to obtain the size of the initial voxel; The initial virtual scene is divided into a target number of initial voxels with corresponding sizes, and a reference virtual scene including the target number of initial voxels is obtained, and the sizes of the initial voxels in the reference virtual scene are the same.
6. The method according to any one of claims 1 to 3, wherein: The preset virtual scene includes a plurality of virtual objects, and the virtual objects include a plurality of object points. The voxels are rasterized in the normal directions of the voxels to obtain voxel face elements corresponding to the voxel faces of the voxels, respectively, including: Determining at least one candidate object point located within the voxel from the plurality of object points of the preset virtual scene; In the preset virtual scene, the following processing is performed on each voxel face of the voxel: Selecting at least one target object point from the at least one candidate object point, wherein the lines connecting the target object point and each point on the voxel plane do not pass through other candidate object points; Based on the target object point, the voxel is rasterized to obtain a voxel surface element corresponding to the voxel surface.
7. The method according to claim 6, wherein: The step of rasterizing the voxel based on the target object point to obtain a voxel face element corresponding to the voxel face includes: Acquire vertex data of the target object point, where the vertex data is used to indicate a geometric primitive of the target object point in the preset virtual scene; The vertex data of the target object point in the voxel is rasterized to obtain the voxel face element corresponding to the voxel face.
8. The method according to claim 6, wherein: The selecting at least one target object point from the at least one candidate object point comprises: When the number of candidate object points located in the voxel is one, determining the candidate object point as the target object point; When there are multiple candidate object points located in the voxel, the following processing is performed for each candidate object point: When the lines connecting the candidate object point and each point on the voxel plane do not pass through other candidate object points, determining the candidate object point as a reference object point; The reference object point closest to the voxel plane is determined as the target object point.
9. The method according to any one of claims 1 to 8, wherein: The step of selecting a target voxel surface element associated with a target virtual camera in the preset virtual scene from the plurality of voxel surfaces elements comprises: Acquire a target camera position of the target virtual camera, wherein the target virtual camera is used to collect picture information of the target virtual picture in the preset virtual scene; In the preset virtual scene, taking the center position of each voxel surface as the starting point and the target camera position as the end point, generating a virtual detection line corresponding to each voxel surface; Based on the virtual detection line, a target voxel surface element associated with the target virtual camera is selected from the voxel surface elements respectively corresponding to each of the voxel surfaces.
10. The method according to claim 9, wherein: The step of selecting, based on the virtual detection line, a target voxel surface element associated with the target virtual camera from the voxel surface elements respectively corresponding to each of the voxel surfaces, comprises: The following processing is performed on the voxel face elements corresponding to each of the voxel faces: In the preset virtual scene, determining detection information of a virtual detection line corresponding to the voxel surface; When the detection information indicates that the virtual detection line corresponding to the voxel surface does not pass through other voxel surfaces in the preset virtual scene, the voxel surface element is determined as the target voxel surface element.
11. The method according to any one of claims 1 to 10, wherein: Before selecting the target voxel surface element associated with the target virtual camera in the preset virtual scene from the plurality of voxel surfaces elements, the method further includes: Acquire the picture information of the target virtual picture, wherein the picture information is used to indicate whether the target virtual picture is the first video frame in the video corresponding to the preset virtual scene; The step of selecting a target voxel surface element associated with a target virtual camera in the preset virtual scene from the plurality of voxel surfaces elements comprises: In response to the picture information indicating that the target virtual picture is the first video frame, a target voxel surface associated with the target virtual camera is selected from the plurality of voxel surfaces.
12. The method according to claim 11, wherein: After acquiring the screen information of the target virtual screen, the method further includes: In response to the picture information indicating that the target virtual picture is not the first video frame, acquiring a reference virtual picture in the video, where the reference virtual picture is a virtual picture frame before the target virtual picture in the video; Acquire a reference camera position of a reference virtual camera in the preset virtual scene, and a target camera position of a target virtual camera in the preset virtual scene; The reference virtual camera is used to collect the image information of the reference virtual image in the preset virtual scene. The target virtual camera is used to collect picture information of the target virtual picture in the preset virtual scene; The step of selecting a target voxel surface element associated with the target virtual camera from the plurality of voxel surfaces elements comprises: In response to the distance between the reference camera position and the target camera position being greater than or equal to a distance threshold, a target voxel bin associated with the target virtual camera is selected from the plurality of voxel bins.
13. The method according to claim 12, wherein: After obtaining the reference camera position of the reference virtual camera in the preset virtual scene and the target camera position of the target virtual camera in the preset virtual scene, the method further includes: In response to a distance between the reference camera position and the target camera position being smaller than the distance threshold, the reference virtual picture is determined as the target virtual picture.
14. The method according to any one of claims 1 to 13, wherein: The target voxel face element includes a plurality of face element points, and the preset virtual scene is colored based on the target voxel face element to obtain a target virtual picture, including: By means of a target virtual camera, in the preset virtual scene, image information of the target virtual image is collected, and based on the image information, an initial virtual image of the preset virtual scene is generated, wherein the pixel points of the initial virtual image correspond one-to-one with the pixel points of the target virtual image; The following processing is performed on each pixel point in the initial virtual picture to obtain the target virtual picture: Selecting a target surface element point associated with the pixel point from a plurality of surface element points of the target voxel surface element, and acquiring the illumination intensity of the target surface element point; When the value of the light intensity is not equal to zero, obtaining a bin color value of the target bin point, and coloring the pixel point based on the bin color value to obtain a colored pixel point; When the value of the light intensity is equal to zero, a target color value is obtained, and the color value of the pixel is set to the target color value to obtain the colored pixel, and the target color value is different from the facet color value.
15. The method according to claim 14, wherein: The step of selecting a target bin point associated with the pixel point from a plurality of bin points of the target voxel bin includes: Acquire a target camera position of a target virtual camera in the preset virtual scene, and generate a virtual detection line corresponding to the pixel point in the preset virtual scene with the pixel point as a starting point and the target camera position as an end point; For each of the bin points, when the virtual detection line corresponding to the pixel point passes through the bin point, the bin point is determined as the target bin point.
16. The method according to claim 14, wherein: The coloring process is performed on the pixel point based on the bin color value to obtain a colored pixel point, including: Acquire a plurality of illumination intensity-adjustment coefficient index entries, and determine a target index entry including the illumination intensity of the target plane element point from the plurality of illumination intensity-adjustment coefficient index entries; Determine the adjustment coefficient in the target index entry as the target adjustment coefficient of the pixel point; The product of the bin color value and the target adjustment coefficient is determined as a reference color value, and the color value of the pixel point is set as the reference color value to obtain the colored pixel point.
17. A device for generating a virtual picture, the device comprising: An acquisition module is configured to acquire a preset virtual scene, wherein the preset virtual scene includes a plurality of voxels, and the voxels include a plurality of voxel faces with different normal directions; A rasterization module is configured to rasterize each voxel from each normal direction of the voxel to obtain voxel face elements corresponding to each voxel face of the voxel, wherein the voxel face elements are used to describe virtual scene information of the voxel in the corresponding normal direction; A selection module configured to select a target voxel surface element associated with a target virtual camera in a preset virtual scene from the plurality of voxel surfaces elements; The picture coloring module is configured to perform picture coloring on the preset virtual scene based on the target voxel surface element to obtain a target virtual picture.
18. An electronic device, comprising: a memory configured to store computer executable instructions or computer programs; The processor is configured to implement the method for generating a virtual screen as described in any one of claims 1 to 16 when executing the computer executable instructions or computer programs stored in the memory.
19. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the method for generating a virtual picture according to any one of claims 1 to 16.
20. A computer program product, comprising a computer program or a computer executable instruction, wherein the computer program or the computer executable instruction, when executed by a processor, implements the method for generating a virtual picture according to any one of claims 1 to 16.
Citation Information
Patent Citations
Information processing method and device
CN115294262A
Global illumination rendering method and device, computer equipment and storage medium
CN115830208A
Illumination rendering method and device, terminal and storage medium
CN116672706A
Virtual picture generation method and device, equipment, storage medium and program product
CN116993894A
Automatic instancing for efficient rendering of three-dimensional virtual environment
US11711494B1