WO2025050797A1 - 一种渲染方法、装置、电子设备、计算机可读存储介质及计算机程序产品 - Google Patents
一种渲染方法、装置、电子设备、计算机可读存储介质及计算机程序产品 Download PDFInfo
- Publication number
- WO2025050797A1 WO2025050797A1 PCT/CN2024/103126 CN2024103126W WO2025050797A1 WO 2025050797 A1 WO2025050797 A1 WO 2025050797A1 CN 2024103126 W CN2024103126 W CN 2024103126W WO 2025050797 A1 WO2025050797 A1 WO 2025050797A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- light source
- virtual
- visible light
- screen
- virtual visible
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—Three-dimensional [3D] image rendering
- G06T15/02—Non-photorealistic rendering
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—Two-dimensional [2D] image generation
- G06T11/60—Creating or editing images; Combining images with text
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—Two-dimensional [2D] image generation
- G06T11/20—Drawing from basic elements
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—Three-dimensional [3D] image rendering
- G06T15/50—Lighting effects
- G06T15/506—Illumination models
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/60—Extraction of image or video features relating to illumination properties, e.g. using a reflectance or lighting model
Definitions
- the present application relates to image processing technology, and in particular to a rendering method, device, electronic device, computer-readable storage medium, and computer program product.
- tiled-based lighting algorithms and cluster-based lighting algorithms are usually used. Both the tiled-based lighting algorithm and the cluster-based lighting algorithm require dividing the screen into multiple blocks, and each screen block maintains a light source list. Updating the light source list of each screen block in a scene with a large number of light sources is a very time-consuming task, which will cause a significant drop in the rendering frame rate.
- Embodiments of the present application provide a rendering method, device, electronic device, computer-readable storage medium, and computer program product, which can improve rendering efficiency.
- the present application provides a rendering method, which is applied to an electronic device, and the method includes:
- Acquire virtual scene data to be rendered determine multiple virtual visible light sources in the virtual scene based on the virtual scene data, and determine the screen ratio of each virtual visible light source;
- the light source list includes a second virtual visible light source whose screen-to-body ratio is greater than or equal to the screen-to-body ratio threshold;
- the first drawing result and the second drawing result are combined to obtain a drawn virtual scene, and the virtual scene is displayed.
- the present application provides a rendering device, including:
- the first determining module is configured to obtain virtual scene data to be rendered, and determine based on the virtual scene data Multiple virtual visible light sources in a virtual scene, and determining a screen ratio of each virtual visible light source;
- a first rendering module is configured to perform batch rendering on a first virtual visible light source among the multiple virtual visible light sources to obtain a first rendering result, wherein a screen-to-body ratio of the first virtual visible light source is less than a preset screen-to-body ratio threshold;
- a second determining module is configured to determine a light source list for each screen segment, wherein the light source list includes a second virtual visible light source whose screen-to-body ratio is greater than or equal to the screen-to-body ratio threshold;
- a second rendering module is configured to perform full-screen rendering based on the light source list of each screen block to obtain a second rendering result
- the display module is configured to merge the first drawing result and the second drawing result to obtain a drawn virtual scene, and display the virtual scene.
- An embodiment of the present application provides an electronic device, the electronic device comprising:
- a memory for storing computer executable instructions
- the processor is used to implement the rendering method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
- An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the rendering method provided in the embodiment of the present application when executed by a processor.
- An embodiment of the present application provides a computer program product, including a computer program or a computer executable instruction.
- the computer program or the computer executable instruction is executed by a processor, the rendering method provided in the embodiment of the present application is implemented.
- multiple virtual visible light sources in the virtual scene are determined, so as to ensure that only the visible light sources are rendered subsequently, which can reduce the amount and complexity of rendering processing data; and determine the screen-to-body ratio of each virtual visible light source, and then, for a first virtual visible light source whose screen-to-body ratio is less than a preset screen-to-body ratio threshold, batch rendering is performed on multiple first virtual visible light sources by calling a batch rendering and drawing command; for a second virtual visible light source whose screen-to-body ratio is greater than or equal to the screen-to-body ratio threshold, a light source list for each screen block is determined, and the light source list only includes the second virtual visible light source, and then based on each screen block, a batch rendering and drawing command is called.
- a scheme combining batch drawing and block rendering is adopted.
- a batch drawing command is called once to complete the drawing of a large number of light sources whose screen-to-body ratio is less than the screen-to-body ratio threshold. While improving the rendering efficiency, it also greatly reduces the calculation amount of block rendering.
- block rendering is performed, that is, the second virtual visible light source in multiple screen blocks is rendered in parallel, which not only ensures the rendering effect of the second virtual visible light source, but also can quickly render a large number of light sources in the virtual scene, thereby improving the rendering efficiency.
- FIG. 1 is a schematic diagram of a network architecture of a rendering system 100 provided in an embodiment of the present application
- FIG2 is a schematic diagram of the structure of a terminal 400 provided in an embodiment of the present application.
- FIG3A is a schematic diagram of an implementation flow of a rendering method provided in an embodiment of the present application.
- 3B is a schematic diagram of an implementation flow of determining a virtual visible light source and a screen ratio of the virtual visible light source provided in an embodiment of the present application;
- FIG4A is a schematic diagram of an implementation process of batch rendering and drawing of a first virtual visible light source provided by an embodiment of the present application
- FIG4B is a schematic diagram of an implementation flow of determining a light source list for each screen segment provided in an embodiment of the present application
- FIG4C is a schematic diagram of a light source node in a light source list provided in an embodiment of the present application.
- FIG5 is a schematic diagram of an implementation process of performing full-screen rendering based on a light source list provided in an embodiment of the present application
- FIG6A is a schematic diagram of an implementation flow of compressing and storing a light source list provided in an embodiment of the present application
- FIG6B is another schematic diagram of compressing and storing a light source list provided by an embodiment of the present application.
- FIG7A is a lighting effect diagram of a city night scene from above an airplane provided in an embodiment of the present application.
- FIG7B is a dynamic light and shadow effect diagram of a vehicle traveling on a road provided by an embodiment of the present application.
- FIG7C is a night scene lighting effect diagram of the Digital Great Wall provided in an embodiment of the present application.
- FIG8 is a schematic diagram of another implementation flow of the rendering method provided in an embodiment of the present application.
- FIG9 is a schematic diagram showing the effects of performing long-distance light source rendering and short-distance light source rendering using the rendering method provided in an embodiment of the present application;
- Figure 10 is a comparison diagram of the rendering method provided in an embodiment of the present application and the cluster based lighting algorithm in the related technology.
- first ⁇ second 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” 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.
- module refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as processing circuits or memories) or a combination thereof.
- a processor or multiple processors or memories
- each module or unit can be part of an overall module or unit that includes the function of the module or unit.
- Point light source refers to a light source that emits light uniformly from a point to the surrounding space.
- Parallel light source refers to a light source that emits parallel and non-divergent light.
- Spotlight is a central light source in the shape of a cone. The farther away from the light source, the larger the illuminated circular area will be.
- Batch rendering generally refers to a method of combining multiple rendering tasks together.
- batch rendering of multiple virtual light sources is to merge multiple virtual light sources together for rendering to improve rendering efficiency.
- Full-screen drawing refers to drawing all screen blocks in the entire screen at once.
- Frustum culling is a spatial culling technique that determines whether an object is visible based on the camera frustum.
- the frustum is a geometric representation of the camera's field of view, consisting of six planes that determine the area of space that the camera can see.
- the system checks whether all objects are completely within the camera's frustum or intersect with it. If the object is not within the frustum, it is culled. Frustum culling cannot cull objects that are within the frustum but are blocked by other objects.
- Light source attenuation coefficient is a parameter that describes the decrease in light source intensity as distance increases. It reflects the characteristic that light intensity gradually decreases as distance increases during propagation. The attenuation coefficient is usually used to calculate the light intensity of the light source at different distances, so as to consider the attenuation effect of the light source when designing a lighting system or performing lighting simulation.
- the screen space is first divided into 2D blocks in real time, and then the list of light sources affecting each block is calculated separately. Finally, each pixel is given a list of light sources according to the block to which it belongs for lighting rendering.
- the screen space is first divided into 3D blocks in real time, and then the list of light sources affecting each block is calculated separately. Finally, each pixel is given a list of light sources according to the block to which it belongs for lighting rendering.
- Tiled based lighting algorithm and cluster based lighting algorithm will only read G-buffer once and write color buffer once in the lighting rendering process, which is independent of the number of light sources. It can greatly reduce bandwidth consumption and increase the number of light sources on the same screen to several thousand. However, updating the light source list of each block in a scene with a large number of light sources is also a very time-consuming task. When the number of light sources in the scene reaches tens of thousands or even hundreds of thousands, the frame rate will drop significantly.
- the embodiments of the present application provide a rendering method, device, electronic device, computer-readable storage medium and computer program product, which can improve rendering efficiency.
- the following describes an exemplary application of the electronic device provided by the embodiments of the present application.
- the electronic device provided by the embodiments of the present application can be implemented as a laptop, a tablet computer, a desktop computer, a set-top box, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device), a smart phone, a smart speaker, a smart watch, a smart TV, a vehicle-mounted terminal and other types of user terminals.
- a mobile device for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device
- smart phone a smart speaker
- smart watch a smart TV
- vehicle-mounted terminal a vehicle-mounted terminal
- FIG. 1 is a schematic diagram of a network architecture of a rendering system 100 provided in an embodiment of the present application.
- the rendering system 100 includes a server 200, a network 300, and a terminal 400.
- the terminal 400 is connected to the server 200 via the network 300.
- the network 300 may be a wide area network or a local area network, or a combination of the two.
- the terminal 400 is used to obtain virtual scene data from the server 200, wherein the virtual scene data may be virtual scene data in a game application, or virtual scene data of virtual reality or virtual scene data of augmented reality.
- the terminal 400 stores the virtual scene data in a local storage space, and then the terminal 400 determines multiple virtual visible light sources in the virtual scene based on the virtual scene data, and determines the screen ratio of each virtual visible light source, and then for the first virtual visible light source whose screen ratio is less than the preset screen ratio threshold, the multiple first virtual visible light sources are batch-rendered by calling the batch rendering command to obtain a first drawing result; for the second virtual visible light source whose screen ratio is greater than or equal to the screen ratio threshold, the light source list of each screen block is determined, and only the second virtual visible light source is included in the light source list, and then full-screen drawing is performed based on the light source list of each screen block to obtain a second drawing result, and the first drawing result and the second drawing result are merged to obtain a rendered virtual scene, and the rendered virtual scene
- the terminal When rendering a virtual scene, the terminal adopts a solution that combines batch drawing and block rendering.
- a batch drawing command By calling a batch drawing command once, it completes the drawing of a large number of light sources whose screen-to-body ratio is less than the screen-to-body ratio threshold. This greatly reduces the amount of calculation for block rendering, making it possible to quickly render a large number of light sources in the virtual scene and improve rendering efficiency.
- server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
- the terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, etc., but is not limited thereto.
- the terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.
- FIG. 2 is a schematic diagram of the structure of a terminal 400 provided in an embodiment of the present application.
- the terminal 400 shown in FIG. 2 includes: at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430.
- the various components in the terminal 400 are coupled together via a bus system 440.
- the bus system 440 is used to realize the connection and communication between these components.
- the bus system 440 also includes a power bus, a control bus, and a status signal bus.
- various buses are labeled as bus system 440 in FIG. 2 .
- Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
- DSP digital signal processor
- the user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and/or one or more visual display screens.
- the user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
- 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 410.
- the memory 450 includes a volatile memory or a nonvolatile memory, and may also include both volatile and nonvolatile memories.
- the nonvolatile 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 embodiment of the present application is intended to include any suitable type of memory.
- memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
- Operating system 451 including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
- a network communication module 452 used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;
- a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);
- output devices 431 e.g., display screen, speaker, etc.
- the user interface 430 e.g., a user interface for operating peripherals and displaying content and information
- the input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.
- the apparatus provided in the embodiments of the present application may be implemented in hardware.
- the apparatus provided in the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the rendering method provided in the embodiments of the present application.
- the processor in the form of a hardware decoding processor may be one or more application specific integrated circuits (ASIC), digital signal processors, or the like.
- ASIC application specific integrated circuits
- DSP Digital Signal Processor
- Programmable Logic Device Programmable Logic Device, PLD
- Complex Programmable Logic Device Complex Programmable Logic Device, CPLD
- Field-Programmable Gate Array Field-Programmable Gate Array
- FPGA Field-Programmable Gate Array
- the electronic device that implements the rendering method of the embodiment of the present application may be a terminal. Therefore, the execution subject of each step will not be repeatedly described below.
- FIG. 3A is a schematic diagram of an implementation flow of a rendering method provided in an embodiment of the present application, which will be described in conjunction with the steps shown in FIG. 3A , and the main body of the steps in FIG. 3A is a terminal.
- step 101 virtual scene data to be rendered is obtained, and based on the virtual scene data, a plurality of virtual visible light sources in the virtual scene are determined, and the screen ratio of each virtual visible light source is determined.
- the virtual scene data to be rendered may be virtual scene data in a game application, or virtual scene data of virtual reality or virtual scene data of augmented reality.
- step 101 may be implemented by the following steps 1011 to 1016 , which are described below in conjunction with FIG3B .
- step 1011 a plurality of virtual light sources existing in the virtual scene are determined based on the virtual scene data.
- the virtual scene data includes object identifiers of each virtual object in the virtual scene, and location information of each virtual object.
- the virtual objects in the virtual scene include fixed and immovable objects, such as virtual buildings, virtual trees, etc., and may also include movable objects, such as virtual monsters, virtual vehicles, etc.
- the virtual object may also be a virtual light source, such as a fixed virtual street lamp, various virtual lamps in a virtual building, a headlamp or a flashlight worn on a virtual character, or a headlight of a virtual car.
- the object identifier of the virtual object can indicate the type and number of the virtual object.
- the object identifier of the virtual object may be building_1, building_2, etc.
- the object identifier when the virtual object is a virtual tree, the object identifier may be tree_1, tree_2, and when the virtual object is a virtual light source, the object identifier may be light_1, light_2, etc.
- the type of the virtual object may be determined from the virtual scene data based on the object identifier of the virtual object, and then based on the type of the virtual object, multiple virtual light sources existing in the virtual scene may be determined.
- the virtual scene may include a large number of different types of virtual light sources, for example, point light sources, central light sources (spotlights), surface light sources, and the like.
- step 1012 frustum culling and occlusion culling are performed on the multiple virtual light sources to obtain multiple virtual visible light sources in the virtual scene.
- the visible range of the camera in the three-dimensional scene is presented as a cone, which is similar to a prism, when an object in the three-dimensional space is located within the six faces of the cone or intersects with any of the six faces of the cone, it means that the object is visible. On the contrary, when the object in the three-dimensional space is not located within the six faces of the cone or does not intersect with any of the six faces of the cone, the object is invisible.
- the more times the computer renders the three-dimensional scene per second the more coherent the rendered virtual scene will be. Therefore, reducing the amount of data drawn per frame is the key to accelerating the rendering of three-dimensional scenes in computer graphics. Therefore, it is necessary to perform cone culling and occlusion culling on multiple virtual light sources in the virtual scene.
- the bounding volume of each virtual light source can be determined first, which can be a bounding sphere, an axis-aligned bounding box (AABB), or an oriented bounding box (OBB), and then it is determined whether the bounding volume of each virtual light source is inside the frustum or intersects with any side of the frustum.
- AABB axis-aligned bounding box
- OOB oriented bounding box
- Frustum culling simply means not rendering virtual light sources outside the camera's field of view. Virtual light sources that are blocked by other objects but are still within the field of view will not be culled. Obviously, virtual light sources blocked by other objects do not need to be rendered. Therefore, after performing frustum culling on multiple virtual light sources, occlusion culling can also be used to cull virtual light sources blocked by other objects, thereby further reducing the amount of rendering processing.
- software rasterization can be used to draw the entire depth map of the virtual scene to obtain the depth of each virtual object in the virtual scene, and then the depth size relationship between different virtual objects is used to determine the occlusion relationship between different virtual objects, thereby culling the occluded virtual light sources.
- step 1013 the center coordinates and the radius of the enclosing sphere of the virtual visible light source in the camera space are obtained.
- the vertex coordinates of the vertices of all elements in the set of basic geometric elements constituting the virtual visible light source in the camera space are first obtained.
- the various virtual objects constituting the virtual scene can be processed by triangulation to obtain multiple triangular facets. Therefore, the basic geometric elements constituting the virtual objects can be understood as triangular facets.
- the vertex coordinates of the vertices of each three-sided facet constituting the virtual visible light source in the camera space are obtained; then the center coordinates of the enclosing sphere of the virtual visible light source are determined by the mean of the vertex coordinates of all elements in the camera space, wherein the enclosing sphere of the virtual visible light source is also the minimum sphere that can contain the virtual visible light source, and then based on the center coordinates of the enclosing sphere and the vertex coordinates of the vertices of each element, the distance from the center of the enclosing sphere to each vertex is determined, and the maximum distance is determined as the radius of the enclosing sphere.
- the vertex coordinates of all elements in the camera space when determining the vertex coordinates of all elements in the camera space, first obtain the absolute position coordinates of all original vertices in the set of basic geometric elements that constitute the virtual visible light source in the world space.
- the world space also known as the world coordinate system, refers to the absolute coordinate system of the three-dimensional scene, and the positions of elements such as the camera are determined by this coordinate system;
- the camera space also known as the camera coordinate system, refers to a camera coordinate system independent of the world coordinate system, which is formed by taking the camera position and the opposite direction of the line of sight as the positive direction of the Z axis and the axis in which the camera is pointing upward as the positive direction of the Y axis.
- the rotation matrix from the world space to the camera space, the translation matrix, and the absolute position coordinates of each vertex are used to determine the vertex coordinates of each vertex in the camera space.
- step 1014 a projection matrix from the camera space to the screen space is obtained, and a scaling factor is determined based on the projection matrix.
- the conversion from the camera coordinate system to the pixel coordinate system is a projection transformation.
- the projection matrix from the camera space to the pixel space (i.e., the screen space) is determined based on the internal and external parameters of the camera.
- the internal parameters of the camera refer to the parameters related to the camera's own characteristics, such as the camera's field of view, focal length, pixel size, and the aspect ratio of the camera screen;
- the external parameters of the camera are the posture parameters of the camera in the world coordinate system, such as the camera's position, rotation direction, etc.
- the projection matrix can be obtained by multiplying the camera's internal parameter matrix and external parameter matrix.
- a preset projection matrix calculation function can also be used to determine the projection matrix.
- the scaling factor is the scaling factor of the size of the virtual visible light source in the camera space and the size in the screen space.
- the proj_m[00] element in the first row and first column of the projection matrix and the proj_m[11] element in the second row and second column can be first obtained, where the proj_m[00] element represents the aspect ratio of the camera screen divided by
- the tangent value of proj_m[11] represents The reciprocal of the tangent value of , and the product of the maximum value of the two and a preset first weight value is determined as the scaling factor, and the first weight value is a rational number between 0 and 1, for example, it can be 0.5.
- the maximum value between the two is selected because the zoom factor determined by the maximum value is more conservative and more accurate than the zoom factor determined by the minimum value between the two.
- the product of the zoom factor and the radius of the enclosing sphere is first determined as the zoom radius, and then the distance between the center of the enclosing sphere and the origin is determined according to the coordinates of the center of the enclosing sphere. If the distance is greater than 1, the enclosing sphere is zoomed. The reciprocal of the distance is determined as the second weight value. If the distance is less than or equal to 1, the second weight value is determined to be 1, and the product of the second weight value and the scaling radius is determined as the first size information of the virtual visible light source in the camera space.
- the first size information may be the radius of the virtual visible light source.
- the distance between the center of the enclosing sphere and the origin is 2, and the scaling radius is 3.
- the second weight value is 0.5
- the first size information of the virtual visible light source in the camera space is 0.5*3, that is, 1.5.
- step 1016 second size information of the screen presenting the virtual scene is obtained, and the screen ratio of the virtual visible light source is determined based on the first size information and the second size information.
- the second size information of the screen may include the screen length and the screen width, and the product of the screen length and the screen width may be determined as the screen area.
- the first size information of the virtual visible light source in the camera space may be the radius of the virtual visible light source, so that the area of the virtual visible light source may be determined based on the area formula of a circle, and the area of the virtual visible light source may be divided by the screen area to obtain the screen ratio of the virtual visible light source.
- the screen ratio of the virtual visible light source is the ratio of the area of the virtual visible light source to the screen area, and the screen ratio of the virtual visible light source is a real number between 0 and 1.
- the screen ratio of the virtual visible light source may be 0.02.
- the virtual visible light source in the virtual scene is obtained through frustum culling and occlusion culling.
- the number of light source renderings can be reduced and the rendering efficiency can be improved under the premise of ensuring the authenticity of the rendered virtual scene.
- the screen ratio of each virtual visible light source is determined, thereby providing the necessary data basis for rendering light sources with different screen ratios according to different rendering methods.
- step 101 proceeds to step 101 .
- step 102 batch rendering is performed on a first virtual visible light source among a plurality of virtual visible light sources to obtain a first rendering result.
- the screen-to-body ratio of the first virtual visible light source is less than a preset screen-to-body ratio threshold, and the screen-to-body ratio threshold is a real number between 0 and 1.
- the screen-to-body ratio threshold may be 0.05.
- the first virtual visible light source whose screen-to-body ratio is less than the preset screen-to-body ratio threshold may be understood as a virtual light source with a smaller area in the distance. Batch rendering and drawing of the first virtual visible light source whose screen-to-body ratio is less than the screen-to-body ratio threshold is performed, that is, multiple first virtual visible light sources are merged together for rendering, which can reduce the number of renderings and rendering time, thereby improving rendering efficiency.
- step 102 may be implemented by the following steps 1021 to 1024, which are explained below in conjunction with FIG. 4A .
- step 1021 first position information of a first virtual visible light source in the camera space, and a light source attenuation coefficient, a light source intensity, and an illumination angle of the first virtual visible light source are obtained.
- the first position information of the first virtual visible light source in the camera space is obtained by rigidly transforming the first absolute position of the first virtual visible light source in the world space.
- the light source attenuation coefficient, light source intensity and illumination angle of the first virtual visible light source are obtained from a pre-set light source information table based on the light source ID after the light source ID of the first virtual visible light source is obtained from the virtual scene data.
- the light source information table information such as the light source type, light source attenuation coefficient, light source intensity, illumination angle, color value, etc. corresponding to each light source ID is stored.
- step 1022 based on the first position information, the light source attenuation coefficient, and the light source intensity, the illumination coverage of the first virtual visible light source is determined.
- the light intensity at a position decays to 0, it means that the position is not within the coverage of the light source.
- determining the light coverage range of the first virtual visible light source first obtain the attenuation formula corresponding to the first virtual visible light source, and then use the attenuation formula to determine the distance between the position where the light intensity decays to 0 or the light intensity decays to a preset attenuation value (a numerical value close to 0) and the first virtual visible light source, and determine the light coverage range of the first virtual visible light source based on the calculated distance, the light source type of the first virtual visible light source, and the first position information.
- the light coverage range of the first virtual visible light source When determining the light coverage range of the first virtual visible light source based on the calculated distance, the light source type of the first virtual visible light source, and the first position information, if the light source type of the first virtual visible light source is a point light source, then the light coverage range of the first virtual visible light source is a circle centered on the first position information of the first virtual visible light source and centered on the distance. a circle with a distance as a radius; if the light source type of the first virtual visible light source is a spotlight, then the illumination angle of the first virtual visible light source also needs to be obtained.
- the illumination coverage of the first virtual visible light source is a sector with the first position information of the first virtual visible light source as the center and the distance as the radius. The position of the sector is determined by the illumination angle.
- I is the intensity of the light source
- ⁇ is the attenuation coefficient of the light source
- d is the distance between the first virtual visible light source.
- the attenuation formula can be used to determine the distance between the position where the light source intensity attenuates to a preset attenuation value and the first virtual visible light source, and then the circular area with the first position information of the first virtual visible light source as the center and the distance as the radius is determined as the lighting coverage range of the first virtual visible light source.
- step 1023 the light source color value of each pixel point of the first virtual visible light source within the illumination coverage range is determined.
- the distance between the first virtual visible light source and each pixel point within the illumination coverage range is first determined, and then the illumination intensity value of each pixel point is determined using the attenuation formula corresponding to the first virtual visible light source (i.e., formula (1)), and the color value of the first virtual visible light source is obtained.
- the color value of the first virtual visible light source is multiplied by the illumination intensity value of each pixel point to obtain the light source color value of the first virtual visible light source at each pixel point.
- a first target color value of the pixel point is determined based on the light source color values of the at least two first virtual visible light sources at the pixel point.
- a pixel point when a pixel point is located within the illumination coverage range of at least two first virtual visible light sources, it indicates that at least two first virtual visible light sources affect the color of the pixel point. Therefore, the initial pixel value of the pixel point and the light source color values of the pixel point at least two first virtual visible light sources that affect the pixel point are accumulated to obtain the first target color value of the pixel point.
- the GPU Driven method can be used to package the drawing commands of the light source, call the DrawIndirect command, and perform batch drawing through the above steps 1021 to 1024. In this way, all the first virtual visible light sources with small areas can be drawn by calling the GPU Driven command once, which can reduce the amount of light source data for light source rendering using the light source list, thereby improving rendering efficiency.
- step 103 a light source list for each screen segment is determined.
- the screen can be divided into multiple screen blocks according to a preset size, and a list of light sources for each screen block is determined. Included in the light source list are light sources that will affect the screen block. For example, the screen can be divided into multiple screen blocks of size 16*16, and the screen can also be divided into 32*32 screen blocks. The size of the screen block can be adjusted according to actual needs.
- step 103 may be implemented through the following steps 1031 to 1036 , which are described below in conjunction with FIG. 4B .
- step 1031 second position information of a second virtual visible light source in the camera space is determined.
- a second absolute position of the second virtual visible light source in the world space is obtained, and then The second absolute position is rigidly transformed using a rotation matrix and a translation matrix from the world space to the camera space to obtain second position information of the second virtual visible light source in the camera space.
- step 1032 the distance between the second virtual visible light source and the block bounding box of the screen block is determined, and if the distance is smaller than the light source radius of the second virtual visible light source, the light source type of the second virtual visible light source is obtained.
- the screen segment is a plurality of segments into which a two-dimensional screen is divided according to a preset size
- the segment bounding box of the screen segment is a three-dimensional structure constructed according to a preset depth and the vertex coordinates of the four vertices of the screen segment.
- the distance between the second virtual visible light source and the segment bounding box of the screen segment can be determined by determining the center coordinates of the segment bounding box after determining the screen segment bounding box, and then determining the distance between the second virtual visible light source and the segment bounding box of the screen segment based on the second position information of the second virtual visible light source and the center coordinates of the segment bounding box.
- the light source type of the second virtual visible light source can be a point light source type, a spotlight type, etc. If the distance is greater than or equal to the light source radius of the second virtual visible light source, it means that the second virtual visible light source will not have an impact on the screen segment, and therefore the second virtual visible light source will not be added to the light source list corresponding to the screen segment, then continue to determine whether other second virtual visible light sources are to be added to the light source list corresponding to the screen segment,
- step 1033 it is determined whether the light source type is a point light source type.
- step 1034 If the light source type is a point light source type, go to step 1034 ; if the light source type is not a point light source type, go to step 1035 .
- step 1034 the second virtual visible light source is added to the light source list of the screen segment.
- the light source type of the second virtual visible light source is a point light source type
- the point light source is a light source that emits light uniformly from a point to the surrounding space
- the distance between the second virtual visible light source and the block bounding box of the screen block is less than the light source radius of the second virtual visible light source, it means that the second virtual visible light source will affect the screen block, and then the second virtual visible light source is added to the light source list of the screen block.
- the light source list includes at least one light source node, each light source node stores a current light source identifier and a previous light source identifier; because each screen block in the GPU traverses the second virtual visible light source in parallel to determine whether the second virtual visible light source is within the screen block, each light source node requires a link information (Link), which is used to represent the previous light source identifier of the current light source in the screen block.
- Link link information
- the light source identifier of the second virtual visible light source is added to the current light source identifier corresponding to the first light source node; and it is determined that the previous light source identifier of the first light source node is empty;
- the second virtual visible light source is the Nth light source node in the light source list, the light source identifier of the second virtual visible light source is added to the current light source identifier corresponding to the Nth light source node; the current light source identifier corresponding to the N-1th light source node is added to the previous light source identifier corresponding to the Nth light source node, and N is an integer greater than 1.
- light source 1 is the first light source in screen block 1, so the link information of light source 1 (that is, the previous light source identifier) is empty
- light source 4 is the second light source in screen block 1, so the link information of light source 4 is the previous light source identifier, that is, 1,
- light source 5 is the third light source in screen block 1, so the link information of light source 5 is the previous light source identifier, that is, 4;
- light source 2 is the first light source in screen block 2, so the link information of light source 2 is empty
- light source 3 is the second light source in screen block 2, so the link information of light source 3 is the previous light source identifier, that is, 2.
- step 1035 if the light source type is a spotlight type, the light source direction and cone angle of the second virtual visible light source are obtained.
- the illumination range of the spotlight type light source is related to the light source direction and the cone angle. Therefore, it is necessary to obtain the light source direction and cone angle of the second virtual visible light source.
- the light source type is a spotlight type
- the light source direction and cone angle can be obtained from the attribute information of the second virtual visible light source.
- the light source direction and cone angle are set when the second virtual visible light source is created.
- the light source direction is used to represent the direction of light irradiation, and the cone angle is used to control the degree of light beam diffusion. The larger the cone angle, the higher the degree of light beam diffusion.
- step 1036 when it is determined based on the light source direction and cone angle of the second virtual visible light source that the partition bounding box is within the coverage of the second virtual visible light source, the second virtual visible light source is added to the light source list of the screen partition.
- the light source intensity and attenuation coefficient of the second virtual visible light source are obtained, and the attenuation formula of the second virtual visible light source is obtained.
- the distance information corresponding to the attenuation of the light intensity to a preset attenuation value is determined, thereby determining the coverage range of the second virtual visible light source based on the second position information, light source direction, cone angle and distance information of the second virtual visible light source, and then determining whether the block bounding box is within the coverage range of the second virtual visible light source. If it is determined that the block bounding box is within the coverage range of the second virtual visible light source, it means that the second virtual visible light source will affect the screen block, and therefore the second virtual visible light source is added to the light source list corresponding to the screen block.
- step 103 proceeds to step 103 .
- step 104 full-screen rendering is performed based on the light source list of each screen block to obtain a second rendering result.
- full screen rendering means completing the rendering of all screen blocks in the entire screen at once, that is, rendering multiple screen blocks in parallel. Referring to FIG5 , the following steps 1041 to 1043 are performed for each pixel to be rendered, so that full screen rendering is performed for the light source list of each screen block to obtain a rendered virtual scene, which is explained below in conjunction with FIG5 .
- step 1041 based on the position of the pixel, the screen block where the pixel is located is determined, and a list of light sources corresponding to the screen block is obtained.
- the screen blocks where the pixel points are located can be determined according to the preset size and the position of the pixel points. Then, after the position of the pixel points is known, assuming that the coordinates of the known pixel points are (x 1 , y 1 ), Determine the number of rows corresponding to the screen block where the pixel is located, and Determine the number of columns corresponding to the screen block where the pixel point is located, where: It means that k is rounded up, so that the number of rows and columns corresponding to the screen block is determined, that is, the screen block where the pixel is located can be determined, and the light source list corresponding to the screen block is obtained.
- step 1042 the light source color value of each second virtual visible light source at the pixel point is determined according to the light source type of each second virtual visible light source in the light source list.
- the attenuation formula of each second virtual visible light source is obtained according to the light source type of each second virtual visible light source in the light source list, and the light source intensity and attenuation coefficient of each second virtual visible light source are obtained, and then the distance between the second virtual visible light source and each pixel point in the screen block is determined, so as to determine the light intensity of the second virtual visible light source at the pixel point based on the attenuation formula of the second virtual visible light source, the light source intensity, the attenuation coefficient and the calculated distance, and then the initial light source color value of the second virtual visible light source is obtained, and the product of the light intensity of the second virtual visible light source at the pixel point and the initial light source color value is determined as the pixel value of the second virtual visible light source at the pixel point.
- step 1043 based on the light source color value of each second virtual visible light source at the pixel point, determine the pixel point The second destination color value.
- a pixel point in a screen block will be affected by each second virtual visible light source in the light source list corresponding to the screen block, it is necessary to accumulate the initial pixel value of the pixel point and the light source color value of each second virtual visible light source in the light source list at the pixel point to obtain the second target color value of the pixel point.
- step 105 the first drawing result and the second drawing result are combined to obtain a drawn virtual scene, and the virtual scene is displayed.
- the first drawing result is obtained by batch drawing of the first virtual visible light source whose screen-to-body ratio is less than a preset screen-to-body ratio threshold value, and the first drawing result includes the first target color value of each pixel within the illumination range of the first virtual visible light source.
- the first drawing result may also include the first target color value of each pixel not within the first virtual visible illumination range, and the first target color value is also the initial pixel value of each pixel.
- the second drawing result is obtained by full-screen drawing based on a light source list that only includes the second virtual light source whose screen-to-body ratio is greater than or equal to the screen-to-body ratio threshold value, and the second drawing result includes the second target color value of each pixel.
- the first drawing result and the second drawing result are merged, that is, the first target color value of each pixel in the first drawing result is superimposed with the second target color value of each pixel at the corresponding position in the second drawing result to obtain the third target pixel value of each pixel, and then the complete virtual scene is drawn, and the virtual scene is displayed.
- the rendering method after obtaining the virtual scene data to be rendered, first, based on the virtual scene data, multiple virtual visible light sources in the virtual scene are determined, and the screen-to-body ratio of each virtual visible light source is determined. Then, for the first virtual visible light source whose screen-to-body ratio is less than the preset screen-to-body ratio threshold, the multiple first virtual visible light sources are batch-drawn by calling the batch rendering and drawing command; for the second virtual visible light source whose screen-to-body ratio is greater than or equal to the screen-to-body ratio threshold, a light source list for each screen block is determined, and only the second virtual visible light source is included in the light source list.
- steps 201 to 205 shown in FIG. 6A may be further executed to compress and store the light source list of the screen blocks, which will be described below in conjunction with FIG. 6A.
- step 201 the total number of first light sources corresponding to each screen block is determined, and the total number of second light sources of second virtual visible light sources to be rendered is determined.
- each light source node in the light source list stores the current light source identifier and the previous light source identifier
- the light source list corresponding to each screen block can be traversed in reverse to obtain the total number of first light sources corresponding to each screen block, wherein the total number of first light sources refers to the total number of second virtual visible light sources included in the light source list corresponding to each screen block. Then, the total number of first light sources corresponding to each screen block is summed to obtain the total number of second light sources of the second virtual visible light source to be rendered.
- a continuous memory space for storing a light source list is determined based on the total number of second light sources.
- the memory space required to be occupied by each light source node in the light source list is first obtained, and then the total memory space required to store the light source list of all screen blocks is determined by multiplying the total number of second light sources by the memory space occupied by each light source node, and finally the continuous memory space corresponding to the total memory space size is obtained from the memory. Determining the continuous memory space means determining the starting address and the ending address of the continuous memory space.
- step 203 based on the total number of first light sources corresponding to each screen block, a start index corresponding to each screen block is determined.
- the starting index corresponding to the screen block that is, the starting index of the light source list corresponding to the screen block in the continuous memory space.
- the starting index corresponding to the first screen block is 0,
- the starting index corresponding to the second screen block is the total number of first light sources corresponding to the first screen block
- the starting index corresponding to the third screen block is The sum of the total number of first light sources corresponding to 1 screen block and the second screen block, and so on.
- the starting index corresponding to the i-th screen block is the sum of the total number of first light sources corresponding to the first i-1 screen blocks, where i is an integer greater than 1.
- step 204 the space occupation information of the light source list corresponding to each screen block in the continuous memory space is determined based on the total number of first light sources and the start index of each screen block.
- the space occupation information of the light source list in the continuous memory space includes the starting storage address of the light source list in the continuous memory space.
- the space occupation information may also include the ending storage address of the light source list in the continuous memory space. Since the size of the memory space occupied by each light source node and the starting index corresponding to each screen block and the starting address of the continuous memory space are known, then based on the starting address of the continuous memory space + the size of the memory space occupied by each light source node multiplied by the starting index corresponding to each screen block, the starting storage address of the light source list corresponding to the screen block in the continuous memory space is obtained.
- step 205 based on the space occupation information of each light source list in the continuous memory space, each second virtual visible light source in each light source list is stored in the continuous memory space.
- the light source identifier of each second virtual visible light source in each light source list and the light source identifier of the previous second virtual visible light source can be stored in the continuous storage space in sequence based on the starting storage address included in the space occupancy information of the light source list in the continuous memory space.
- Figure 6B is another schematic diagram of compressed storage of the light source list provided in an embodiment of the present application. As shown in Figure 6B, after the starting index of each screen block is determined, the light source list corresponding to each screen block is stored in a continuous memory space based on the starting index of each screen block, thereby realizing compressed storage of the light source list and improving the utilization rate of the memory space.
- the light source list of each screen block is stored in a continuous memory space. This not only improves the utilization rate of the memory space, but also when obtaining the light source list of each screen block, it can be read sequentially from the continuous memory space, which can reduce the time consumed in data reading and thus improve rendering efficiency.
- the rendering method provided in the embodiment of the present application is mainly used in scenes such as electronic games, virtual reality, architectural design, animated films, etc. that require real-time rendering of large-scale dynamic light sources.
- the rendering method provided in the embodiment of the present application can be used to render the lighting effect of the city night view from the airplane as shown in Figure 7A.
- the rendering method provided in the embodiment of the present application can be used to render the dynamic light and shadow effect of vehicles shuttling between the roads as shown in Figure 7B.
- the rendering method provided in the embodiment of the present application can be used to render the night scene lighting effect of the digital Great Wall as shown in Figure 7C.
- FIG8 is a schematic diagram of another implementation flow of the rendering method provided in an embodiment of the present application.
- the rendering method provided in an embodiment of the present application will be described below in conjunction with FIG8 .
- step 301 a visible light source is obtained, and the size of the visible light source in the screen space is determined.
- virtual scene data to be rendered is first obtained, and multiple light sources included in the virtual scene data to be rendered are determined. Then, frustum culling and occlusion culling are performed on the multiple light sources in the GPU to filter out visible light sources in the virtual scene, and the size of the visible light sources in the screen space is calculated.
- step 302 for small-area light sources, the light source is drawn using a GPU Driven approach.
- the small area light source refers to a light source whose screen ratio is less than the screen ratio threshold.
- the GPU Driven method can be used to package the drawing commands of the light source and call the indirect drawing (DrawIndirect) command. Multiple small-area light sources are drawn in batches.
- the traditional method of drawing coverage by template testing can be avoided, and the illumination coverage of each small-area light source can be directly calculated by light source attenuation and angle. After determining the illumination coverage of the small-area light source, the drawing color value of each pixel within the illumination coverage is determined based on the light source attenuation coefficient, light source color, and light source intensity of each small-area light source.
- step 303 for the large-area light source, a light source list for each screen block is determined.
- the light source list only includes large-area light sources.
- a large-area light source is a light source whose screen-to-body ratio is greater than or equal to the screen-to-body ratio threshold.
- a tile-based method can be used to calculate the light source list of each screen block. In implementation, for each screen block, all large-area light sources are traversed, the position of the large-area light source in the camera space is calculated, and then based on the position of the large-area light source in the camera space, the distance between the large-area light source and the block bounding box of each screen block is determined.
- the large-area light source is a point light source
- the large-area light source is directly added to the light source list of the screen block.
- the light source type of the large-area light source is a spotlight
- the ID of the current light source and the link to the previous light source node are recorded in the light source list.
- the light source list structure for each screen block is compressed. First, the light source list is traversed in reverse, the number of light sources in the screen block is calculated, the number of light sources in the screen block and the starting index corresponding to the light source list are saved, and then the storage range of the light source list in the continuous memory structure is determined based on the light source data in the screen block and the starting index corresponding to the light source list, and finally the light sources in the screen block are recorded in the continuous memory structure corresponding to the storage range.
- step 304 a full-screen rendering is performed to render the light source of each screen block.
- the screen block where the pixel is located is calculated, the light source list of the screen block is obtained, and then the light source list is traversed, and the diffuse reflection and highlight color values at that position are calculated according to the type of light source. All color values in the light source list are superimposed to obtain the second target color value of the pixel point, and finally the second target color value of the pixel point is output.
- Figure 9 is a schematic diagram of the effect of rendering distant light sources and near light sources using the rendering method provided in an embodiment of the present application.
- the rendering method provided in an embodiment of the present application when combined with GPU Driven and Tiledbase, as shown in 901 in Figure 9, can increase the frame rate from 7 frames to 100 frames when rendering distant light sources.
- the consumption of tile culling can be reduced due to the light source division and early culling (Culling), as shown in 902 in Figure 9, and the frame rate can also be increased from 9 frames to 54 frames.
- Figure 10 is a comparison effect diagram of the rendering method provided in the embodiment of the present application and the cluster based lighting algorithm in the related art.
- the rendering method provided in the embodiment of the present application in combination with GPU Driven and Tiledbase, can achieve a frame rate of 100 frames per second.
- the frame rate of the cluster based lighting algorithm will drop significantly to 15 frames per second.
- the embodiment of the present application provides a rendering solution based on GPU Driven and block rendering, which combines the advantages of both to quickly render massive light sources in the scene.
- the entire process has almost no CPU overhead and CPU synchronization consumption.
- the GBuffer cache hit rate is greatly improved, thereby avoiding bandwidth consumption for multiple drawing.
- the software module stored in the rendering device 455 of the memory 450 may include:
- the first determination module 4551 is configured to obtain virtual scene data to be rendered, determine multiple virtual visible light sources in the virtual scene based on the virtual scene data, and determine the screen-to-body ratio of each virtual visible light source; the first rendering module 4552 is configured to perform batch rendering and drawing on the first virtual visible light source whose screen-to-body ratio is less than a preset screen-to-body ratio threshold value among the multiple virtual visible light sources; the second determination module 4553 is configured to determine a light source list for each screen block, wherein the light source list only includes the second virtual visible light source whose screen-to-body ratio is greater than or equal to the screen-to-body ratio threshold value; the second rendering module 4554 is configured to perform full-screen drawing based on the light source list for each screen block to obtain a second drawing result; the display module 4555 is configured to merge the first drawing result and the second drawing result to obtain a drawn virtual scene, and display the virtual scene.
- the first determination module 4551 is further configured to: determine multiple virtual light sources existing in the virtual scene based on the virtual scene data; perform frustum culling and occlusion culling on the multiple virtual light sources to obtain multiple virtual visible light sources in the virtual scene.
- the first determination module 4551 is further configured to: obtain the center coordinates and the radius of the enclosing sphere of the virtual visible light source in the camera space; obtain the projection matrix from the camera space to the screen space, and determine the scaling factor based on the projection matrix; use the scaling factor, the enclosing sphere radius and the center coordinates to determine the first size information of the virtual visible light source in the camera space; obtain the second size information of the screen presenting the virtual scene, and determine the screen-to-body ratio of the virtual visible light source based on the first size information and the second size information.
- the first rendering module 4552 is also configured to: obtain the first position information of the first virtual visible light source in the camera space, as well as the light source attenuation coefficient, light source intensity and illumination angle of the first virtual visible light source; determine the illumination coverage range of the first virtual visible light source based on the first position information, light source attenuation coefficient, light source intensity and illumination angle; determine the light source color value of each pixel point of the first virtual visible light source within the illumination coverage range; when a pixel point is within the illumination coverage range of at least two first virtual visible light sources, determine the first target color value of the pixel point based on the light source color values of the at least two first virtual visible light sources at the pixel point.
- the second determination module 4553 is also configured to: determine the second position information of the second virtual visible light source in the camera space; determine the distance between the second virtual visible light source and the block bounding box of the screen block, if the distance is less than the light source radius of the second virtual visible light source, obtain the light source type of the second virtual visible light source; if the light source type is a point light source, add the second virtual visible light source to the light source list of the screen block.
- the second determination module 4553 is further configured to: if the light source type is a spotlight type, obtain the light source direction and cone angle of the second virtual visible light source; when it is determined based on the light source direction and cone angle of the second virtual visible light source that the block bounding box is within the coverage range of the second virtual visible light source, add the second virtual visible light source to the light source list of the screen block.
- the light source list includes at least one light source node, and each light source node stores a current light source identifier and a previous light source identifier of the current light source identifier; the second determination module 4553 is also configured to: when the second virtual visible light source is the first light source node in the light source list, add the light source identifier of the second virtual visible light source to the current light source identifier corresponding to the first light source node; determine that the previous light source identifier of the first light source node is empty; when the second virtual visible light source is the Nth light source node in the light source list, add the light source identifier of the second virtual visible light source to the current light source identifier corresponding to the Nth light source node; add the current light source identifier corresponding to the N-1th light source node to the previous light source identifier corresponding to the Nth light source node.
- the rendering device further includes: a third determining module configured to determine the screen blocks.
- a fourth determining module is configured to determine a continuous memory space for storing a light source list based on the total number of the second light sources to be rendered;
- a fifth determining module is configured to determine a starting index corresponding to each screen block based on the total number of first light sources corresponding to each screen block;
- a sixth determining module is configured to determine space occupancy information of a light source list corresponding to each screen block in the continuous memory space based on the total number of first light sources and the starting index of each screen block;
- a storage module is configured to store the second virtual visible light sources in each light source list in the continuous memory space based on the space occupancy information of each light source list in the continuous memory space.
- the second rendering module 4554 is also configured to: perform the following operations for each pixel to be rendered: determine the screen block where the pixel is located based on the position of the pixel, and obtain a list of light sources corresponding to the screen block; determine the light source color value of each second virtual visible light source at the pixel according to the light source type of each second virtual visible light source in the light source list; and determine the second target color value of the pixel by using the light source color value of each second virtual visible light source at the pixel.
- the display module 4555 is also configured to obtain a first target color value for each pixel from the first drawing result, and obtain a second target color value for each pixel from the second drawing result; for each pixel, superimpose the first target color value and the second target color value of the pixel to obtain a third target color value of the pixel; and use the third target color value of each pixel to draw a virtual scene.
- the embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium.
- the processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device performs the rendering method described above in the embodiment of the present application.
- An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein computer-executable instructions or computer programs are stored.
- the processor When the computer-executable instructions or computer programs are executed by a processor, the processor will be caused to execute the rendering method provided by the embodiment of the present application, for example, the rendering method shown in Figures 3A and 8.
- the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
- 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.
- computer-executable instructions may, but do not necessarily, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a Hypertext Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
- HTML Hypertext Markup Language
- 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 at multiple sites and interconnected by a communication network.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Multimedia (AREA)
- Computer Graphics (AREA)
- Image Generation (AREA)
Abstract
本申请提供了一种渲染方法、装置、电子设备、计算机可读存储介质及计算机程序产品;方法包括:获取待渲染的虚拟场景数据,基于所述虚拟场景数据,确定虚拟场景中的多个虚拟可见光源,并确定各个虚拟可见光源的屏占比,对所述多个虚拟可见光源中的第一虚拟可见光源进行合批渲染绘制,得到第一绘制结果,第一虚拟可见光源的屏占比小于预设的屏占比阈值;确定每个屏幕分块的光源列表,其中光源列表中包括屏占比大于或者等于所述屏占比阈值的第二虚拟可见光源;基于所述每个屏幕分块的光源列表执行全屏绘制,得到第二绘制结果,将第一绘制结果和第二绘制结果进行合并,得到绘制出的虚拟场景,显示虚拟场景。
Description
相关申请的交叉引用
本申请基于申请号为202311141331.2、申请日为2023年9月06日的中国专利申请提出,并要求以上中国专利申请的优先权,以上中国专利申请的全部内容在此引入本申请作为参考。
本申请涉及图像处理技术,尤其涉及一种渲染方法、装置、电子设备、计算机可读存储介质及计算机程序产品。
随着图像处理技术不断发展,用户对于图像质量的要求越来越高。在很多大型虚拟场景中,存在大量的光源,每个光源对大型虚拟场景中每个虚拟模型的影响程度是不同的,因此,为了提升虚拟场景的真实感,多光源的光照渲染已经成为图像处理中的关键点。
在相关技术中,在进行多光源的光照渲染时,通常采用基于平铺的照明(Tiled based lighting)算法和基于集群的照明(cluster based lighting)算法。Tiled based lighting算法和cluster based lighting算法,均需要划分多个屏幕分块,每个屏幕分块维护一个光源列表,在海量光源场景中更新每个屏幕分块的光源列表是一项相当耗时的任务,从而会导致渲染帧率大幅度下降。
发明内容
本申请实施例提供一种渲染方法、装置、电子设备、计算机可读存储介质及计算机程序产品,能够提高渲染效率。
本申请实施例的技术方案是这样实现的:
本申请实施例提供一种渲染方法,应用于电子设备,所述方法包括:
获取待渲染的虚拟场景数据,基于所述虚拟场景数据,确定虚拟场景中的多个虚拟可见光源,并确定各个虚拟可见光源的屏占比;
对所述多个虚拟可见光源中的第一虚拟可见光源进行合批渲染绘制,得到第一绘制结果,所述第一虚拟可见光源的屏占比小于预设的屏占比阈值;
确定每个屏幕分块的光源列表,其中所述光源列表中包括屏占比大于或者等于所述屏占比阈值的第二虚拟可见光源;
基于所述每个屏幕分块的光源列表执行全屏绘制,得到第二绘制结果;
将所述第一绘制结果和所述第二绘制结果进行合并,得到绘制出的虚拟场景,显示虚拟场景。
本申请实施例提供一种渲染装置,包括:
第一确定模块,配置为获取待渲染的虚拟场景数据,基于所述虚拟场景数据,确定
虚拟场景中的多个虚拟可见光源,并确定各个虚拟可见光源的屏占比;
第一渲染模块,配置为对所述多个虚拟可见光源中的第一虚拟可见光源进行合批渲染绘制,得到第一绘制结果,所述第一虚拟可见光源的屏占比小于预设的屏占比阈值;
第二确定模块,配置为确定每个屏幕分块的光源列表,其中所述光源列表中包括屏占比大于或者等于所述屏占比阈值的第二虚拟可见光源;
第二渲染模块,配置为基于所述每个屏幕分块的光源列表执行全屏绘制,得到第二绘制结果;
显示模块,配置为将所述第一绘制结果和所述第二绘制结果进行合并处理,得到绘制出的虚拟场景,并显示虚拟场景。
本申请实施例提供一种电子设备,所述电子设备包括:
存储器,用于存储计算机可执行指令;
处理器,用于执行所述存储器中存储的计算机可执行指令时,实现本申请实施例提供的渲染方法。
本申请实施例提供一种计算机可读存储介质,存储有计算机程序或计算机可执行指令,用于被处理器执行时实现本申请实施例提供的渲染方法。
本申请实施例提供一种计算机程序产品,包括计算机程序或计算机可执行指令,述计算机程序或计算机可执行指令被处理器执行时,实现本申请实施例提供的渲染方法。
本申请实施例具有以下有益效果:
在获取待渲染的虚拟场景数据之后,首先基于所述虚拟场景数据,确定虚拟场景中的多个虚拟可见光源,从而保证后续只对可见光源进行渲染,能够降低渲染处理数据量和复杂度;并确定各个虚拟可见光源的屏占比,然后对于屏占比小于预设的屏占比阈值的第一虚拟可见光源,通过调用合批渲染绘制命令,对多个第一虚拟可见光源进行合批绘制;对于屏占比大于或者等于屏占比阈值的第二虚拟可见光源,确定每个屏幕分块的光源列表,并且光源列表中仅包括第二虚拟可见光源,然后基于每个屏幕分块的光源列表执行全屏绘制,得到渲染出的虚拟场景,也就是说,在本申请实施例中,采用合批绘制和分块渲染相结合的方案,首先调用一次合批绘制命令完成了所有屏占比小于屏占比阈值的海量光源的绘制,在提高渲染效率的同时,还大幅降低了分块渲染的计算量,然后对屏占比大于屏占比阈值的第二虚拟可见光源,进行分块渲染,也即对多个屏幕分块中的第二虚拟可见光源进行并行渲染,不仅能够保证对第二虚拟可见光源的渲染效果,并且能够快速渲染出虚拟场景中的海量光源,从而提高渲染效率。
图1是本申请实施例提供的渲染系统100的网络架构示意图;
图2是本申请实施例提供的终端400的结构示意图;
图3A是本申请实施例提供的渲染方法的一种实现流程示意图;
图3B是本申请实施例提供的确定虚拟可见光源以及虚拟可见光源的屏占比的实现流程示意图;
图4A是本申请实施例提供的对第一虚拟可见光源进行合批渲染绘制的实现流程示意图;
图4B是本申请实施例提供的确定每个屏幕分块的光源列表的实现流程示意图;
图4C是本申请实施例提供的光源列表中光源节点的示意图;
图5是本申请实施例提供的基于光源列表执行全屏绘制的实现流程示意图;
图6A是本申请实施例提供的对光源列表进行压缩存储的实现流程示意图;
图6B是本申请实施例提供的对光源列表进行压缩存储的另一种示意图;
图7A是本申请实施例提供的飞机上空俯瞰城市夜景的灯光效果图;
图7B是本申请实施例提供的车辆在马路穿梭的动态光影效果图;
图7C是本申请实施例提供的数字长城的夜景灯光效果图;
图8是本申请实施例提供的渲染方法的另一种实现流程示意图;
图9是利用本申请实施例提供的渲染方法进行远距离光源渲染与近距离光源渲染的效果示意图;
图10是本申请实施例提供的渲染方法与相关技术中的cluster based lighting算法的对比效果图。
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,所描述的实施例不应视为对本申请的限制,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。
在以下的描述中,所涉及的术语“第一\第二”仅仅是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。
本申请实施例中,术语“模块”或“单元”是指有预定功能的计算机程序或计算机程序的一部分,并与其他相关部分一共工作以实现预定目标,并且可以通过使用软件、硬件(如处理电路或存储器)或其组合来全部实现或部分实现。同样的,一个处理器(或多个处理器或存储器)可用来实现一个或多个模块或单元。此外,每个模块或单元都可以是包含该模块或单元功能的整体模块或单元的一部分。
除非另有定义,本申请实施例所使用的所有的技术和科学术语与所属技术领域的技术人员通常理解的含义相同。本申请实施例中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。
对本申请实施例进行进一步详细说明之前,对本申请实施例中涉及的名词和术语进行说明,本申请实施例中涉及的名词和术语适用于如下的解释。
1)点光源,指的是从一个点向周围空间均匀发光的光源。
2)平行光源,指的是发出的光线平行无发散的光源。
3)聚光灯光源,是一种居中性光源,呈锥形,离光源越远,照亮的圆形区域会越大。
4)合批渲染绘制,通常指的是一种将多个渲染任务组合在一起进行的方式。在本申请实施例中,对多个虚拟光源进行合批渲染绘制是将多个虚拟光源合并到一起进行渲染,以提高渲染效率。
5)全屏绘制,是指对一次对整个屏幕中的所有屏幕分块完成绘制。
6)视锥剔除,是一种空间剔除技术,它基于相机视锥体(Camera Frustum)来判断对象是否可见。视锥体是相机视野的几何表示,由六个平面构成,决定了相机可以看到的空间区域。在每一帧渲染时,系统会检查所有对象是否完全位于相机的视锥体内或与之相交。如果对象不在视锥体内,则将其剔除。视锥剔除不能剔除那些虽然位于视锥体内,但是被其他物体遮挡的对象。
7)遮挡剔除,是一种更高级的空间剔除技术,它通过检测对象是否被其他物体遮挡来决定是否渲染。具体来说,遮挡剔除会预先计算场景中物体的遮挡关系,并构建一个数据结构来表示哪些对象在当前相机视角下是可见的,将不可见的对象剔除。
8)光源衰减系数,是描述光源强度随距离增加而减少的参数。它反映了光线强度在传播过程中因距离增加而逐渐减弱的特性。衰减系数通常用于计算光源在不同距离下的光照强度,以便在设计照明系统或进行光照模拟时考虑光源的衰减效应。
为了更好地理解本申请实施例提供的渲染方法,首先对相关技术中用于进行多光源渲染的Tiled based lighting算法和cluster based lighting算法以及存在的缺点进行说明。
Tiled based lighting算法在实现时,首先实时将屏幕空间进行2D分块,然后分别计算影响每个分块的光源列表,最后再逐个像素根据所属分块获得光源列表进行光照渲染。
cluster based lighting算法在实现时,首先实时将屏幕空间进行3D分块,然后分别计算影响每个分块的光源列表,最后再逐个像素根据所属分块获得光源列表进行光照渲染。
Tiled based lighting算法和cluster based lighting算法在光照渲染的过程中只会读取一次G-buffer,写入一次颜色缓冲区,跟光源数量无关,能大幅度降低带宽消耗,可以使同屏光源数增到几千的规模。但是在海量光源场景中更新每个分块的光源列表也是一项相当耗时的任务,当场景中的光源数量到达上万甚至十万时,会导致帧率大幅度下降。
本申请实施例提供一种渲染方法、装置、电子设备、计算机可读存储介质及计算机程序产品,能够提高渲染效率。下面说明本申请实施例提供的电子设备的示例性应用,本申请实施例提供的电子设备可以实施为笔记本电脑、平板电脑,台式计算机、机顶盒、移动设备(例如,移动电话,便携式音乐播放器,个人数字助理,专用消息设备,便携式游戏设备)、智能手机、智能音箱、智能手表、智能电视、车载终端等各种类型的用户终端。下面,将说明设备实施为终端时示例性应用。
参见图1,图1是本申请实施例提供的渲染系统100的网络架构示意图,如图1所示,该渲染系统100包括服务器200、网络300和终端400,终端400通过网络300连接服务器200,网络300可以是广域网或者局域网,又或者是二者的组合。
终端400用于从服务器200获取虚拟场景数据,其中,虚拟场景数据可以是游戏应用中的虚拟场景数据,还可以是虚拟现实的虚拟场景数据、增强现实的虚拟场景数据。终端400将虚拟场景数据存储至本地存储空间,然后终端400基于所述虚拟场景数据,确定虚拟场景中的多个虚拟可见光源,并确定各个虚拟可见光源的屏占比,然后对于屏占比小于预设的屏占比阈值的第一虚拟可见光源,通过调用合批渲染绘制命令,对多个第一虚拟可见光源进行合批绘制,得到第一绘制结果;对于屏占比大于或者等于屏占比阈值的第二虚拟可见光源,确定每个屏幕分块的光源列表,并且光源列表中仅包括第二虚拟可见光源,然后基于每个屏幕分块的光源列表执行全屏绘制,得到第二绘制结果,将第一绘制结果和第二绘制结果进行合并,得到渲染出的虚拟场景,并在图形界面410显示渲染出的虚拟场景。终端在进行虚拟场景渲染时,采用合批绘制和分块渲染相结合的方案,通过调用一次合批绘制命令完成了所有屏占比小于屏占比阈值的海量光源的绘制,因此大幅降低了分块渲染的计算量,从而能够快速渲染出虚拟场景中的海量光源,提高渲染效率。
在一些实施例中,服务器200可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、内容分发网络(Content Delivery Network,CDN)、以及大数据和人工智能平台等基础云计算服务的云服务器。
终端400可以是智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表、车载终端等,但并不局限于此。终端以及服务器可以通过有线或无线通信方式进行直接或间接地连接,本申请实施例中不做限制。
参见图2,图2是本申请实施例提供的终端400的结构示意图,图2所示的终端400包括:至少一个处理器410、存储器450、至少一个网络接口420和用户接口430。终端400中的各个组件通过总线系统440耦合在一起。可理解,总线系统440用于实现这些组件之间的连接通信。总线系统440除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图2中将各种总线都标为总线系统440。
处理器410可以是一种集成电路芯片,具有信号的处理能力,例如通用处理器、数字信号处理器(Digital Signal Processor,DSP),或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等,其中,通用处理器可以是微处理器或者任何常规的处理器等。
用户接口430包括使得能够呈现媒体内容的一个或多个输出装置431,包括一个或多个扬声器和/或一个或多个视觉显示屏。用户接口430还包括一个或多个输入装置432,包括有助于用户输入的用户接口部件,比如键盘、鼠标、麦克风、触屏显示屏、摄像头、其他输入按钮和控件。
存储器450可以是可移除的,不可移除的或其组合。示例性的硬件设备包括固态存储器,硬盘驱动器,光盘驱动器等。存储器450可选地包括在物理位置上远离处理器410的一个或多个存储设备。
存储器450包括易失性存储器或非易失性存储器,也可包括易失性和非易失性存储器两者。非易失性存储器可以是只读存储器(ROM,Read Only Memory),易失性存储器可以是随机存取存储器(Random Access Memory,RAM)。本申请实施例描述的存储器450旨在包括任意适合类型的存储器。
在一些实施例中,存储器450能够存储数据以支持各种操作,这些数据的示例包括程序、模块和数据结构或者其子集或超集,下面示例性说明。
操作系统451,包括用于处理各种基本系统服务和执行硬件相关任务的系统程序,例如框架层、核心库层、驱动层等,用于实现各种基础业务以及处理基于硬件的任务;
网络通信模块452,用于经由一个或多个(有线或无线)网络接口420到达其他电子设备,示例性的网络接口420包括:蓝牙、无线相容性认证(WiFi)、和通用串行总线(Universal Serial Bus,USB)等;
呈现模块453,用于经由一个或多个与用户接口430相关联的输出装置431(例如,显示屏、扬声器等)使得能够呈现信息(例如,用于操作外围设备和显示内容和信息的用户接口);
输入处理模块454,用于对一个或多个来自一个或多个输入装置432之一的一个或多个用户输入或互动进行检测以及翻译所检测的输入或互动。
在一些实施例中,本申请实施例提供的装置可以采用软件方式实现,图2示出了存储在存储器450中的渲染装置455,其可以是程序和插件等形式的软件,包括以下软件模块:第一确定模块4551、第一渲染模块4552、第二确定模块4553、第二渲染模块4554和显示模块4555,这些模块是逻辑上的,因此根据所实现的功能可以进行任意的组合或进一步拆分。将在下文中说明各个模块的功能。
在另一些实施例中,本申请实施例提供的装置可以采用硬件方式实现,作为示例,本申请实施例提供的装置可以是采用硬件译码处理器形式的处理器,其被编程以执行本申请实施例提供的渲染方法,例如,硬件译码处理器形式的处理器可以采用一个或多个应用专用集成电路(Application Specific Integrated Circuit,ASIC)、数字信号处理器
(Digital Signal Processor,DSP)、可编程逻辑器件(Programmable Logic Device,PLD)、复杂可编程逻辑器件(Complex Programmable Logic Device,CPLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或其他电子元件。
将结合本申请实施例提供的终端的示例性应用和实施,说明本申请实施例提供的渲染方法。
下面,说明本申请实施例提供的渲染方法,如前所述,实现本申请实施例的渲染方法的电子设备可以是终端。因此下文中不再重复说明各个步骤的执行主体。
参见图3A,图3A是本申请实施例提供的渲染方法的一种实现流程示意图,将结合图3A示出的步骤进行说明,图3A步骤的主体是终端。
在步骤101中,获取待渲染的虚拟场景数据,基于虚拟场景数据,确定虚拟场景中的多个虚拟可见光源,并确定各个虚拟可见光源的屏占比。
在一些实施例中,待渲染的虚拟场景数据可以是游戏应用中的虚拟场景数据,还可以是虚拟现实的虚拟场景数据、增强现实的虚拟场景数据。参见图3B,步骤101可以通过下述步骤1011至步骤1016实现,下面结合图3B进行说明。
在步骤1011中,基于虚拟场景数据,确定存在于虚拟场景中的多个虚拟光源。
在一些实施例中,虚拟场景数据中包括存在于虚拟场景中各个虚拟对象的对象标识,以及各个虚拟对象的位置信息。虚拟场景中的虚拟对象包括固定不可移动的对象,例如可以是虚拟楼房、虚拟树木等,还可以包括可移动的对象,例如虚拟怪兽、虚拟车辆等。虚拟对象还可以是虚拟光源,例如可以是固定的虚拟路灯、虚拟建筑内的各种虚拟灯具,还可以是穿戴于虚拟人物身上的头灯、手电筒,也可以是虚拟汽车的车灯。虚拟对象的对象标识能够表示虚拟对象的类型及编号,例如当虚拟对象为虚拟建筑时,虚拟对象的对象标识可以是building_1、building_2等,虚拟对象为虚拟树木时,对象标识可以为tree_1、tree_2,虚拟对象为虚拟光源时,对象标识可以为light_1、light_2等。步骤1011在实现时,可以从虚拟场景数据中,基于虚拟对象的对象标识,确定出虚拟对象的类型,进而再基于虚拟对象的类型,确定出存在于虚拟场景中的多个虚拟光源。在本申请实施例中,虚拟场景中可以包括大量的不同类型的虚拟光源,例如,可以包括点光源、居中性光源(聚光灯)、面光源等等。
在步骤1012中,对多个虚拟光源进行视锥剔除和遮挡剔除,得到虚拟场景中的多个虚拟可见光源。
由于相机在三维场景中的可见范围呈现为视锥体,视锥体类似棱台,当三维空间中物体位于视锥体的六个面内或者与视锥体的六个面中的任意一个面相交时,说明该物体可见,反之,当三维空间中的物体没有位于视锥体的六个面内或者与视锥体的六个面中的任意一个面均不相交,则该物体不可见。计算机对于三维场景的渲染每秒钟绘制的次数愈多,渲染出的虚拟场景便会越连贯,故减少每帧绘制的数据量是计算机图形学中加速三维场景渲染的关键。因此,需要对虚拟场景中的多个虚拟光源进行视锥剔除和遮挡剔除。
在对多个虚拟光源进行视锥剔除时,可以首先确定出各个虚拟光源的包围体,该包围体可以是包围球,还可以是轴对齐包围盒(Axis-Aligned Bounding Box,AABB),或者是方向包围盒(Oriented Bounding Box,OBB),然后判断各个虚拟光源的包围体是否在视锥体的内部,或者是否与视锥体的任意一面相交,如果虚拟光源的包围体在视锥体的内部,或者与视锥体的任意一面相交,那么确定该虚拟光源在视锥体的可视范围内,则不对该虚拟光源进行剔除;如果虚拟光源的包围体不在视锥体内部,且与视锥体的任意一面均不相交,那么确定该虚拟光源不在视锥体的可视范围内,则对该虚拟光源进行剔除。
视锥体剔除只是不渲染相机视角范围外的虚拟光源,而对于被其他物体遮挡但依然在视角范围内的虚拟光源,则不会被剔除,很显然,被其他物体遮挡的虚拟光源,也是不需要进行渲染的。因此在对多个虚拟光源进行视锥剔除之后,还可以通过遮挡剔除,将被其他物体遮挡的虚拟光源剔除,从而进一步降低渲染处理量。在进行遮挡剔除时,可以采用软件光栅化的方式,绘制虚拟场景的整个深度图,从而得到虚拟场景中各个虚拟对象的深度,然后利用不同虚拟对象之间的深度大小关系,来确定不同虚拟对象之间的遮挡关系,从而剔除掉被遮挡的虚拟光源。
在步骤1013中,获取虚拟可见光源在相机空间中的包围球的球心坐标、包围球半径。
在一些实施例中,首先获取组成虚拟可见光源的基本几何元素集合中所有元素的顶点在相机空间的顶点坐标,构成虚拟场景中的各个虚拟对象可以通过三角剖分处理,得到多个三角面片,因此组成虚拟对象的基本几何元素可以理解为是三角面片,因此在这里也即获取组成虚拟可见光源的各个三面面片的顶点在相机空间的顶点坐标;然后将所有元素在相机空间的顶点坐标的均值确定该虚拟可见光源的包围球的球心坐标,其中虚拟可见光源的包围球也即能够包含该虚拟可见光源的最小球体,进而再基于包围球的球心坐标与各个元素的顶点的顶点坐标,确定包围球的球心到各个顶点之间的距离,将最大距离,确定为包围球半径。
在一些实施例中,在确定所有元素的顶点在相机空间的顶点坐标时,首先获取组成虚拟可见光源的基本几何元素集合中所有原始的顶点在世界空间中的绝对位置坐标。世界空间也即世界坐标系,指的是三维场景的绝对坐标系,相机等元素由该坐标系决定自身位置;相机空间也即相机坐标系,是指以相机位置以及视线方向的反方向为Z轴正方向,以相机向上的方向所处的轴为Y轴正方向形成的独立于世界坐标系的相机坐标系。然后再利用世界空间到相机空间的旋转矩阵、平移矩阵以及各个顶点的绝对位置坐标,确定出各个顶点在相机空间中的顶点坐标。
在步骤1014中,获取相机空间到屏幕空间的投影矩阵,并基于投影矩阵确定缩放倍率。
从相机坐标系到像素坐标系的转换为投影变换,相机空间到像素空间(也即屏幕空间)的投影矩阵是根据相机的内部参数和外部参数确定的,相机的内部参数是指相机自身特性相关的参数,比如相机的视场角、焦距、像素大小、相机屏幕的宽高比等;相机的外部参数是相机在世界坐标系中的姿态参数,比如相机的位置、旋转方向等。进一步地,可以是将相机的内参矩阵和外参矩阵相乘得到投影矩阵。在一些实施例中,还可以使用预设的投影矩阵计算函数来确定投影矩阵。该缩放倍率为虚拟可见光源在相机空间的尺寸与在屏幕空间的尺寸的缩放倍率。基于投影矩阵确定缩放倍率在实现时,可以首先获取投影矩阵中的第一行第一列的proj_m[00]元素,以及第二行第二列的proj_m[11]元素,其中proj_m[00]元素表示相机屏幕的宽高比除以的正切值,proj_m[11]元素表示的正切值的倒数,将两者中的最大值与预设的第一权重值的乘积确定为缩放倍率,该第一权重值为0到1之间的有理数,例如可以是0.5。
需要说明的是,选择两者中的最大值是因为通过最大值确定出的缩放倍率相比于通过两者中的最小值确定出的缩放倍率更加保守,也更加准确。
在步骤1015中,利用缩放倍率、包围球半径及球心坐标确定所述虚拟可见光源在相机空间中的第一尺寸信息。
在一些实施例中,首先将缩放倍率与包围球半径的乘积,确定为缩放半径,然后根据包围球的球心坐标确定包围球的球心与原点之间的距离,如果该距离大于1,则将该
距离的倒数确定为第二权重值,如果该距离小于或者等于1,则确定第二权重值为1,将第二权重值与缩放半径的乘积确定为该虚拟可见光源在相机空间中的第一尺寸信息。第一尺寸信息可以是虚拟可见光源的半径。
示例性地,包围球的球心与原点之间的距离为2,缩放半径为3,那么,第二权重值为0.5,该虚拟可见光源在相机空间中的第一尺寸信息为0.5*3,也即为1.5。
步骤1016中,获取呈现虚拟场景的屏幕的第二尺寸信息,基于第一尺寸信息和第二尺寸信息,确定虚拟可见光源的屏占比。
在一些实施例中,屏幕的第二尺寸信息可以包括屏幕长度和屏幕宽度,可以将屏幕长度和屏幕宽度的乘积确定为屏幕面积,虚拟可见光源在相机空间中的第一尺寸信息可以是虚拟可见光源的半径,从而可以基于圆的面积公式,确定出虚拟可见光源的面积,并将虚拟可见光源的面积除以屏幕面积,得到虚拟可见光源的屏占比。虚拟可见光源的屏占比也即虚拟可见光源的面积占屏幕面积的比例,虚拟可见光源的屏占比为0到1之间的实数。示例性地,虚拟可见光源的屏占比可以为0.02。
通过上述步骤1011至步骤1016,首先通过视锥剔除和遮挡剔除,得到虚拟场景中的虚拟可见光源,如此能够在保证渲染出的虚拟场景的真实性的前提下,降低光源渲染数量,提高渲染效率,之后再确定出各个虚拟可见光源的屏占比,从而为不同屏占比的光源按照不同的渲染方式进行渲染提供必备的数据基础。
继续参见图3A,下面接续步骤101进行说明。
在步骤102中,对多个虚拟可见光源中的第一虚拟可见光源进行合批渲染绘制,得到第一绘制结果。
其中,第一虚拟可见光源的屏占比小于预设的屏占比阈值,该屏占比阈值为0到1之间的实数,示例性地,屏占比阈值可以是0.05,屏占比小预设的屏占比阈值的第一虚拟可见光源,可以理解为是远处较小面积的虚拟光源。对屏占比小于屏占比阈值的第一虚拟可见光源进行合批渲染绘制,也即将多个第一虚拟可见光源合并到一起渲染,能够减少渲染次数和渲染时间,从而提高渲染效率。在一些实施例中,参见图4A,步骤102可以通过下述步骤1021至步骤1024实现,下面结合图4A进行说明。
在步骤1021中,获取第一虚拟可见光源在相机空间中的第一位置信息,以及第一虚拟可见光源的光源衰减系数、光源强度和光照角度。
在一些实施例中,第一虚拟可见光源在相机空间中的第一位置信息是对第一虚拟可见光源在世界空间中的第一绝对位置进行刚性变换得到的,第一虚拟可见光源的光源衰减系数、光源强度和光照角度是从虚拟场景数据中获取到该第一虚拟可见光源的光源ID后,基于该光源ID从预先设置的光源信息表中获取到的,在该光源信息表中存储有各个光源ID对应的光源类型、光源衰减系数、光源强度和光照角度、颜色值等信息。
在步骤1022中,基于第一位置信息、光源衰减系数和光源强度,确定第一虚拟可见光源的光照覆盖范围。
由于光照强度会随与光源之间的距离的增大而衰减,所以远离光源的光照强度会变弱。在一些实施例中,当一个位置的光照强度衰减到0,说明该位置不在光源的覆盖范围内。在确定第一虚拟可见光源的光照覆盖范围时,首先获取第一虚拟可见光源对应的衰减公式,然后利用该衰减公式确定出光照强度衰减为0或者光照强度衰减至预设的衰减值(接近于0的数值)的位置,与第一虚拟可见光源之间的距离,并基于计算出的距离、第一虚拟可见光源的光源类型和第一位置信息,确定出第一虚拟可见光源的光照覆盖范围。在基于计算出的距离、第一虚拟可见光源的光源类型和第一位置信息确定第一虚拟可见光源的光照覆盖范围时,如果第一虚拟可见光源的光源类型为点光源,那么第一虚拟可见光源的光照覆盖范围为以第一虚拟可见光源的第一位置信息为圆心,以该距
离为半径的圆;如果第一虚拟可见光源的光源类型为聚光灯,那么还需要获取第一虚拟可见光源的光照角度,第一虚拟可见光源的光照覆盖范围为以第一虚拟可见光源的第一位置信息为圆心,以该距离为半径的扇形,扇形的位置是该光照角度确定出的。
示例性地,假设第一虚拟可见光源的光源类型为点光源,公式(1)是第一虚拟可见光源对应的衰减公式:
I′=I*e-μd (1);
I′=I*e-μd (1);
其中,I为光源强度,μ为光源衰减系数,d为与第一虚拟可见光源之间的距离,通过该衰减公式可以确定出光源强度衰减至预设的衰减值的位置与第一虚拟可见光源的距离,然后将以第一虚拟可见光源的第一位置信息为圆心,以该距离为半径的圆形区域确定为第一虚拟可见光源的光照覆盖范围。
在步骤1023中,确定第一虚拟可见光源在位于光照覆盖范围内的各个像素点的光源颜色值。
在一些实施例中,首先确定第一虚拟可见光源与该光照覆盖范围内各个像素点之间的距离,然后再利用第一虚拟可见光源对应的衰减公式(即公式(1))确定各个像素点的光照强度值,并获取第一虚拟可见光源的颜色值,将第一虚拟可见光源的颜色值乘以各个像素点的光照强度值,得到第一虚拟可见光源在各个像素点的光源颜色值。
在步骤1024中,当像素点位于至少两个第一虚拟可见光源的光照覆盖范围内时,基于至少两个第一虚拟可见光源在所述像素点的光源颜色值,确定像素点的第一目标颜色值。
在一些实施例中,当像素点位于至少两个第一虚拟可见光源的光照覆盖范围内时,说明有至少两个第一虚拟可见光源对该像素点的颜色产生影响,因此将像素点的初始像素值和对该像素点产生影响的至少两个第一虚拟可见光源在该像素点的光源颜色值进行累加,得到像素点的第一目标颜色值。
对于屏占比小于屏占比阈值的第一虚拟可见光源,可以使用GPU Driven的方式,将光源的绘制命令打包,调用DrawIndirect命令,通过上述步骤1021至步骤1024进行合批绘制。如此可以通过调用一次GPU Driven命令,即可绘制出所有的小面积的第一虚拟可见光源,能够降低利用光源列表进行光源渲染的光源数据量,从而提高渲染效率。
继续参见图3A,下面接续步骤102进行说明。
在步骤103中,确定每个屏幕分块的光源列表。
其中,光源列表中仅包括屏占比大于或者等于所述屏占比阈值的第二虚拟可见光源。
在一些实施例中,由于虚拟场景中有大量实时的离散的点光源或者聚光灯,这些光源只影响一小块区域,在执行渲染的时候不需要考虑场景中所有的光源,只需要考虑部分光源,因为一个物体仅被一部分光源影响。基于此,可以按照预设大小将屏幕划分为多个屏幕分块,并确定每个屏幕分块的光源列表。该光源列表中包括的是会对该屏幕分块产生影响的光源。例如可以将屏幕划分为多个大小为16*16的屏幕分块,还可以将屏幕划分为32*32的屏幕分块。屏幕分块的大小可以根据实际需要调整。如果光源影响范围较大,可以划分较大的屏幕分块。如果光源影响范围小,可以划分较小的屏幕分块。在本申请实施例中,由于第二虚拟可见光源是屏占比大于预设的屏占比阈值的虚拟可见光源,因此可以采用较大的屏幕分块,例如可以是32*32的屏幕分块。
在一些实施例中,参见图4B,步骤103可以通过下述步骤1031至步骤1036实现,下面结合图4B进行说明。
在步骤1031中,确定第二虚拟可见光源在相机空间中的第二位置信息。
在一些实施例中,首先获取第二虚拟可见光源在世界空间中的第二绝对位置,然后
利用世界空间到相机空间的旋转矩阵和平移矩阵对第二绝对位置进行刚性变换,得到第二虚拟可见光源在相机空间中的第二位置信息。
在步骤1032中,确定第二虚拟可见光源与屏幕分块的分块包围盒的距离,如果所述距离小于所述第二虚拟可见光源的光源半径,获取所述第二虚拟可见光源的光源类型。
在一些实施例中,屏幕分块是将二维屏幕按照预设大小划分成的多个分块,屏幕分块的分块包围盒按照预设的深度和屏幕分块的四个顶点的顶点坐标构建出的三维结构,第二虚拟可见光源与屏幕分块的分块包围盒的距离可以是在确定出屏幕分块包围盒之后,确定出分块包围盒的中心坐标,然后基于第二虚拟可见光源的第二位置信息与分块包围盒的中心坐标,确定第二虚拟可见光源与屏幕分块的分块包围盒的距离。如果距离小于第二虚拟可见光源的光源半径,说明第二虚拟可见光源可能会对该屏幕分块产生影响,此时获取第二虚拟可见光源的光源类型。第二虚拟可见光源的光源类型可以是点光源类型、聚光灯类型等。如果该距离大于或者等于第二虚拟可见光源的光源半径,说明第二虚拟可见光源不会对该屏幕分块产生影响,因此不会将该第二虚拟可见光源增加至该屏幕分块对应的光源列表中,那么继续判断其他第二虚拟可见光源是否要增加至该屏幕分块对应的光源列表中,
在步骤1033中,确定光源类型是否为点光源类型。
其中,如果光源类型为点光源类型,进入步骤1034;如果光源类型不为点光源类型,进入步骤1035。
在步骤1034中,将第二虚拟可见光源增加至屏幕分块的光源列表中。
在一些实施例中,如果第二虚拟可见光源的光源类型是点光源类型,由于点光源是从一个点向周围空间均匀发光的光源,因此当第二虚拟可见光源与屏幕分块的分块包围盒之间的距离小于第二虚拟可见光源的光源半径时,说明第二虚拟可见光源会对该屏幕分块产生影响,那么将第二虚拟可见光源增加至该屏幕分块的光源列表中。
在一些实施例中,所述光源列表中包括至少一个光源节点,每个光源节点存储有当前光源标识和前一个光源标识;因为是在GPU中各个屏幕分块是并行遍历第二虚拟可见光源以确定第二虚拟可见光源是否在屏幕分块内的,因此每个光源节点需要一个链接信息(Link),该链接信息用于表示该屏幕分块中当前光源的前一个光源标识。当所述第二虚拟可见光源为所述光源列表中的第一个光源节点,将所述第二虚拟可见光源的光源标识增加至所述第一个光源节点对应的当前光源标识;并确定所述第一个光源节点的前一个光源标识为空;当所述第二虚拟可见光源为所述光源列表中的第N个光源节点时,将所述第二虚拟可见光源的光源标识增加至所述第N个光源节点对应的当前光源标识;将第N-1个光源节点对应的当前光源标识增加至所述第N个光源节点的对应的前一个光源标识,N为大于1的整数。
如图4C所示,光源1为屏幕分块1中的第一个光源,那么光源1的链接信息(也即前一个光源标识)为空,光源4为屏幕分块1中的第二个光源,那么光源4的链接信息为前一个光源标识,也即为1,光源5为屏幕分块1中的第三个光源,那么光源5的链接信息为前一个光源标识,也即为4;同样地,光源2为屏幕分块2中的第一个光源,那么光源2的链接信息为空,光源3为屏幕分块2的第二个光源,那么,光源3的链接信息为前一个光源标识,也即为2。
在步骤1035中,如果光源类型为聚光灯类型,获取第二虚拟可见光源的光源方向和锥体角度。
在一些实施例中,如果第二光源为聚光灯类型,由于聚光灯类型的光源不同于向周围空间均匀发光的点光源,聚光灯类型的光源的光照范围是与光源方向和锥体角度相关
的,因此此时需要获取第二虚拟可见光源的光源方向和锥体角度。当光源类型为聚光灯类型时,可以从第二虚拟可见光源的属性信息中获取光源方向和锥体角度,光源方向和锥体角度是在创建第二虚拟可见光源时设定好的,光源方向用于表征光照射的方向,锥体角度用于控制光束扩散的程度,锥体角度越大,光束扩散的程度越高。
在步骤1036中,当基于第二虚拟可见光源的光源方向和锥体角度确定分块包围盒在第二虚拟可见光源的覆盖范围内时,将第二虚拟可见光源增加至所述屏幕分块的光源列表。
在一些实施例中,在获取到第二虚拟可见光源的光源方向和锥体角度后,获取第二虚拟可见光源的光源强度和衰减系数,并获取第二虚拟可见光源的衰减公式,基于第二虚拟可见光源的衰减公式、光源强度和衰减系数,确定出光照强度衰减至预设衰减值对应的距离信息,从而基于第二虚拟可见光源的第二位置信息、光源方向、锥体角度和该距离信息确定出第二虚拟可见光源的覆盖范围,之后再判断分块包围盒是否在第二虚拟可见光源的覆盖范围内,如果确定分块包围盒在第二虚拟可见光源的覆盖范围内,说明第二虚拟可见光源会对该屏幕分块产生影响,因此将第二虚拟可见光源增加至该屏幕分块对应的光源列表中。
通过上述步骤1031至步骤1036,可以在确定第二虚拟可见光源在相机空间中的第二位置信息后,当确定第二虚拟可见光源可能会对屏幕分块中的像素点产生影响时,进一步通过第二虚拟可见光源的光源类型确定是否将第二虚拟可见光源增加至该屏幕分块对应的光源列表中,从而确保光源列表中保存的均是会对屏幕分块产生影响的第二虚拟可见光源,保证渲染结果的准确性。
继续参见图3A,下面接续步骤103进行说明。
在步骤104中,基于每个屏幕分块的光源列表执行全屏绘制,得到第二绘制结果。
在一些实施例中,全屏绘制是指对一次对整个屏幕中的所有屏幕分块完成绘制,也即将多个屏幕分块进行并行渲染。参见图5,对于待渲染的每个像素点执行以下步骤1041至步骤1043,从而对每个屏幕分块的光源列表执行全屏绘制,得到渲染出的虚拟场景,下面结合图5进行说明。
在步骤1041中,基于像素点的位置,确定像素点所在的屏幕分块,并获取屏幕分块对应的光源列表。
在一些实施例中,由于屏幕分块是将屏幕按照预设尺寸划分得到的,因此可以根据预设尺寸和像素点的位置,确定像素点所在的屏幕分块。那么在已知像素点的位置后,假设已知像素点的坐标为(x1,y1),将确定为像素点所在屏幕分块对应的行数,将确定为像素点所在屏幕分块对应的列数,其中,表示对k向上取整,如此在确定出屏幕分块对应的行数和列数,也即能够确定出像素点所在屏幕分块,此时获取该屏幕分块对应的光源列表。
在步骤1042中,根据光源列表中的各个第二虚拟可见光源的光源类型确定各个第二虚拟可见光源在像素点的光源颜色值。
在一些实施例中,根据光源列表中的各个第二虚拟可见光源的光源类型获取各个第二虚拟可见光源的衰减公式,并获取各个第二虚拟可见光源的光源强度和衰减系数,再确定第二虚拟可见光源与屏幕分块中各像素点之间的距离,从而基于第二虚拟可见光源的衰减公式、光源强度、衰减系数和计算出的距离,确定出第二虚拟可见光源在该像素点的光照强度,然后获取第二虚拟可见光源的初始光源颜色值,将第二虚拟可见光源在该像素点的光照强度与初始光源颜色值的乘积,确定为第二虚拟可见光源在像素点的像素值。
在步骤1043中,基于各个第二虚拟可见光源在像素点的光源颜色值,确定像素点
的第二目标颜色值。
在一些实施例中,由于一个屏幕分块中的像素点会受到该屏幕分块对应的光源列表中的各个第二虚拟可见光源的影响,因此需要将像素点的初始像素值和光源列表中各个第二虚拟可见光源在像素点的光源颜色值进行累加,得到像素点的第二目标颜色值。
在步骤105中,将第一绘制结果和第二绘制结果进行合并,得到绘制出的虚拟场景,显示虚拟场景。
在一些实施例中,第一绘制结果是对屏占比小于预设的屏占比阈值的第一虚拟可见光源合批绘制得到的,第一绘制结果包括在第一虚拟可见光源光照范围内的各个像素点的第一目标颜色值,第一绘制结果中还可以包括不在第一虚拟可见光照范围内各个像素点的第一目标颜色值,该第一目标颜色值也即各个像素点的初始像素值。第二绘制结果是基于仅包括屏占比大于或者等于屏占比阈值的第二虚拟光源的光源列表进行全屏绘制得到的,第二绘制结果中包括各个像素点的第二目标颜色值。因此在该步骤中,将第一绘制结果和第二绘制结果进行合并,也即将第一绘制结果中各个像素点的第一目标颜色值与第二绘制结果中对应位置的各个像素点的第二目标颜色值进行叠加,得到各个像素点的第三目标像素值,进而得到绘制出的完整的虚拟场景,并显示该虚拟场景。
在本申请实施例提供的渲染方法中,在获取待渲染的虚拟场景数据之后,首先基于所述虚拟场景数据,确定虚拟场景中的多个虚拟可见光源,并确定各个虚拟可见光源的屏占比,然后对于屏占比小于预设的屏占比阈值的第一虚拟可见光源,通过调用合批渲染绘制命令,对多个第一虚拟可见光源进行合批绘制;对于屏占比大于或者等于屏占比阈值的第二虚拟可见光源,确定每个屏幕分块的光源列表,并且光源列表中仅包括第二虚拟可见光源,然后基于每个屏幕分块的光源列表执行全屏绘制,将两次绘制得到的绘制结果进行合并,得到渲染出的虚拟场景,也就是说,在本申请实施例中,采用合批绘制和分块渲染相结合的方案,通过调用一次合批绘制命令完成了所有屏占比小于屏占比阈值的海量光源的绘制,因此大幅降低了分块渲染的计算量,从而能够快速渲染出虚拟场景中的海量光源,提高渲染效率。
在一些实施例中,在步骤1036之后,还可以执行图6A所示的步骤201至步骤205,从而对屏幕分块的光源列表进行压缩存储,下面结合图6A进行说明。
在步骤201中,确定各个屏幕分块对应的第一光源总数,并确定待渲染的第二虚拟可见光源的第二光源总数。
在一些实施例中,由于光源列表中每个光源节点存储了当前光源标识和前一个光源标识,因此可以对各个屏幕分块对应的光源列表进行反向遍历,从而得到各个屏幕分块对应的第一光源总数,其中,第一光源总数是指各个屏幕分块对应的光源列表中包括的第二虚拟可见光源的总个数。然后将各个屏幕分块对应的第一光源总数进行求和,得到待渲染的第二虚拟可见光源的第二光源总数。
在步骤202中,基于第二光源总数确定用于存储光源列表的连续内存空间。
在一些实施例中,首先获取光源列表中每个光源节点需要占用的内存空间大小,然后再将第二光源总数与每个光源节点占用的内存空间大小的乘积确定为存储所有屏幕分块的光源列表所需的总内存空间大小,最后从内存中获取该总内存空间大小对应的连续内存空间。确定出连续内存空间,也即确定出连续内存空间的起始地址和结束地址。
在步骤203中,基于各个屏幕分块对应的第一光源总数,确定所述各个屏幕分块对应的起始索引。
在一些实施例中,屏幕分块对应的起始索引,也即屏幕分块对应的光源列表在连续内存空间中的起始索引。第1个屏幕分块对应的起始索引为0,第2个屏幕分块对应的起始索引为第一个屏幕分块对应的第一光源总数,第3个屏幕分块对应的起始索引为第
1个屏幕分块和第二个屏幕分块对应的第一光源总数的和,以此类推,第i个屏幕分块对应的起始索引为前i-1个屏幕分块对应的第一光源总数的和,其中i为大于1的整数。
示例性地,假设第1个屏幕分块对应的第一光源总数为20,第2个屏幕分块对应的第一光源总数为30,第3个屏幕分块对应的第一光源总数为20,那么第1个屏幕分块对应的起始索引为0,第2个屏幕分块对应的起始索引为20,第3个屏幕分块对应的起始索引为20+30=50,第4个屏幕分块对应的起始索引为20+30+20=90。
在步骤204中,基于各个屏幕分块的第一光源总数和起始索引确定各个屏幕分块对应的光源列表在连续内存空间中的空间占用信息。
在一些实施例中,光源列表在连续内存空间中的空间占用信息包括光源列表在连续内存空间中的起始存储地址。空间占用信息还可以包括光源列表在连续内存空间中的结束存储地址。由于已知了每个光源节点占用的内存空间大小以及各个屏幕分块对应的起始索引和连续内存空间的起始地址,那么基于连续内存空间的起始地址+每个光源节点占用的内存空间大小乘以各个屏幕分块对应的起始索引,也就得到了屏幕分块对应的光源列表在连续内存空间中的起始存储地址。
在步骤205中,基于各个光源列表在连续内存空间中的空间占用信息,将各个光源列表中的各个第二虚拟可见光源存储至所述连续内存空间。
在一些实施例中,可以基于光源列表在连续内存空间中的空间占用信息中包括的起始存储地址,依次将各个光源列表中的各个第二虚拟可见光源的光源标识和前一个第二虚拟可见光源的光源标识存储至连续存储空间。
图6B是本申请实施例提供的对光源列表进行压缩存储的另一种示意图,如图6B所示,在确定出每个屏幕分块的起始索引之后,是基于每个屏幕分块的起始索引,将每个屏幕分块对应的光源列表存储至连续的内存空间中,从而能够实现光源列表的压缩存储,提高内存空间的利用率。
通过上述步骤201至步骤205,将每个屏幕分块的光源列表存储至一个连续的内存空间中,如此,不仅能够提高内存空间的利用率,并且在获取每个屏幕分块的光源列表时,可以从连续的内存空间中顺序读取即可,能够降低数据读取的耗用时长,从而提高渲染效率。
下面,将说明本申请实施例在一个实际的应用场景中的示例性应用。
本申请实施例提供的渲染方法主要应用于电子游戏、虚拟现实、建筑设计、动画电影等需要实时渲染大规模动态光源的场景,当虚拟场景数据表征是夜晚飞机在城市上空飞行时,利用本申请实施例提供的渲染方法能够渲染出如图7A示出的飞机上空俯瞰城市夜景的灯光效果,当虚拟场景数据表征是夜晚车辆在城市的马路间穿梭时,利用本申请实施例提供的渲染方法能够渲染出如图7B示出的车辆在马路穿梭的动态光影效果,当虚拟场景数据表征是夜晚长城上点亮灯光时,利用本申请实施例提供的渲染方法,能够渲染出如图7C示出的数字长城的夜景灯光效果。
图8是本申请实施例提供的渲染方法的另一种实现流程示意图,下面结合图8对本申请实施例提供的渲染方法进行说明。
在步骤301中,获取可见光源,并确定可见光源在屏幕空间中的大小。
在一些实施例中,首先获取待渲染的虚拟场景数据,并确定待渲染的虚拟场景数据中包括的多个光源,然后在GPU中对多个光源进行视锥剔除(culling)和遮挡剔除,筛选出虚拟场景中的可见光源,并计算可见光源在屏幕空间中的大小。
在步骤302中,对于小面积光源,使用GPU Driven的方式绘制光源。
其中,小面积光源是指屏占比小于屏占比阈值的光源。在一些实施例中,可以使用GPU Driven的方式,将光源的绘制命令打包,调用间接绘制(DrawIndirect)命令,对
多个小面积光源进行合批绘制。在实现时,可以不采用传统的通过模板测试来绘制覆盖范围的方式,而是直接通过光源衰减和角度来计算各个小面积光源的光照覆盖范围。在确定出小面积光源的光照覆盖范围后,基于各个小面积光源的光源衰减系数、光源颜色和光源强度确定出光照覆盖范围内各个像素点的绘制颜色值。
在步骤303中,对于大面积光源,确定每个屏幕分块的光源列表。
其中,光源列表中仅包括大面积光源。大面积光源也即是屏占比大于或者等于屏占比阈值的光源。在一些实施例中,对于近处的大面积光源,可以使用tile based的方式,计算每个屏幕分块的光源列表。在实现时,对于每个屏幕分块,遍历所有大面积光源,计算大面积光源在相机空间中的位置,然后基于大面积光源在相机空间中的位置,确定大面积光源与各个屏幕分块的分块包围盒之间的距离,如果该距离小于大面积光源的半径,则认为该大面积光源会对该屏幕分块产生影响,如果该大面积光源的光源类型为点光源,则直接将该大面积光源加入到该屏幕分块的光源列表中。如果该大面积光源的光源类型为聚光灯,根据聚光灯的光源方向和锥体角度确定分块包围盒是否在聚光灯的光照范围内,如果分块包围盒在聚光灯的光照范围内,则将该大面积光源加入到该屏幕分块的光源列表中。
在一些实施例中,在光源列表中会记录当前光源的ID以及前一个光源节点的链接。在确定出每个屏幕分块的光源列表后,对每个屏幕分块的光源列表结构进行压缩。首先反向遍历光源列表,计算该屏幕分块中的光源数目,保存该屏幕分块中的光源数目以及该光源列表对应的起始索引,然后基于该屏幕分块中的光源数据和该光源列表对应的起始索引确定出该光源列表在连续的内存结构中的存储范围,最后再将该屏幕分块中的光源都记录到该存储范围对应的连续内存结构中。
在步骤304中,执行一次全屏绘制,绘制每个屏幕分块的光源。
在一些实施例中,针对每个像素,计算像素所在的屏幕分块,获取该屏幕分块的光源列表,然后遍历光源列表,根据光源的类型计算在该位置上的漫反射和高光颜色值,将光源列表的所有颜色值叠加后得到该像素点的第二目标颜色值,最后输出该像素点的第二目标颜色值。
图9是利用本申请实施例提供的渲染方法进行远距离光源渲染与近距离光源渲染的效果示意图,与相关技术中tile based lighting算法相比,在有5万个光源场景的性能测试中,本申请实施例提供的渲染方法在结合了GPU Driven和Tiledbase的情况下,如图9中的901所示,在进行远距离光源渲染时,帧率能从7帧提升到100帧,在近距离overdraw加剧的情况下,由于光源划分和提前剔除(Culling)的作用,能减少tile culling的消耗,如图9中的902所示,帧率也能从9帧提升到54帧。
图10是本申请实施例提供的渲染方法与相关技术中的cluster based lighting算法的对比效果图,在光源数量达到5万级别的情况下,如图10中的1001所示,本申请实施例提供的渲染方法在结合了GPU Driven和Tiledbase的情况下,帧率能够达到100帧/秒,而因为构建复杂cluster灯光列表的开销太大,因此如图10中的1002所示,cluster based lighting算法的帧率会下降明显,下降至15帧/秒。
本申请实施例提供一种基于GPU Driven和分块渲染相结合的渲染方案,通过结合两者的优势,快速渲染场景中的海量光源。整个过程几乎没有CPU开销和CPU同步的消耗,同时由于一个CPU draw完成了所有中远景海量光源的绘制,GBuffer缓存命中率大幅度提升,从而避免多次绘制的带宽消耗。
可以理解的是,在本申请实施例中,涉及到虚拟场景数据等相关的数据,当本申请实施例运用到具体产品或技术中时,需要获得用户许可或者同意,且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准。
下面继续说明本申请实施例提供的渲染装置455的实施为软件模块的示例性结构,在一些实施例中,如图2所示,存储在存储器450的渲染装置455中的软件模块可以包括:
第一确定模块4551,配置为获取待渲染的虚拟场景数据,基于所述虚拟场景数据,确定虚拟场景中的多个虚拟可见光源,并确定各个虚拟可见光源的屏占比;第一渲染模块4552,配置为对所述多个虚拟可见光源中,屏占比小于预设的屏占比阈值的第一虚拟可见光源进行合批渲染绘制;第二确定模块4553,配置为确定每个屏幕分块的光源列表,其中所述光源列表中仅包括屏占比大于或者等于所述屏占比阈值的第二虚拟可见光源;第二渲染模块4554,配置为基于所述每个屏幕分块的光源列表执行全屏绘制,得到第二绘制结果;显示模块4555,配置为将所述第一绘制结果和所述第二绘制结果进行合并处理,得到绘制出的虚拟场景,显示所述虚拟场景。
在一些实施例中,第一确定模块4551还配置为:基于所述虚拟场景数据,确定存在于虚拟场景中的多个虚拟光源;对所述多个虚拟光源进行视锥剔除和遮挡剔除,得到所虚拟场景中的多个虚拟可见光源。
在一些实施例中,第一确定模块4551还配置为:获取虚拟可见光源在相机空间中的包围球的球心坐标、包围球半径;获取相机空间到屏幕空间的投影矩阵,并基于所述投影矩阵确定缩放倍率;利用所述缩放倍率、所述包围球半径及所述球心坐标确定所述虚拟可见光源在相机空间中的第一尺寸信息;获取呈现虚拟场景的屏幕的第二尺寸信息,基于所述第一尺寸信息和所述第二尺寸信息,确定所述虚拟可见光源的屏占比。
在一些实施例中,第一渲染模块4552还配置为:获取所述第一虚拟可见光源在相机空间中的第一位置信息,以及所述第一虚拟可见光源的光源衰减系数、光源强度和光照角度;基于所述第一位置信息、光源衰减系数、光源强度和光照角度,确定所述第一虚拟可见光源的光照覆盖范围;确定所述第一虚拟可见光源在位于所述光照覆盖范围内的各个像素点的光源颜色值;当像素点位于至少两个第一虚拟可见光源的光照覆盖范围内时,基于所述至少两个第一虚拟可见光源在所述像素点的光源颜色值,确定所述像素点的第一目标颜色值。
在一些实施例中,第二确定模块4553还配置为:确定第二虚拟可见光源在相机空间中的第二位置信息;确定第二虚拟可见光源与屏幕分块的分块包围盒的距离,如果所述距离小于所述第二虚拟可见光源的光源半径,获取所述第二虚拟可见光源的光源类型;如果所述光源类型为点光源,将所述第二虚拟可见光源增加至所述屏幕分块的光源列表中。
在一些实施例中,第二确定模块4553还配置为:如果所述光源类型为聚光灯类型,获取所述第二虚拟可见光源的光源方向和锥体角度;当基于所述第二虚拟可见光源的光源方向和锥体角度确定所述分块包围盒在所述第二虚拟可见光源的覆盖范围内时,将所述第二虚拟可见光源增加至所述屏幕分块的光源列表。
在一些实施例中,所述光源列表中包括至少一个光源节点,每个光源节点存储有当前光源标识和当前光源标识的前一个光源标识;第二确定模块4553还配置为:当所述第二虚拟可见光源为所述光源列表中的第一个光源节点,将所述第二虚拟可见光源的光源标识增加至所述第一个光源节点对应的当前光源标识;确定所述第一个光源节点的前一个光源标识为空;当所述第二虚拟可见光源为所述光源列表中的第N个光源节点时,将所述第二虚拟可见光源的光源标识增加至所述第N个光源节点对应的当前光源标识;将第N-1个光源节点对应的当前光源标识增加至所述第N个光源节点的对应的前一个光源标识。
在一些实施例中,该渲染装置还包括:第三确定模块,配置为确定各个屏幕分块对
应的第一光源总数,并确定待渲染的第二虚拟可见光源的第二光源总数;第四确定模块,配置为基于所述第二光源总数确定用于存储光源列表的连续内存空间;第五确定模块,配置为基于所述各个屏幕分块对应的第一光源总数,确定所述各个屏幕分块对应的起始索引;第六确定模块,配置为基于所述各个屏幕分块的第一光源总数和起始索引确定各个屏幕分块对应的光源列表在连续内存空间中的空间占用信息;存储模块课,配置为基于各个光源列表在连续内存空间中的空间占用信息,将所述各个光源列表中的第二虚拟可见光源存储至所述连续内存空间。
在一些实施例中,第二渲染模块4554还配置为:对于待渲染的每个像素点执行以下操作:基于像素点的位置,确定所述像素点所在的屏幕分块,并获取所述屏幕分块对应的光源列表;根据所述光源列表中的各个第二虚拟可见光源的光源类型确定各个第二虚拟可见光源在所述像素点的光源颜色值;将所述各个第二虚拟可见光源在所述像素点的光源颜色值,确定所述像素点的第二目标颜色值。
在一些实施例中,显示模块4555,还配置为从所述第一绘制结果中获取各个像素点的第一目标颜色值,从所述第二绘制结果中获取各个像素点的第二目标颜色值;针对每一像素点,叠加所述像素点的第一目标颜色值和第二目标颜色值,得到所述像素点的第三目标颜色值;利用所述各个像素点的第三目标颜色值,绘制出虚拟场景。
本申请实施例提供了一种计算机程序产品,该计算机程序产品包括计算机程序或计算机可执行指令,该计算机程序或计算机可执行指令存储在计算机可读存储介质中。电子设备的处理器从计算机可读存储介质读取该计算机可执行指令,处理器执行该计算机可执行指令,使得该电子设备执行本申请实施例上述的渲染方法。
本申请实施例提供一种存储有计算机可执行指令的计算机可读存储介质,其中存储有计算机可执行指令或者计算机程序,当计算机可执行指令或者计算机程序被处理器执行时,将引起处理器执行本申请实施例提供的渲染方法,例如,如图3A、图8示出的渲染方法。
在一些实施例中,计算机可读存储介质可以是RAM、ROM、闪存、磁表面存储器、光盘、或CD-ROM等存储器;也可以是包括上述存储器之一或任意组合的各种设备。
在一些实施例中,计算机可执行指令可以采用程序、软件、软件模块、脚本或代码的形式,按任意形式的编程语言(包括编译或解释语言,或者声明性或过程性语言)来编写,并且其可按任意形式部署,包括被部署为独立的程序或者被部署为模块、组件、子例程或者适合在计算环境中使用的其它单元。
作为示例,计算机可执行指令可以但不一定对应于文件系统中的文件,可以可被存储在保存其它程序或数据的文件的一部分,例如,存储在超文本标记语言(Hyper Text Markup Language,HTML)文档中的一个或多个脚本中,存储在专用于所讨论的程序的单个文件中,或者,存储在多个协同文件(例如,存储一个或多个模块、子程序或代码部分的文件)中。
作为示例,计算机可执行指令可被部署为在一个电子设备上执行,或者在位于一个地点的多个电子设备上执行,又或者,在分布在多个地点且通过通信网络互连的多个电子设备上执行。
以上所述,仅为本申请的实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和范围之内所作的任何修改、等同替换和改进等,均包含在本申请的保护范围之内。
Claims (14)
- 一种渲染方法,应用于电子设备,所述方法包括:基于待渲染的虚拟场景数据确定虚拟场景中的多个虚拟可见光源,并确定各个虚拟可见光源的屏占比;对所述多个虚拟可见光源中的第一虚拟可见光源进行合批渲染绘制,得到第一绘制结果,所述第一虚拟可见光源的屏占比小于预设的屏占比阈值;确定每个屏幕分块的光源列表,其中所述光源列表中包括屏占比大于或者等于所述屏占比阈值的第二虚拟可见光源;基于所述每个屏幕分块的光源列表执行全屏绘制,得到第二绘制结果;将所述第一绘制结果和所述第二绘制结果进行合并,得到绘制出的虚拟场景,显示所述虚拟场景。
- 根据权利要求1中所述的方法,其中,所述基于待渲染的虚拟场景数据确定虚拟场景中的多个虚拟可见光源,包括:基于所述虚拟场景数据,确定存在于虚拟场景中的多个虚拟光源;对所述多个虚拟光源进行视锥剔除和遮挡剔除,得到所虚拟场景中的多个虚拟可见光源。
- 根据权利要求2中所述的方法,其中,所述确定各个虚拟可见光源的屏占比,包括:获取虚拟可见光源在相机空间中的包围球的球心坐标、包围球半径;获取世界空间到相机空间的投影矩阵,并基于所述投影矩阵确定缩放倍率;利用所述缩放倍率、所述包围球半径及所述球心坐标确定所述虚拟可见光源在相机空间中的第一尺寸信息;获取呈现虚拟场景的屏幕的第二尺寸信息,基于所述第一尺寸信息和所述第二尺寸信息,确定所述虚拟可见光源的屏占比。
- 根据权利要求1至3任一项所述的方法,其中,所述对所述多个虚拟可见光源中的第一虚拟可见光源进行合批渲染绘制,包括:获取所述第一虚拟可见光源在相机空间中的第一位置信息,以及所述第一虚拟可见光源的光源衰减系数、光源强度;基于所述第一位置信息、所述光源衰减系数、所述光源强度,确定所述第一虚拟可见光源的光照覆盖范围;确定所述第一虚拟可见光源在位于所述光照覆盖范围内的各个像素点的光源颜色值;当像素点位于至少两个第一虚拟可见光源的光照覆盖范围内时,基于所述至少两个第一虚拟可见光源在所述像素点的光源颜色值,确定所述像素点的第一目标颜色值。
- 根据权利要求1至3任一项中所述的方法,其中,所述确定每个屏幕分块的光源列表,包括:确定第二虚拟可见光源在相机空间中的第二位置信息;确定所述第二虚拟可见光源与屏幕分块的分块包围盒的距离;如果所述距离小于所述第二虚拟可见光源的光源半径,获取所述第二虚拟可见光源的光源类型;如果所述光源类型为点光源,将所述第二虚拟可见光源增加至所述屏幕分块的光源列表中。
- 根据权利要求5中所述的方法,其中,所述确定每个屏幕分块的光源列表,包 括:如果所述光源类型为聚光灯类型,获取所述第二虚拟可见光源的光源方向和锥体角度;当基于所述第二虚拟可见光源的光源方向和锥体角度确定所述分块包围盒在所述第二虚拟可见光源的覆盖范围内时,将所述第二虚拟可见光源增加至所述屏幕分块的光源列表。
- 根据权利要求5或6中所述的方法,其中,所述光源列表中包括至少一个光源节点,每个光源节点存储有当前光源标识和所述当前光源标识的前一个光源标识;所述将所述第二虚拟可见光源增加至所述屏幕分块的光源列表,包括:当所述第二虚拟可见光源为所述光源列表中的第一个光源节点,将所述第二虚拟可见光源的光源标识增加至所述第一个光源节点对应的当前光源标识;确定所述第一个光源节点的前一个光源标识为空;当所述第二虚拟可见光源为所述光源列表中的第N个光源节点时,将所述第二虚拟可见光源的光源标识增加至所述第N个光源节点对应的当前光源标识,N为大于1的整数;将第N-1个光源节点对应的当前光源标识增加至所述第N个光源节点的对应的前一个光源标识。
- 根据权利要求7中所述的方法,其中,所述方法还包括:确定各个屏幕分块对应的第一光源总数,并确定待渲染的第二虚拟可见光源的第二光源总数;基于所述第二光源总数确定用于存储光源列表的连续内存空间;基于所述各个屏幕分块对应的第一光源总数,确定所述各个屏幕分块对应的起始索引;基于所述各个屏幕分块的第一光源总数和起始索引确定各个屏幕分块对应的光源列表在连续内存空间中的空间占用信息;基于各个光源列表在连续内存空间中的空间占用信息,将所述各个光源列表中的第二虚拟可见光源存储至所述连续内存空间。
- 根据权利要求1中所述的方法,其中,所述基于所述每个屏幕分块的光源列表执行全屏绘制,包括:对于待渲染的每个像素点执行以下操作:基于所述像素点的位置,确定所述像素点所在的屏幕分块,并获取所述屏幕分块对应的光源列表;根据所述光源列表中的各个第二虚拟可见光源的光源类型确定各个第二虚拟可见光源在所述像素点的光源颜色值;基于所述各个第二虚拟可见光源在所述像素点的光源颜色值,确定所述像素点的第二目标颜色值。
- 根据权利要求1至3任一项所述的方法,其中,所述将所述第一绘制结果和所述第二绘制结果进行合并,得到绘制出的虚拟场景,包括:从所述第一绘制结果中获取各个像素点的第一目标颜色值,从所述第二绘制结果中获取各个像素点的第二目标颜色值;针对每一像素点,叠加所述像素点的第一目标颜色值和第二目标颜色值,得到所述像素点的第三目标颜色值;利用所述各个像素点的第三目标颜色值,绘制出虚拟场景。
- 一种渲染装置,所述装置包括:第一确定模块,配置为获取待渲染的虚拟场景数据,基于所述虚拟场景数据,确定虚拟场景中的多个虚拟可见光源,并确定各个虚拟可见光源的屏占比;第一渲染模块,配置为对所述多个虚拟可见光源中的第一虚拟可见光源进行合批渲染绘制,得到第一绘制结果,所述第一虚拟可见光源的屏占比小于预设的屏占比阈值;第二确定模块,配置为确定每个屏幕分块的光源列表,其中所述光源列表中包括屏占比大于或者等于所述屏占比阈值的第二虚拟可见光源;第二渲染模块,配置为基于所述每个屏幕分块的光源列表执行全屏绘制,得到第二绘制结果;显示模块,配置为将所述第一绘制结果和所述第二绘制结果进行合并,得到绘制出的虚拟场景,显示所述虚拟场景。
- 一种电子设备,所述电子设备包括:存储器,用于存储计算机可执行指令;处理器,用于执行所述存储器中存储的计算机可执行指令时,实现权利要求1至10任一项所述的渲染方法。
- 一种计算机可读存储介质,存储有计算机可执行指令或者计算机程序,所述计算机可执行指令或者计算机程序被处理器执行时实现权利要求1至10任一项所述的渲染方法。
- 一种计算机程序产品,包括计算机可执行指令或计算机程序,所述计算机可执行指令或计算机程序被处理器执行时实现权利要求1至10任一项所述的渲染方法。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US19/299,397 US20250371772A1 (en) | 2023-09-06 | 2025-08-14 | Illumination Rendering in Virtual Environments |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311141331.2A CN116883572B (zh) | 2023-09-06 | 2023-09-06 | 一种渲染方法、装置、设备及计算机可读存储介质 |
| CN202311141331.2 | 2023-09-06 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US19/299,397 Continuation US20250371772A1 (en) | 2023-09-06 | 2025-08-14 | Illumination Rendering in Virtual Environments |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025050797A1 true WO2025050797A1 (zh) | 2025-03-13 |
Family
ID=88271859
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2024/103126 Pending WO2025050797A1 (zh) | 2023-09-06 | 2024-07-02 | 一种渲染方法、装置、电子设备、计算机可读存储介质及计算机程序产品 |
Country Status (3)
| Country | Link |
|---|---|
| US (1) | US20250371772A1 (zh) |
| CN (1) | CN116883572B (zh) |
| WO (1) | WO2025050797A1 (zh) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116883572B (zh) * | 2023-09-06 | 2023-12-19 | 腾讯科技(深圳)有限公司 | 一种渲染方法、装置、设备及计算机可读存储介质 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170193690A1 (en) * | 2016-01-04 | 2017-07-06 | Samsung Electronics Co., Ltd. | 3d rendering method and apparatus |
| CN114549730A (zh) * | 2020-11-27 | 2022-05-27 | 华为技术有限公司 | 多光源场景渲染的光源采样权重确定方法及相关设备 |
| CN116188653A (zh) * | 2022-12-21 | 2023-05-30 | 北京像素软件科技股份有限公司 | 一种点光源剔除方法及系统 |
| CN116310052A (zh) * | 2022-09-07 | 2023-06-23 | 北京字跳网络技术有限公司 | 基于多光源的画面渲染方法及相关设备 |
| CN116883572A (zh) * | 2023-09-06 | 2023-10-13 | 腾讯科技(深圳)有限公司 | 一种渲染方法、装置、设备及计算机可读存储介质 |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH1173524A (ja) * | 1997-08-28 | 1999-03-16 | Matsushita Electric Ind Co Ltd | レンダリング手法 |
| CN104658033B (zh) * | 2013-11-18 | 2017-06-20 | 华为技术有限公司 | 多光源下的全局光照绘制方法及装置 |
| CN104200513A (zh) * | 2014-08-08 | 2014-12-10 | 浙江传媒学院 | 基于矩阵行列采样进行多光源渲染的方法 |
| CN112381918B (zh) * | 2020-12-03 | 2025-01-10 | 腾讯科技(深圳)有限公司 | 图像渲染方法、装置、计算机设备和存储介质 |
-
2023
- 2023-09-06 CN CN202311141331.2A patent/CN116883572B/zh active Active
-
2024
- 2024-07-02 WO PCT/CN2024/103126 patent/WO2025050797A1/zh active Pending
-
2025
- 2025-08-14 US US19/299,397 patent/US20250371772A1/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170193690A1 (en) * | 2016-01-04 | 2017-07-06 | Samsung Electronics Co., Ltd. | 3d rendering method and apparatus |
| CN114549730A (zh) * | 2020-11-27 | 2022-05-27 | 华为技术有限公司 | 多光源场景渲染的光源采样权重确定方法及相关设备 |
| CN116310052A (zh) * | 2022-09-07 | 2023-06-23 | 北京字跳网络技术有限公司 | 基于多光源的画面渲染方法及相关设备 |
| CN116188653A (zh) * | 2022-12-21 | 2023-05-30 | 北京像素软件科技股份有限公司 | 一种点光源剔除方法及系统 |
| CN116883572A (zh) * | 2023-09-06 | 2023-10-13 | 腾讯科技(深圳)有限公司 | 一种渲染方法、装置、设备及计算机可读存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN116883572B (zh) | 2023-12-19 |
| CN116883572A (zh) | 2023-10-13 |
| US20250371772A1 (en) | 2025-12-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111340928B (zh) | 一种结合光线跟踪的Web端实时混合渲染方法、装置及计算机设备 | |
| CN114677467B (zh) | 地形图像渲染方法、装置、设备及计算机可读存储介质 | |
| CN110443893B (zh) | 大规模建筑场景渲染加速方法、系统、装置和存储介质 | |
| CN109509138B (zh) | 针对射线跟踪系统的减小的加速结构 | |
| US20260120394A1 (en) | Global lighting rendering method and apparatus, computer device, and storage medium | |
| ES2660434T3 (es) | Sistema y procedimiento para proporcionar una canalización de gráficos mejorada | |
| EP4462368A1 (en) | Rendering optimization method, and electronic device and computer-readable storage medium | |
| CN113674389A (zh) | 场景渲染方法、装置、电子设备及存储介质 | |
| US20090102844A1 (en) | Method for synthesizing a virtual image by beam launching | |
| KR102848474B1 (ko) | 타이트한 세계 공간 경계 영역들의 생성 | |
| KR102151443B1 (ko) | 하이브리드 gpu 아키텍처 기반의 그래픽 처리 장치 | |
| CN118236695B (zh) | 三维游戏引擎的虚拟场景构建方法、装置、设备及存储介质 | |
| CN117689793A (zh) | 用于光线追踪的部分加速结构的生成和遍历 | |
| CN115701305A (zh) | 阴影筛选 | |
| US20250371772A1 (en) | Illumination Rendering in Virtual Environments | |
| WO2024193219A9 (zh) | 虚拟场景的光照更新方法、装置、电子设备、计算机可读存储介质及计算机程序产品 | |
| CN115526977B (zh) | 游戏画面渲染方法和装置 | |
| US20240378793A1 (en) | Image rendering method and related device | |
| CN116993894B (zh) | 虚拟画面的生成方法、装置、设备、存储介质及程序产品 | |
| CN112700541A (zh) | 一种模型更新方法、装置、设备及计算机可读存储介质 | |
| WO2024244640A1 (zh) | 模型接缝修复方法、装置、设备和介质 | |
| WO2024093610A1 (zh) | 阴影渲染方法、装置、电子设备及可读存储介质 | |
| CN116824082A (zh) | 虚拟地形的绘制方法、装置、设备、存储介质及程序产品 | |
| CN121366239A (zh) | 虚拟场景的贴图处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品 | |
| HK40094509A (zh) | 虚拟地形的绘制方法、装置、设备、存储介质及程序产品 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 24861643 Country of ref document: EP Kind code of ref document: A1 |