Method for rendering a virtual scene and related device

By obtaining the rendering engine version information and calling the matching projection transformation method, the geometric points of virtual objects are mapped to the depth value range, solving the rendering jitter problem of virtual scenes and achieving efficient rendering effects and a simplified R&D process.

CN122399339APending Publication Date: 2026-07-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2025-01-15
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

In existing technologies, rendering jitter is prone to occur during virtual scene rendering, such as blurred object edges and chaotic object overlap. Moreover, it is difficult to detect jitter under dynamic viewpoints by manual inspection, resulting in poor rendering effects and long development cycles.

Method used

By obtaining the rendering engine version information, calling the matching projection transformation method, the geometric points of the virtual object are mapped to the depth value range of the normalized device coordinate system, and pixel rendering is performed to generate a rendered image, avoiding secondary compression mapping of depth values.

Benefits of technology

It automatically avoids rendering jitter, improves rendering effects, reduces manual intervention and development cycle, and improves rendering efficiency and quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122399339A_ABST
    Figure CN122399339A_ABST
Patent Text Reader

Abstract

This application relates to the field of computer technology and discloses a rendering method and related equipment for virtual scenes. The method includes: obtaining version information of the rendering engine used to render the virtual scene; calling a projection transformation method matching the version information to obtain the depth value range to which pixels should be mapped during pixel rendering, and assigning the coordinate range to which geometric points projected to the normalized device coordinate system should be mapped as the depth value range; projecting and transforming the geometric points corresponding to the virtual object to be rendered in the virtual scene into the coordinate range to obtain the target virtual object located in the normalized device coordinate system; and performing pixel rendering on the target virtual object to generate a rendered image corresponding to the virtual scene. By using the embodiments of this application, the rendering jitter problem in the virtual scene rendering process can be avoided, thereby improving the rendering effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to methods, apparatus, storage media, devices and program products for rendering virtual scenes. Background Technology

[0002] With the development of digital technology, rich and realistic virtual scenes in applications such as virtual reality and games have brought players a better experience. However, in the process of rendering virtual scenes to form the final rendered image presented to the player, rendering jitter problems are prone to occur, such as blurred edges of objects and chaotic overlapping of objects within the rendered image.

[0003] In related technologies, rendering jitter issues are primarily identified through manual inspection of the initial rendered image. These issues are then repaired before the image is put into use, thus preventing jitter problems in the final rendered image. However, some rendering jitter issues are difficult to detect manually, resulting in poor rendering quality. Therefore, how to avoid rendering jitter during the virtual scene rendering process to improve rendering quality is a pressing issue that needs to be addressed. Summary of the Invention

[0004] This application provides a method, apparatus, storage medium, device, and program product for rendering virtual scenes, which can avoid rendering jitter during the rendering process of virtual scenes and improve the rendering effect.

[0005] On one hand, embodiments of this application provide a method for rendering a virtual scene, including:

[0006] Get the version information of the rendering engine used to render the virtual scene;

[0007] Call the projection transformation method that matches the version information, obtain the depth value range to which the pixel should be mapped during the pixel rendering process, and assign the coordinate range to which the geometric point should be mapped to the normalized device coordinate system as the depth value range.

[0008] The geometric points corresponding to the virtual objects to be rendered in the virtual scene are projected and transformed into the coordinate range to obtain the target virtual object located in the normalized device coordinate system.

[0009] Pixel rendering is performed on the target virtual object to generate a rendered image corresponding to the virtual scene.

[0010] On one hand, embodiments of this application provide a rendering apparatus for a virtual scene, which includes an acquisition unit, a calling unit, a processing unit, and a pixel rendering unit, wherein:

[0011] The acquisition unit is used to obtain the version information of the rendering engine used to render the virtual scene;

[0012] The calling unit is used to call the projection transformation method that matches the version information, obtain the depth value range to which the pixel should be mapped during the pixel rendering process, and assign the coordinate range to which the geometric point of the projection transformation to the normalized device coordinate system should be mapped to the depth value range.

[0013] The processing unit is used to project and transform the geometric points corresponding to the virtual objects to be rendered in the virtual scene into the coordinate range, so as to obtain the target virtual objects located in the normalized device coordinate system.

[0014] The pixel rendering unit is used to perform pixel rendering on the target virtual object and generate a rendered image corresponding to the virtual scene.

[0015] In one embodiment of this application, based on the aforementioned scheme, before projecting and transforming the geometric points corresponding to the virtual objects to be rendered in the virtual scene into the coordinate range to obtain the target virtual objects located in the normalized device coordinate system, the processing unit may further be used to perform: determining the scene viewport of the virtual scene according to the relative positional relationship between the virtual camera and the virtual scene; determining the virtual objects in the scene viewport according to the bounding box of the scene viewport and the virtual objects in the virtual scene, and using the virtual objects in the scene viewport as the virtual objects to be rendered.

[0016] In one embodiment of this application, based on the aforementioned scheme, the virtual objects in the scene viewport include multiple virtual objects; when the processing unit projects and transforms the geometric points corresponding to the virtual objects to be rendered in the virtual scene into the coordinate interval to obtain the target virtual objects located in the normalized device coordinate system, it can specifically perform the following: obtaining the distance between each virtual object in the scene viewport and the virtual camera; according to the distances corresponding to the multiple virtual objects in the scene viewport, sequentially projecting and transforming the geometric points corresponding to the multiple virtual objects in the scene viewport into the coordinate interval to obtain multiple target virtual objects located in the normalized device coordinate system.

[0017] In one embodiment of this application, based on the aforementioned scheme, when the processing unit sequentially projects and transforms the geometric points corresponding to the multiple virtual objects in the scene viewport into the coordinate range according to the distances corresponding to the multiple virtual objects in the scene viewport, to obtain multiple target virtual objects located in the normalized device coordinate system, it can also be used to perform the following: write the virtual object with the largest corresponding distance among the multiple virtual objects into the list to be rendered; select the virtual object with the largest corresponding distance from the remaining virtual objects and write it into the list to be rendered, and repeat the step of selecting the virtual object with the largest corresponding distance from the remaining virtual objects and writing it into the list to be rendered until all the virtual objects are written into the list to be rendered; select virtual objects sequentially from the list to be rendered according to the writing order of each virtual object in the list to be rendered, and project and transform the geometric points corresponding to the selected virtual objects into the coordinate range to obtain multiple target virtual objects located in the normalized device coordinate system.

[0018] In one embodiment of this application, based on the aforementioned scheme, the virtual objects in the virtual scene include multiple virtual objects; when the processing unit determines the virtual objects in the scene viewport based on the bounding box of the scene viewport and the virtual objects in the virtual scene, it can specifically perform the following: obtain the bounding box of the scene viewport; traverse the virtual objects in the virtual scene and obtain the bounding box corresponding to the currently traversed virtual object; if the obtained bounding box intersects with the bounding box of the scene viewport, then determine the currently traversed virtual object as the virtual object in the scene viewport, and traverse the next virtual object in the virtual scene until all the virtual objects in the virtual scene have been traversed.

[0019] In one embodiment of this application, based on the aforementioned scheme, when the processing unit obtains the bounding box of the scene viewport, it can specifically perform the following: constructing a viewport structure of the scene viewport based on the pitch and yaw angles of the virtual camera relative to the virtual scene and the viewport matrix of the scene viewport; obtaining the viewport size of the scene viewport and initializing the viewport structure based on the viewport size to obtain the initialized viewport structure; obtaining the viewport information of the initialized viewport structure and obtaining the bounding box of the scene viewport from the viewport information.

[0020] In one embodiment of this application, based on the aforementioned scheme, the version information includes a major version identifier and a minor version identifier; when the calling unit calls the projection transformation method matching the version information to obtain the depth value range to which the pixel should be mapped during pixel rendering, it can specifically perform the following: if the major version identifier is less than a first value, or the major version identifier is equal to the first value and the minor version identifier is less than a second value, then a detection result is obtained to characterize that the version of the rendering engine is lower than a preset version; based on the detection result, the projection transformation method matching the version information is called to obtain the depth value range to which the pixel should be mapped during pixel rendering.

[0021] In one embodiment of this application, based on the foregoing scheme, the pixel rendering unit can further be used to perform: increasing the number of bits of the depth value stored by the rendering engine to obtain a target number of bits; during the pixel rendering of the target virtual object, if the total number of bits of the depth value of the rendered pixel is greater than the target number of bits, then the data in the depth value of the rendered pixel that has a number of bits greater than the target number of bits is discarded to obtain a processed depth value, and the processed depth value is stored with the target number of bits; if the total number of bits of the depth value of the rendered pixel is less than or equal to the target number of bits, then the depth value of the rendered pixel is stored with the target number of bits.

[0022] In one embodiment of this application, based on the aforementioned scheme, when the pixel rendering unit increases the number of bits of the depth value supported by the rendering engine to obtain the target number of bits, it can specifically perform the following: obtain the depth buffer precision parameter managed by the rendering subsystem for resource management in the rendering engine; replace the original pixel storage format of the depth buffer precision parameter with the target pixel storage format, and use the number of bits of data supported by the target pixel storage format as the target number of bits; wherein, the number of bits of data supported by the target pixel storage format is greater than the number of bits of data supported by the original pixel storage format.

[0023] On one hand, embodiments of this application provide an electronic device, which includes an input interface and an output interface, and further includes:

[0024] A processor, adapted to implement one or more instructions; and,

[0025] A computer storage medium storing one or more instructions adapted for loading and executing the rendering method of the virtual scene described above by the processor.

[0026] On one hand, embodiments of this application provide a computer-readable medium storing computer program instructions, which, when executed by a processor, are used to perform the rendering method of the aforementioned virtual scene.

[0027] On one hand, embodiments of this application provide a computer program product or computer program, the computer program product or computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium; a processor of an electronic device reads the computer instructions from the computer-readable storage medium, the processor executes the computer instructions, and when the computer instructions are executed by the processor, they are used to execute the above-mentioned virtual scene rendering method.

[0028] In the technical solution provided in the embodiments of this application, by assigning the coordinate interval to which the geometric points should be mapped to the normalized device coordinate system during projection transformation to the depth value interval required for pixel rendering, the coordinate values ​​of virtual objects can be mapped to the depth value interval required for pixel rendering during the projection transformation process. Furthermore, the coordinate mapping of geometric points during projection transformation is proportional, unlike pixel rendering where negative depth values ​​are directly processed to the same value, preventing the loss of depth information of virtual objects and thus causing rendering jitter and affecting the overall rendering effect of the virtual scene. Therefore, this solution can automatically avoid the rendering jitter problem caused by secondary compression mapping of depth values ​​during pixel rendering without manual intervention, which is beneficial for improving rendering effects. Attached Figure Description

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

[0030] Figure 1 This is a schematic diagram illustrating the development process of a scene map provided in an embodiment of this application;

[0031] Figure 2 This is a schematic diagram illustrating a rendering jitter problem provided in an embodiment of this application;

[0032] Figure 3 This is a schematic diagram of the structure of a virtual scene rendering system provided in an embodiment of this application;

[0033] Figure 4 This is a flowchart illustrating a virtual scene rendering method provided in an embodiment of this application;

[0034] Figure 5 This is a code logic flowchart provided in an embodiment of the present application regarding setting the coordinate interval corresponding to the NDC coordinate system;

[0035] Figure 6 This is a code logic flowchart for obtaining viewport information provided in an embodiment of this application;

[0036] Figure 7 This is a code logic flowchart provided in an embodiment of the present application regarding the determination of virtual objects belonging to the scene viewport;

[0037] Figure 8 This is a schematic diagram illustrating the rendering process of a virtual scene provided in an embodiment of this application;

[0038] Figure 9 This is a flowchart illustrating another virtual scene rendering method provided in an embodiment of this application;

[0039] Figure 10 This is a code logic flowchart provided in an embodiment of the present application regarding the sequential rendering of virtual objects in a scene viewport;

[0040] Figure 11 This is a code logic flowchart for configuring pixel storage format provided in an embodiment of this application;

[0041] Figure 12 This is a schematic diagram of an optimized process for addressing rendering jitter issues provided in an embodiment of this application;

[0042] Figure 13 This is a rendering of an optimization scheme provided in an embodiment of this application;

[0043] Figure 14 This is a schematic diagram of the structure of a virtual scene rendering device provided in an embodiment of this application;

[0044] Figure 15 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0045] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0046] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0047] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0048] The flowcharts shown in the accompanying diagrams are merely illustrative and do not necessarily include all content and operations, nor do they necessarily have to be executed in the described order. For example, some operations may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0049] It should also be noted that "multiple" as mentioned in this application refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0050] With the development of digital technology, rich and realistic virtual scenes in applications such as virtual reality and games have brought players a better experience. However, in the process of rendering virtual scenes to form the final rendered image presented to the player, rendering jitter problems are prone to occur, such as blurred edges of objects and chaotic overlapping of objects within the rendered image.

[0051] In related technologies, the main approach is to manually inspect the initial rendered image for rendering jitter issues and then repair those issues. For details, please refer to the appendix. Figure 1 The diagram illustrates the development process of a scene map. The scene map is constructed based on at least one virtual scene. Figure 1 As shown, after the developers complete the creation and development of the scene map, they will perform a full map traversal inspection. This involves traversing every virtual scene in the scene map, rendering each virtual scene, and manually inspecting the rendered images until all virtual scenes in the scene map have been traversed. During the inspection process, any rendering jitter issues detected can be recorded. Afterwards, the developers can analyze the detected rendering jitter issues and generate optimization solutions based on the analysis results. Finally, the developers will then perform secondary development and production of the scene map based on the optimization solutions.

[0052] For example, please see the appendix. Figure 2 This diagram illustrates a rendering jitter problem. Under normal rendering, plot 201 is at the top layer (foreground), plot 202 is in the middle, and plot 203 is at the bottom layer (background); however, due to rendering jitter, as shown... Figure 2As shown, cross-rendering occurred between plots 201, 202, and 203. After identifying this rendering jitter issue, the developers will analyze the specific causes of the jitter. If the cross-rendering is caused by a large difference in clipping planes, the jitter will be avoided by reducing the distance between the clipping planes. If the cross-rendering is caused by objects overlapping too closely, the jitter will be avoided by slightly shifting the depth values ​​of the objects. If the jitter is caused by objects being too thin, the objects will be thickened to avoid the jitter.

[0053] It's clear that the implementation of existing solutions relies entirely on R&D personnel, and some rendering jitter issues may only be triggered from dynamic perspectives, making them difficult to detect even with manual inspection. Furthermore, the processes of analyzing rendering jitter issues and subsequent art restoration are complex and lengthy, resulting in a prolonged and inefficient overall development cycle for virtual scenes. In addition, those involved may spread the detected rendering jitter issues, thereby affecting the reputation of the application to which the virtual scene belongs.

[0054] Based on this, embodiments of this application provide a rendering scheme for a virtual scene. This scheme calls a projection transformation method that matches the version information of the rendering engine. It assigns values ​​to the coordinate range to which geometric points projected to the normalized device coordinate system are mapped, based on the depth value range to which pixels should be mapped during pixel rendering. Thus, during the rendering of virtual objects in the virtual scene, the coordinate range to which the geometric points corresponding to the virtual objects are projected is the same as the depth value range. Finally, pixel rendering is performed on the target virtual object obtained from the projection transformation and located in the normalized device coordinate system, thereby generating a rendered image corresponding to the virtual scene.

[0055] The Normalized Device Coordinates (NDC) system is a coordinate system used in graphics rendering, primarily for describing two-dimensional positions on the screen. The geometric points corresponding to the virtual object to be rendered are the geometric points used to construct the virtual object. In specific implementations, the geometric points corresponding to the virtual object to be rendered can be understood as the vertices of the virtual object. In three-dimensional space, a virtual object is composed of multiple geometric elements, and vertices are the basic building blocks of these elements.

[0056] In practice, during the rendering of the virtual scene, in the projection transformation stage with respect to the NDC coordinate system, the geometric points corresponding to the virtual objects in the virtual scene are usually compressed and mapped to the coordinate range of [-1,1]. Correspondingly, the coordinate values ​​of the virtual objects in the NDC coordinate system in the depth axis (i.e., the z-axis) direction (referred to as depth values) are compressed and mapped to [-1,1].

[0057] However, when converting virtual objects from the NDC coordinate system to the window coordinate system, the depth values ​​are further compressed and mapped to the range [0,1] to accommodate the needs of the depth buffer stage. This causes low-sensitivity NDC values ​​in the range [-1 0] in the NDC coordinate system to be processed as the same depth values ​​in the window coordinate system, resulting in reduced depth resolution and causing rendering jitter. The pixel rendering process includes a depth buffer stage.

[0058] It's easy to see that this solution assigns the coordinate range to which geometric points should be mapped to the normalized device coordinate system as the depth value range. This allows the depth values ​​to be mapped to the depth value range that pixels would normally be mapped to during pixel rendering during the projection transformation process. Furthermore, the coordinate mapping of geometric points during the projection transformation is proportional, preventing negative coordinate values ​​from being treated as identical, thus preserving the original appearance of the virtual object. Therefore, this solution automatically avoids rendering jitter caused by secondary compression and mapping of depth values ​​during pixel rendering without manual intervention, thereby improving rendering quality.

[0059] Furthermore, the projection transformation method used in this solution during assignment is matched to the rendering engine's version information. Different terminal devices run different versions of rendering engines, and using a projection transformation method incompatible with the rendering engine can lead to compatibility and depth conflicts, thus affecting the rendering effect. Therefore, this solution, by calling a projection transformation method that matches the rendering engine's version information for assignment, can further improve the rendering effect.

[0060] Based on the above-described virtual scene rendering method, this application provides a virtual scene rendering system, which can be found in [reference needed]. Figure 3 , Figure 3 The rendering system for the virtual scene shown may include multiple terminal devices 301 and multiple servers 302, wherein a communication connection is established between any terminal device and any server. Terminal devices 301 may include any one or more of the following: sensors, smartphones, tablets, laptops, desktop computers, smart vehicles, and smart wearable devices. Various applications (APPs) may also run within terminal devices 301, such as game clients, virtual interaction clients, multimedia playback clients, social clients, information streaming clients, and so on.

[0061] Server 302 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminal device 301 and server 302 can communicate directly or indirectly via wired or wireless communication; this application does not impose any restrictions on this.

[0062] In one embodiment, the rendering method of the aforementioned virtual scene can be solely provided by... Figure 3 The terminal device 301 in the rendering system of the virtual scene shown executes the following process: The terminal device 301 obtains the version information of the rendering engine it runs for rendering the virtual scene; then, the terminal device 301 can call the projection transformation method that matches the obtained version information to obtain the depth value range to which the pixel should be mapped during the pixel rendering process, and assign the coordinate range to which the geometric points to be mapped to the normalized device coordinate system are the depth value range; then, the terminal device 301 can project and transform the geometric points corresponding to the virtual object to be rendered in the virtual scene into the coordinate range to obtain the target virtual object located in the normalized device coordinate system; finally, the terminal device 301 performs pixel rendering on the target virtual object to generate the rendered image corresponding to the virtual scene.

[0063] Optionally, the terminal device 301 can also output a rendered image corresponding to the virtual scene. Alternatively, the rendering method for the virtual scene described above can also be solely determined by... Figure 3 The server 302 in the rendering system of the virtual scene shown executes the process. For details of the execution process, please refer to the specific execution process of the terminal device 301 mentioned above. It will not be repeated here.

[0064] In another embodiment, the rendering method of the above-described virtual scene can be provided by... Figure 3The rendering system of the virtual scene shown is jointly executed by terminal device 301 and server 302. The specific execution process is as follows: server 302 obtains the version information of the rendering engine it runs for rendering the virtual scene; then, server 302 can call the projection transformation method that matches the obtained version information to obtain the depth value range to which the pixel should be mapped during pixel rendering, and assign the coordinate range to which the geometric points to be mapped to the normalized device coordinate system are the depth value range; then, server 302 can project and transform the geometric points corresponding to the virtual object to be rendered in the virtual scene into the coordinate range to obtain the target virtual object located in the normalized device coordinate system; finally, server 302 performs pixel rendering on the target virtual object to generate the rendered image corresponding to the virtual scene, and transmits the rendered image corresponding to the virtual scene to terminal device 301 in real time, and terminal device 301 outputs the rendered image corresponding to the virtual scene in real time.

[0065] It should be noted that the embodiments of this application can be applied to various scenarios, including but not limited to cloud gaming, AI (Artificial Intelligence), smart transportation, intelligent driving and other application scenarios that require rendering virtual scenes, and are not limited thereto.

[0066] Meanwhile, in specific embodiments of this application, if data or information such as virtual scenes and version information involves objects, when the embodiments of this application are applied to specific products or technologies, permission or consent from the objects is required, and the collection, use and processing of related data or information must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0067] Based on the aforementioned virtual scene rendering scheme and system, this application provides a method for rendering a virtual scene. See also... Figure 4 This is a flowchart illustrating a virtual scene rendering method provided in an embodiment of this application. Figure 4 The rendering method of the virtual scene shown can be derived from... Figure 3 The method is executed by a server or terminal device in the rendering system of the virtual scene shown. In this embodiment, the method is described as being executed by a terminal device.

[0068] in, Figure 4 The rendering method for the virtual scene shown may include steps S401 to S404:

[0069] S401, retrieve the version information of the rendering engine used to render the virtual scene.

[0070] In this embodiment, the virtual scene can specifically be a three-dimensional or two-dimensional scene constructed in three-dimensional or two-dimensional space. Each virtual scene can contain at least one virtual object; the virtual object can be a person or an object, and is not limited thereto. Specifically, in game applications, a scene map may be constructed, which contains multiple virtual scenes. Different virtual scenes can present different game environments for game players. For example, in a winter scene of a competitive game, virtual objects such as snowmen, withered trees, and snow-covered houses may be constructed.

[0071] The rendering engine used to render virtual scenes can be an application programming interface, application component, or software system responsible for converting the graphics and visual elements in a computer program into images visible on the screen, so as to ensure that the graphics and visual elements can be correctly displayed on the device screen.

[0072] In practical applications, rendering engines can include at least one of the following: Unreal Engine (also known as UE Engine, a rendering engine mainly used for game rendering), Open Graphics Library (OpenGL, an application programming interface mainly used for generating 2D and 3D computer graphics), OpenGL (Open Graphics Library) is a cross-platform, hardware-independent graphics API (application programming interface) mainly used for generating 2D and 3D computer graphics, and CryEngine (a rendering engine known for its excellent outdoor scene rendering and environment simulation).

[0073] It is easy to see that rendering engines are constantly being updated and iterated, resulting in multiple versions of the rendering engine; therefore, the version information of the rendering engine contains a version identifier, and different version identifiers are used to indicate different versions of the rendering engine.

[0074] S402, call the projection transformation method that matches the version information, obtain the depth value range to which the pixel should be mapped during the pixel rendering process, and assign the coordinate range to which the geometric point to be mapped to the normalized device coordinate system is the depth value range.

[0075] In this embodiment, the projection transformation method may include classes, functions, etc., for coordinate system transformation during the projection transformation process. Different versions of rendering engines may support different projection transformation methods. If the rendering engine uses an incompatible projection transformation method, rendering errors can easily occur due to compatibility issues, depth conflicts, shadows and reflections, and object invisibility, thus affecting the rendering effect of the virtual scene. Therefore, to avoid rendering errors and improve rendering effects, it is necessary to call the projection transformation method that matches the version information for assignment.

[0076] Specifically, the projection transformation method that matches the version information can be the projection transformation method supported by the rendering engine in the version identifier indicated in the version information. In practice, different versions of the rendering engine may support different projection transformation methods; or the rendering engine in a version prior to a certain version may support one projection transformation method, while the rendering engine in a version later supports another projection transformation method.

[0077] In one embodiment, the depth value range to which a pixel should be mapped during pixel rendering can be pre-stored in the terminal device, or it can be written into the associated code segment when writing the projection transformation method. Therefore, the process of obtaining the depth value range may specifically include calling the projection transformation method to retrieve the depth value range from the terminal device's storage area; alternatively, the process of obtaining the depth value range may also specifically include executing the associated code segment of the projection transformation method to read the depth value range.

[0078] In one possible implementation, the version information may include a major version identifier and a minor version identifier; then, the matching projection transformation method can be determined based on the major and minor version identifiers. Specifically, older rendering engines typically do not support assignment functions for assigning values ​​to coordinate ranges corresponding to the NDC coordinate system, while newer rendering engines usually have developed assignment functions for doing so.

[0079] Therefore, if the primary version identifier is less than the first value, or the primary version identifier is equal to the first value and the secondary version identifier is less than the second value, a detection result is obtained to indicate that the version of the rendering engine is lower than the preset version; if the primary version identifier is greater than the first value, or the primary version identifier is equal to the first value and the secondary version identifier is greater than or equal to the second value, a detection result is obtained to indicate that the version of the rendering engine is higher than or equal to the preset version; based on the detection result, a projection transformation method matching the version information is called to obtain the depth value range to which the pixel should be mapped during the pixel rendering process.

[0080] In this system, the primary version identifier for the preset version is the first value, and the secondary version identifier is the second value. The preset version can be set manually or by the server or terminal device in the virtual scene rendering system mentioned above; this is not limited here.

[0081] Specifically, rendering engines with versions higher than the default version can support the use of the aforementioned assignment function. Therefore, if the detection result indicates that the rendering engine version is higher than or equal to the default version, the assignment function can be directly called as the projection transformation method that matches the version information.

[0082] Rendering engines with versions lower than the preset version do not support the aforementioned assignment functions and may require coordinate control methods built on the rendering engine's extension mechanism to assign values ​​to coordinate ranges. Therefore, if the detection result indicates that the rendering engine version is lower than the preset version, the coordinate control method built on the rendering engine's extension mechanism can be called as the projection transformation method matching the version information. Specifically, the coordinate control method built on the rendering engine's extension mechanism can be a function from the extension function library associated with the rendering engine. It is clear that this embodiment fully considers the situation where lower-version rendering engines typically do not support assignment functions for assigning values ​​to coordinate ranges corresponding to the NDC coordinate system, while higher-version rendering engines typically have developed assignment functions for assigning values ​​to coordinate ranges corresponding to the NDC coordinate system. By detecting whether the rendering engine version is greater than or equal to the preset version, it is possible to effectively distinguish whether the rendering engine is a high or low version, thereby calling the appropriate projection transformation method for different versions of the rendering engine. This effectively avoids compatibility issues between the projection transformation method and the rendering engine, thus avoiding rendering problems such as depth conflicts, shadows and reflections, and invisible objects, which is beneficial for improving rendering effects.

[0083] For example, rendering engines version 3.2 and above introduced the glClipControl function (a function used to control the conversion method from the clipping coordinate system to the NDC coordinate system), which can set the coordinate range corresponding to the NDC coordinate system to [0,1]. However, rendering engines versions below 3.2 can only set the coordinate range corresponding to the NDC coordinate system to [0,1] according to the glClipControlEXT function (an extension function that provides a way to adjust the clipping control settings).

[0084] Please see the appendix. Figure 5 This illustrates a code logic flowchart for setting the coordinate interval corresponding to the NDC coordinate system. In practical applications, based on... Figure 5 The pseudocode constructed from the code logic shown can be seen as follows:

[0085] / / Get the current rendering context

[0086] Context=GetCurrentOpenGLContext();

[0087] / / Initialize version identifier variables

[0088] majorVersion = 0;

[0089] minorVersion = 0;

[0090] / / Get the major version identifier of the rendering engine, majorVersion

[0091] Context.GetIntegerv(GL_MAJOR_VERSION,majorVersion);

[0092] / / Get the minor version identifier of the rendering engine.

[0093] Context.GetIntegerv(GL_MINOR_VERSION,minorVersion);

[0094] / / Check if the rendering engine version is greater than or equal to 3.2

[0095] if(majorVersion>3or(majorVersion==3and minorVersion>=2));

[0096] / / If the major version identifier is greater than 3, or the major version identifier is equal to 3 and the minor version identifier is greater than or equal to 2, then the coordinate interval corresponding to the NDC coordinate system is set to [0,1] using the glClipControl function.

[0097] Context.glClipControl(GL_CLIP_CONTROL_CURRENT_BIT_EXT,GL_ZERO_TO_ONE_EXT);

[0098] / / In other cases, the coordinate range corresponding to the NDC coordinate system is set to [0,1] using the extended function of the corresponding glClipControl function.

[0099] else:

[0100] / / Get the rendering engine's extension functions

[0101] extensions=Context.glGetString(GL_EXTENSIONS);

[0102] / / Check if the rendering engine supports extension functions

[0103] if(extensions contains "GL_EXT_clip_control");

[0104] / / Call the extension function to set the coordinate interval corresponding to the NDC coordinate system to [0,1]

[0105] Context.glClipControlEXT(GL_CLIP_CONTROL_CURRENT_BIT_EXT,GL_ZERO_TO_ONE_EXT);

[0106] In the pseudocode, the current rendering context is first obtained using GetCurrentOpenGLContext() (a function used to retrieve the current rendering context). The rendering context can specifically be an environment containing all rendering-related states and configurations. The rendering context contains the rendering engine version identifier; therefore, the rendering engine version identifier can be further obtained from the rendering context. Furthermore, "ZERO_TO_ONE" in the pseudocode represents the range [0,1].

[0107] S403 projects and transforms the geometric points corresponding to the virtual object to be rendered in the virtual scene into the coordinate range to obtain the target virtual object located in the normalized device coordinate system.

[0108] In this embodiment, the virtual object to be rendered refers to the virtual object in the virtual scene that needs to be rendered. Virtual objects contained in the virtual scene can be used as virtual objects to be rendered. Optionally, considering the viewing angle of the virtual camera on the virtual scene, the virtual objects contained in the final rendered image displayed on the device screen are determined; therefore, virtual objects in the scene viewport can be used as virtual objects to be rendered. The scene viewport defines the actual display area of ​​the virtual scene on the screen and is a crucial bridge connecting the three-dimensional space and the physical screen.

[0109] Furthermore, projection transformation, specifically known as perspective projection transformation, is used to convert virtual objects in three-dimensional space onto a two-dimensional screen, simulating the human visual system's different perceptions of objects at different distances. In detail, projection transformation involves the transformation of virtual objects between multiple coordinate systems, ultimately converting them to the NDC coordinate system.

[0110] In one possible implementation, to avoid wasting rendering resources by rendering all virtual objects in the virtual scene when the player only views a portion of them, a scene viewport can be defined first, and then the virtual objects within that viewport can be selected as the virtual objects to be rendered. Specifically, the scene viewport can be determined based on the relative position of the virtual camera and the virtual scene; then, the virtual objects within the viewport can be identified based on its bounding box and the virtual objects in the scene, and these virtual objects can be used as the virtual objects to be rendered.

[0111] The aforementioned relative positional relationships can be determined based on at least one of the pitch angle and yaw angle of the virtual camera relative to the virtual scene. The bounding box is a rectangular area used to define the visible region of the viewport; specifically, the bounding box can be determined by the positions of the four sides of the rectangle or by the coordinates of two diagonal points.

[0112] Specifically, if any virtual object in the virtual scene is partially or entirely within the bounding box of the scene viewport, then that virtual object can be identified as a virtual object within the scene viewport; otherwise, it is not. Therefore, this embodiment first determines the scene viewport of the virtual scene and then uses the virtual objects within that viewport as the virtual objects to be rendered. This approach ensures the integrity and display effect of the scene image presented to the player, thus guaranteeing the player's perceptual experience of the virtual scene. It also effectively avoids wasting rendering resources by rendering virtual objects in areas invisible to the player within the virtual scene, thereby improving the rendering engine's performance and ultimately enhancing the rendering effect.

[0113] In one embodiment, there may be multiple virtual objects in a virtual scene. The specific process of determining whether a virtual object in a virtual scene belongs to the scene viewport may include: obtaining the bounding box of the scene viewport; traversing the virtual objects in the virtual scene and obtaining the bounding box corresponding to the currently traversed virtual object; if the obtained bounding box intersects with the bounding box of the scene viewport, then the currently traversed virtual object is determined as a virtual object in the scene viewport, and the next virtual object in the virtual scene is traversed, until all multiple virtual objects in the virtual scene have been traversed.

[0114] In this context, the bounding box corresponding to each virtual object is the geometry that completely encloses the virtual object. The bounding box is slightly larger than the virtual object in volume but simpler in structure, and can approximate a more complex virtual object. Specifically, if the bounding box corresponding to a virtual object intersects with the bounding box of the scene viewport, it means that the virtual object is partially or entirely within the scene viewport. This embodiment defines virtual objects partially within the scene viewport as virtual objects within the scene viewport. This effectively protects the edge details of the subsequently rendered scene image, improving the completeness and refinement of the rendered scene image, thereby enhancing the overall rendering effect of the virtual scene.

[0115] In one embodiment, the process of obtaining the bounding box of the scene viewport may specifically include: constructing a viewport structure of the scene viewport based on the pitch and yaw angles of the virtual camera relative to the virtual scene and the viewport matrix of the scene viewport; then, obtaining the viewport size of the scene viewport and initializing the viewport structure based on the viewport size to obtain the initialized viewport structure; finally, obtaining the viewport information of the initialized viewport structure and obtaining the bounding box of the scene viewport from the viewport information.

[0116] Specifically, the viewport matrix of the scene viewport can include the viewport transformation matrix used in the process of mapping virtual objects from the NDC coordinate system to pixel positions on the display screen. Optionally, the viewport matrix of the scene viewport may also include the matrix used in the projection transformation process, which is not limited here. Specifically, based on the pitch and yaw angles of the virtual camera relative to the virtual scene, the visible area in the virtual scene relative to the player can be accurately determined, which is beneficial for constructing an accurate and appropriate viewport structure. From the viewport information of such a viewport structure, a more accurate bounding box of the scene viewport can be obtained, which is beneficial for more accurately determining the virtual objects within the scene viewport, thereby improving the overall rendering effect of the virtual scene.

[0117] In practical applications, considering that there may be hundreds of thousands of virtual objects that actually exist and can be loaded in a virtual scene, in order to simplify subsequent evaluation and settings, when optimizing rendering performance, only the virtual objects within the scene viewport will be pre-acquired, that is, the visible objects of the virtual camera will be acquired.

[0118] Before accessing virtual objects in the scene viewport, you need to define the scene viewport and obtain the current viewport information. For example, please refer to the appendix. Figure 6 This illustrates a code logic flowchart for obtaining viewport information, while in practical applications, based on... Figure 6 The pseudocode constructed from the code logic shown can be seen as follows:

[0119] / / Construct the viewport structure

[0120] ViewFamily=new ViewFamilyContext(

[0121] World.Scene.GetWorldSettings().DefaultViewPitchRange; / / Get the pitch angle

[0122] World.Scene.GetWorldSettings().DefaultViewYawRange; / / Get yaw angle

[0123] Color.White; / / Sets the background color to white.

[0124] new ViewMatrices(); / / Initialize the view matrix )

[0126] / / Initialize viewport structure

[0127] ViewInitOptions=new ViewInitOptions();

[0128] ViewInitOptions.setViewRectangle(

[0129] new Rectangle(

[0130] 0; / / Top-left corner X coordinate

[0131] 0; / / Top-left Y-coordinate

[0132] GEngine.GameViewport.Viewport.getWidth(); / / Viewport width

[0133] GEngine.GameViewport.Viewport.getHeight(); / / Viewport height ) )

[0136] / / Calculate scene parameters View

[0137] ViewInitOptions.setViewFamily(ViewFamily)

[0138] View=World.Scene.calculateSceneView(ViewInitOptions)

[0139] / / By pointing to the viewport structure with 'View', we can obtain the viewport information of the viewport structure.

[0140] As shown in the pseudocode above, a new viewport structure is first constructed based on the pitch angle parameter DefaultViewPitchRange, the yaw angle parameter DefaultViewYawRange, and the viewport matrix of the scene viewport, new ViewMatrices(). Then, the width of the scene viewport is obtained through the function GEngine.GameViewport.Viewport.getWidth(), and the height of the scene viewport is obtained through the function GEngine.GameViewport.Viewport.getHeight(). Using ViewInitOptions (a class or structure used to configure scene viewport and rendering settings), a viewport structure that matches the size of the scene viewport (including the height and width obtained above) is constructed and initialized.

[0141] Finally, the viewport information of the current viewport structure is obtained through the scene parameter View. The viewport information may include the aforementioned pitch angle, yaw angle, viewport matrix, width of the scene viewport, height of the scene viewport, and initialization parameters. The viewport information can be used to determine which virtual objects are within the scene viewport range.

[0142] After obtaining the viewport information, virtual objects belonging to the scene viewport can be identified using this information. For an example, please refer to the appendix. Figure 7 This illustrates a code logic flowchart for determining virtual objects within the scene viewport. In its specific implementation, it is based on... Figure 5 The pseudocode constructed from the code logic shown can be seen as follows:

[0143] / / Get the bounding box of the scene viewport

[0144] ViewportBounds=View.ViewFrustum.GetBoundingBox()

[0145] / / Initialize an output list to store virtual objects that intersect with the scene viewport.

[0146] OutRenderables = new List()

[0147] / / Iterate through all virtual objects in the virtual scene

[0148] for each PrimitivesGroup in View.Primitives;

[0149] / / Iterate through the index of each virtual object in the virtual scene

[0150] for each PrimitiveIndex in PrimitivesGroup.PrimitiveIndices;

[0151] / / Get the rendering component corresponding to the currently traversed virtual object

[0152] PrimitiveComponent=PrimitivesGroup.Component.Get()

[0153] if PrimitiveComponent is not null;

[0154] RenderObject=PrimitiveComponent.GetRenderObject()

[0155] / / If the rendering component is not empty, get the bounding box of the currently traversed virtual object.

[0156] if RenderObject is not null;

[0157] RenderObjectBounds=RenderObject.GetBounds().GetBoundingBox()

[0158] / / Check if the bounding box of the currently traversed virtual object intersects with the bounding box of the scene viewport.

[0159] if ViewportBounds.Intersects(RenderObjectBounds);

[0160] / / If they intersect, add the currently traversed virtual object to the output list.

[0161] OutRenderables.Add(RenderObject)

[0162] Specifically, the pseudocode first obtains the viewport bounding box (i.e., ViewportBounds) using the View.ViewFrustum.GetBoundingBox() function. The View.ViewFrustum.GetBoundingBox() function can be a function in the rendering engine used to obtain the bounding boxes of models, AActors, or rendering components. An AActor is the base class that can place or generate virtual objects (i.e., Actors) in the virtual scene. An AActor can contain many Components (i.e., rendering components) used to control the movement of the AActor, and some Components can handle part of the rendering work of the AActor. A Component is a functional block that can be added to an AActor to provide specific behaviors or properties. For example, a Spot Light Component allows the Actor to emit light like a spotlight, while a RotatingMovement Component allows the Actor to rotate.

[0163] Then, a for loop iterates through the virtual objects in the virtual scene, specifically iterating through the Primitives (i.e., the rendering patch table, which is the basic geometry used to construct and render 3D objects). During the traversal of virtual objects in the virtual scene, the virtual object (i.e., the RenderObject, specifically the upper-level virtual object with a smaller depth value than the currently traversed virtual object) is obtained through the PrimitiveComponent.GetRenderObject() function, and the bounding box (i.e., the RenderObjectBounds) of the currently traversed virtual object is obtained through the GetBoundingBox() function.

[0164] Finally, by directly determining whether the bounding box of the currently traversed virtual object intersects with the scene bounding box of the viewport, we can determine whether the virtual object is within the scene viewport. If the bounding box of the virtual object intersects with the scene bounding box, it is determined whether the virtual object is within the scene viewport; if the bounding box of the virtual object does not intersect with the scene bounding box, it is determined whether the virtual object is outside the scene viewport.

[0165] In the rendering of virtual objects, Levels of Detail (LOD) technology can be used to improve rendering performance and effects. LOD is a technique in computer graphics used to optimize rendering performance. Its principle is to determine the resource allocation for object rendering based on the object's position and importance in the display environment, reducing the face count and detail of less important objects, thereby achieving high-efficiency rendering computation.

[0166] S404 performs pixel rendering on the target virtual object to generate a rendered image corresponding to the virtual scene.

[0167] In this embodiment of the application, pixel rendering may specifically include a series of processing steps such as transforming and mapping the target virtual object to the device screen coordinate system, rasterization, fragment generation, fragment shading, and depth buffering.

[0168] Specifically, pixel rendering belongs to the post-rendering stage of virtual scenes; please refer to the appendix. Figure 8 This illustrates a schematic diagram of the rendering process for a virtual scene. For example... Figure 8 As shown, the rendering process of a virtual scene mainly includes three stages: initial rendering, mid-rendering, and post-rendering. Initial rendering may include the process of acquiring the virtual object to be rendered; mid-rendering may include the process of performing projection transformations on the virtual object; and post-rendering may include the process of pixel rendering.

[0169] In this embodiment, by assigning the coordinate range to which geometric points should be mapped to the normalized device coordinate system during projection transformation to the depth value range, the coordinate values ​​of virtual objects can be mapped to the depth value range required for pixel rendering during the projection transformation process. Furthermore, the coordinate mapping of geometric points during projection transformation is proportional, unlike pixel rendering which crudely processes negative numbers to the same value, leading to information loss in virtual objects and rendering jitter issues that affect the overall rendering effect of the virtual scene. Therefore, this solution automatically avoids the rendering jitter problem caused by secondary compression mapping of depth values ​​during pixel rendering without manual intervention, which is beneficial for improving rendering effects, enhancing the overall development efficiency of virtual scenes, and improving the reputation of the application to which the virtual scene belongs.

[0170] Furthermore, the projection transformation method used in the assignment of values ​​in this application embodiment is matched with the version information of the rendering engine. However, different terminal devices run different versions of rendering engines, and using a projection transformation method incompatible with the rendering engine can lead to compatibility issues, depth conflicts, and other problems, thus affecting the rendering effect. Therefore, the method used in this application embodiment, which calls a projection transformation method that matches the version information of the rendering engine for assignment, can further improve the rendering effect.

[0171] Based on the above-described virtual scene rendering scheme and system, this application provides another virtual scene rendering method. See also... Figure 9 This is a flowchart illustrating another virtual scene rendering method provided in this application embodiment. Figure 9 The rendering method of the virtual scene shown can be derived from... Figure 3 The method is executed by the server or terminal device shown. In this embodiment, the method is described using the server as an example. Figure 4 The method shown has been extended.

[0172] in, Figure 9 The rendering method for the virtual scene shown may include the following steps S901 to S905:

[0173] S901, retrieve the version information of the rendering engine used to render the virtual scene.

[0174] In this application embodiment, the specific implementation of step S901 can be found in the specific implementation of step S201, and will not be repeated here.

[0175] S902, call the projection transformation method that matches the version information, obtain the depth value range to which the pixel should be mapped during the pixel rendering process, and assign the coordinate range to which the geometric point to be mapped to the normalized device coordinate system is the depth value range.

[0176] In the embodiments of this application, the specific implementation of step S902 can be found in the specific implementation of step S202, and will not be repeated here.

[0177] S903, obtain the distance between each virtual object and the virtual camera in the scene viewport of the virtual scene.

[0178] In this embodiment, the distance between each virtual object and the virtual camera is the depth value (also known as the z-value) of each virtual object relative to the virtual camera.

[0179] S904, based on the distances corresponding to multiple virtual objects in the scene viewport, sequentially project and transform the geometric points corresponding to multiple virtual objects in the scene viewport to the coordinate range, thereby obtaining multiple target virtual objects located in the normalized device coordinate system.

[0180] In this embodiment, the geometric points corresponding to multiple virtual objects in the scene viewport are sequentially projected and transformed into coordinate intervals according to either descending or ascending distances, resulting in multiple target virtual objects located in the normalized device coordinate system. Specifically, after a virtual object in the scene viewport is projected and transformed, it becomes a single target virtual object located in the normalized device coordinate system.

[0181] Specifically, virtual objects can be selected sequentially from multiple virtual objects in the scene viewport in descending or ascending order of distance. The geometric points corresponding to the selected virtual objects are then projected and transformed into the coordinate range to obtain the target virtual objects mapped to the normalized device coordinate system. This process continues until all virtual objects in the scene viewport have been projected and transformed into the coordinate range, resulting in multiple target virtual objects.

[0182] In one possible implementation, considering that virtual objects are rendered in descending order of distance (i.e., from farthest to closest relative to the virtual camera), overdraw can be effectively reduced (the situation where the same pixel location is covered and drawn multiple times by different geometric objects; excessive overdraw wastes a lot of rendering resources). Furthermore, the rendering effect is better when dealing with transparent objects, shadows, and other complex effects, and rendering jitter is less likely to occur.

[0183] Therefore, in order to reduce the consumption of rendering resources during the rendering process and reduce the rendering jitter problem that occurs during the rendering of complex effects such as transparent objects and shadows, thereby improving the overall rendering effect, a further approach can be adopted: rendering from far to near. That is, according to the order of distance from large to small, the geometric points corresponding to multiple virtual objects in the scene viewport are projected and transformed into the coordinate range to obtain multiple target virtual objects located in the normalized device coordinate system.

[0184] In one embodiment, the virtual object with the largest corresponding distance among multiple virtual objects can be written into a list to be rendered. Then, the virtual object with the largest corresponding distance from the remaining virtual objects is selected and written into the list to be rendered, and this step is repeated until all virtual objects are written into the list to be rendered. Finally, according to the writing order of each virtual object in the list to be rendered, virtual objects are selected sequentially from the list to be rendered, and the geometric points corresponding to the selected virtual objects are projected and transformed into a coordinate range to obtain multiple target virtual objects located in the normalized device coordinate system. Virtual objects that are written earlier in the list to be rendered can be selected first.

[0185] Specifically, in this embodiment, the virtual objects are written into the rendering list in descending order of their corresponding distances. Therefore, selecting virtual objects from the rendering list sequentially for projection transformation according to the order in which they are written is equivalent to selecting virtual objects for projection transformation sequentially in descending order of their corresponding distances. Rendering virtual objects in descending order of distance (i.e., from farthest to closest relative to the virtual camera) effectively reduces overdraw and improves rendering quality when handling transparent objects, shadows, and other complex effects, reducing the likelihood of rendering jitter. Thus, this embodiment effectively reduces overdraw and avoids rendering jitter issues associated with transparent objects, shadows, and other complex effects, thereby improving the overall rendering quality.

[0186] Optionally, multiple virtual objects in the scene viewport can be written into a list to be rendered, and then sorted in descending order of distance to obtain a processed list to be rendered. Then, according to the order of the virtual objects in the list, virtual objects are selected sequentially, and the geometric points corresponding to the selected virtual objects are projected and transformed into a coordinate range to obtain multiple target virtual objects in a normalized device coordinate system. Virtual objects that appear earlier in the sorted list are selected first.

[0187] In the specific implementation, since step S403 mentions that the virtual object corresponds to an AActor and is constructed from at least one AActor, sorting the virtual objects is essentially sorting the AActors corresponding to the virtual objects.

[0188] For example, please see the appendix. Figure 10 This illustrates a code logic flowchart for sequentially rendering virtual objects in a scene viewport. In practical applications, based on... Figure 10 The pseudocode constructed from the code logic shown is as follows:

[0189] / / Initialize an ActorsToRender list to store the virtual objects (Actors) that need to be rendered.

[0190] ActorsToRender=new Array();

[0191] / / Iterate through all virtual objects in the scene viewport

[0192] for each RenderObject in OutRenderables;

[0193] / / Attempt to convert the virtual object from Actor type to AActor type

[0194] Actor=CastToActor(RenderObject.GetOwner());

[0195] if Actor is not null;

[0196] / / If the conversion is successful, add the virtual object to the ActorsToRender list.

[0197] ActorsToRender.Add(Actor);

[0198] / / Sort the virtual objects in the ActorsToRender list by depth (from farthest to nearest).

[0199] ActorsToRender.SortByDepth();

[0200] / / Retrieve virtual objects from the ActorsToRender list in the order they are listed.

[0201] for each Actor in ActorsToRender;

[0202] / / Get the rendering component of the virtual object

[0203] RenderComponent=CastToPrimitiveComponent(Actor.GetComponentByClas(PrimitiveComponentClass));

[0204] if RenderComponent is not null;

[0205] / / If a rendering component for the virtual object is found, then render according to the rendering component for the virtual object.

[0206] RenderComponent.RenderComponent(CommandList,ViewInformation);

[0207] As shown in the code above, for virtual objects within the scene viewport, their corresponding AActors can first be converted and added to the list to be rendered (i.e., ActorsToRender). Then, the AActors corresponding to each virtual object in the list to be rendered can be sorted in descending order of their z-values ​​(objects farther from the virtual camera have larger z-values), resulting in a processed list to be rendered. Next, according to the order of the AActors in the processed list to be rendered, the corresponding Components for each AActor are called to render each AActor, so that the virtual objects constructed from each AActor can be projected and transformed later.

[0208] S905 performs pixel rendering on each target virtual object to generate a rendered image corresponding to the virtual scene.

[0209] The aforementioned pixel rendering process includes a depth buffer; the depth buffer, also known as the Z-buffer, is a technique in computer graphics used for visibility detection. The depth buffer correctly handles occlusion relationships between objects, avoiding rendering jitter caused by incorrect overlap or occlusion.

[0210] The higher the precision of the depth values ​​that the depth buffer can store, the more data related to virtual objects it can store, and consequently, the less data related to virtual objects is lost. This results in better processing performance of the depth buffer and fewer rendering jitter issues.

[0211] Therefore, in this embodiment of the application, the number of bits of the depth value supported by the rendering engine can be increased to obtain the target number of bits. In this way, during the pixel rendering process of the target virtual object, if the total number of bits of the depth value of the rendered pixel is greater than the target number of bits, the data with a number of bits greater than the target number of bits in the depth value of the rendered pixel is discarded to obtain the processed depth value, and the processed depth value is stored with the target number of bits. If the total number of bits of the depth value of the rendered pixel is less than or equal to the target number of bits, the depth value of the rendered pixel is stored with the target number of bits.

[0212] Specifically, during the depth buffering stage of pixel rendering, data with a depth value exceeding the number of bits supported by the rendering engine is typically discarded. This discarding inevitably leads to the loss of relevant data for virtual objects (especially depth data), affecting the final rendering effect of the virtual objects and consequently the overall rendering effect of the virtual scene. This embodiment addresses this by increasing the number of bits supported by the rendering engine for storing depth values. This allows for the storage of depth values ​​with more bits (i.e., higher precision depth values) during the depth buffering stage of pixel rendering. This effectively reduces the data loss during the depth buffering stage, improving the final rendering effect of virtual objects and, consequently, the overall rendering effect of the virtual scene.

[0213] Optionally, since the pixel storage format configured in the rendering engine determines the number of bits of data for the depth values ​​that the rendering engine supports storing, the increase processing can specifically be to replace the original pixel storage format with a pixel storage format that has a larger corresponding number of bits.

[0214] The specific process of increasing the depth buffer precision parameters can include: obtaining the depth buffer precision parameters managed by the rendering subsystem used for resource management in the rendering engine; replacing the original pixel storage format of the depth buffer precision parameters with the target pixel storage format, and using the number of data bits supported by the target pixel storage format as the target data bit width; wherein the number of data bits supported by the target pixel storage format is greater than the number of data bits supported by the original pixel storage format.

[0215] Specifically, this embodiment replaces the original pixel storage format of the depth buffer precision parameter with the target pixel storage format that supports a larger number of data bits, which can easily and quickly increase the number of data bits of the depth value that the rendering engine can store. This method requires very low computing resources, which is conducive to optimizing the allocation of computing resources in the rendering engine, thereby improving the performance of the rendering engine, and thus improving the overall rendering effect of the virtual scene rendered by the rendering engine.

[0216] In practical applications, the default pixel storage format used in rendering engines such as UE is usually D24S8 (a pixel storage format that supports storing 24-bit floating-point numbers). During the storage process, operations such as rounding and floating-point conversion can cause some inherently different depth values ​​to be converted and stored as the same value, resulting in rendering jitter. Therefore, the pixel storage format corresponding to the rendering engine can be configured to PF DepthStencil 32F8 (a pixel storage format that supports storing 32-bit floating-point numbers).

[0217] For example, please see the appendix. Figure 11This illustrates a code logic flowchart for configuring pixel storage format, while the actual implementation is based on... Figure 11 The pseudocode constructed from the code logic shown can be as follows:

[0218] / / Get the current rendering subsystem RendererSubsystem

[0219] RendererSubsystem=GetEngineSubsystem(IRendererSubsystem)

[0220] / / Check if RendererSubsystem is valid

[0221] if RendererSubsystem is null:

[0222] throw Error("Renderer subsystem is not available")

[0223] / / Set the depth buffer format for mobile devices

[0224] RendererSubsystem.SetMobileDepthBufferFormat(PixelFormat.D32FS8)

[0225] / / Set the depth buffer format for the desktop.

[0226] RendererSubsystem.SetDefaultDepthBufferFormat(PixelFormat.D32FS8)

[0227] / / Output log information

[0228] Log("Depth buffer format set to D32FS8")

[0229] In the code above, the rendering subsystem RendererSubsystem in the rendering engine is obtained first; then, the depth buffer precision parameter is set from RendererSubsystem. Specifically, the depth buffer precision parameter for mobile devices (i.e., SetMobileDepthBufferFormat) and the depth buffer precision parameter for desktop devices (i.e., SetDefaultDepthBufferFormat) are both set to PF_DepthStencil_32F_8. At this point, the rendering engine supports storing 32 bits of data. This high-precision depth buffer can effectively reduce the probability of rendering jitter.

[0230] In summary, please refer to the appendix. Figure 12 This illustrates a schematic diagram of an optimized workflow to address rendering jitter issues. For example... Figure 12 As shown, the original process of obtaining the virtual object to be rendered in the initial rendering stage has been optimized by deploying steps such as obtaining viewport information of the scene viewport, obtaining virtual objects within the scene viewport, and drawing virtual objects from far to near. Specifically, as can be seen from the relevant pseudocode in step S403, the virtual objects within the scene viewport need to be determined based on information such as bounding boxes obtained from the viewport information. The specific implementation process of rendering from far to near can be found in step S904, and will not be elaborated here. Rendering virtual objects in the order from far to near in the field of view allows for layered rendering, preventing rendering jitter issues such as occlusion caused by rendering nearby objects first and then distant objects. This approach prevents rendering jitter from the initial rendering stage, reducing the probability of rendering jitter problems occurring.

[0231] Secondly, the NDC correction steps have been optimized and deployed in the original projection transformation process during mid-rendering. NDC correction refers to correcting the coordinate range corresponding to the NDC coordinate system to the depth value range that pixels should be mapped to during pixel rendering. This ensures that during projection transformation, the geometric points corresponding to virtual objects are mapped to the same coordinate range as the depth value range. Through the NDC correction step during mid-rendering, rendering jitter caused by secondary compression and mapping of depth values ​​can be effectively avoided during the depth buffer stage of pixel rendering, thus preventing rendering jitter problems even in mid-rendering and further reducing the probability of rendering jitter occurring.

[0232] Finally, in the original pixel rendering workflow during post-rendering, steps related to high-precision depth buffering were optimized. High-precision depth buffering refers to increasing the number of bits the rendering engine can store, allowing for the storage of more precise depth values. This post-rendering high-precision depth buffering effectively reduces depth loss, thus avoiding rendering jitter caused by depth loss. This prevents rendering jitter even in post-rendering, further reducing the probability of rendering jitter occurring.

[0233] For practical applications, please refer to the appendix. Figure 13 The image shows a rendering of an optimized solution. Compared to... Figure 2 The rendering jitter problem that occurs in the traditional solution shown is addressed by using a method based on... Figure 12 The optimized solution renders image 1301, eliminating rendering jitter issues such as cross-rendering.

[0234] Furthermore, when rendering using the traditional approach (i.e., the approach before optimization) and the optimized workflow approach (i.e., the approach after optimization), the power consumption and frame rate of different terminal devices are shown in Table 1 below:

[0235] Table 1

[0236]

[0237] As shown in Table 1, for rendering the same virtual scene, the optimized power consumption (i.e., the power consumption corresponding to rendering with the optimized scheme) of different terminal devices shows a very slight increase compared to the unoptimized power consumption (i.e., the power consumption corresponding to rendering with the unoptimized scheme); however, the optimized frame rate (i.e., the frame rate corresponding to rendering with the optimized scheme) of different terminal devices remains essentially unchanged compared to the unoptimized frame rate (i.e., the frame rate corresponding to rendering with the unoptimized scheme). This demonstrates that the optimized scheme does not consume more computing resources or affect the operating performance of the terminal devices.

[0238] It is clear that the optimization measures for rendering jitter in the three stages of rendering—initial, mid, and post-rendering—can effectively avoid rendering jitter while ensuring device performance, achieving better rendering results. Furthermore, compared to existing solutions that require manual optimization and repair of rendering jitter, the optimizations in this embodiment are entirely automated, eliminating the need for manual inspection and repair, thus significantly improving overall R&D efficiency.

[0239] In this embodiment, by assigning the coordinate range to which geometric points transformed into the normalized device coordinate system should be mapped as a depth value range, the coordinate values ​​of virtual objects can be mapped to the depth value range required for pixel rendering during the projection transformation process. This automatically avoids rendering jitter caused by secondary compression mapping of depth values ​​during pixel rendering without manual intervention, thus improving rendering quality. Furthermore, this embodiment renders the virtual scene at the scene viewport level. By rendering only virtual objects within the scene viewport, the final visual effect presented to the player is guaranteed while avoiding wasting computational resources rendering invisible areas of the virtual scene. This optimized scheduling of computational resources improves the performance stability of the terminal device, enhancing the player's perceptual experience of the virtual scene in terms of visual appeal and smoothness.

[0240] Based on the description of the virtual scene rendering method above, this application also discloses a virtual scene rendering apparatus. This virtual scene rendering apparatus can be a computer program (including program code) running on the aforementioned computer device. The virtual scene rendering apparatus can execute, for example... Figure 4 and Figure 9 For the rendering method of the virtual scene shown, please refer to [link / reference]. Figure 14 The rendering apparatus for the virtual scene may include at least: an acquisition unit 1401, a calling unit 1402, a processing unit 1403, and a pixel rendering unit 1404, wherein:

[0241] Acquisition unit 1401 is used to acquire version information of the rendering engine used to render the virtual scene;

[0242] Calling unit 1402 is used to call the projection transformation method that matches the version information, obtain the depth value range to which the pixel should be mapped during the pixel rendering process, and assign the coordinate range to which the geometric point of the projection transformation to the normalized device coordinate system should be mapped to the depth value range.

[0243] Processing unit 1403 is used to project and transform the geometric points corresponding to the virtual object to be rendered in the virtual scene into the coordinate range to obtain the target virtual object located in the normalized device coordinate system.

[0244] The pixel rendering unit 1404 is used to perform pixel rendering on the target virtual object and generate a rendered image corresponding to the virtual scene.

[0245] In one implementation, before projecting and transforming the geometric points corresponding to the virtual objects to be rendered in the virtual scene into the coordinate range to obtain the target virtual object located in the normalized device coordinate system, the processing unit 1403 may further be used to perform: determining the scene viewport of the virtual scene based on the relative positional relationship between the virtual camera and the virtual scene; determining the virtual objects in the scene viewport based on the bounding box of the scene viewport and the virtual objects in the virtual scene, and using the virtual objects in the scene viewport as the virtual objects to be rendered.

[0246] In another implementation, the virtual objects in the scene viewport include multiple virtual objects; when the processing unit 1403 projects and transforms the geometric points corresponding to the virtual objects to be rendered in the virtual scene into the coordinate range to obtain the target virtual objects located in the normalized device coordinate system, it can specifically perform the following: obtain the distance between each virtual object in the scene viewport and the virtual camera; according to the distances corresponding to the multiple virtual objects in the scene viewport, sequentially project and transform the geometric points corresponding to the multiple virtual objects in the scene viewport into the coordinate range to obtain multiple target virtual objects located in the normalized device coordinate system.

[0247] In another embodiment, when the processing unit 1403 sequentially projects and transforms the geometric points corresponding to the multiple virtual objects in the scene viewport into the coordinate range according to the distances corresponding to the multiple virtual objects in the scene viewport, to obtain multiple target virtual objects located in the normalized device coordinate system, it can also be used to perform the following: write the virtual object with the largest corresponding distance among the multiple virtual objects into the list to be rendered; select the virtual object with the largest corresponding distance from the remaining virtual objects and write it into the list to be rendered, and repeat the step of selecting the virtual object with the largest corresponding distance from the remaining virtual objects and writing it into the list to be rendered until all the virtual objects are written into the list to be rendered; select virtual objects sequentially from the list to be rendered according to the writing order of each virtual object in the list to be rendered, and project and transform the geometric points corresponding to the selected virtual objects into the coordinate range to obtain multiple target virtual objects located in the normalized device coordinate system.

[0248] In another implementation, the virtual objects in the virtual scene include multiple virtual objects. When the processing unit 1403 determines the virtual objects in the scene viewport based on the bounding box of the scene viewport and the virtual objects in the virtual scene, it can specifically perform the following: obtain the bounding box of the scene viewport; traverse the virtual objects in the virtual scene and obtain the bounding box corresponding to the currently traversed virtual object; if the obtained bounding box intersects with the bounding box of the scene viewport, then determine the currently traversed virtual object as the virtual object in the scene viewport, and traverse the next virtual object in the virtual scene until all the virtual objects in the virtual scene have been traversed.

[0249] In another embodiment, when the processing unit 1403 obtains the bounding box of the scene viewport, it may specifically perform the following: constructing a viewport structure of the scene viewport based on the pitch and yaw angles of the virtual camera relative to the virtual scene and the viewport matrix of the scene viewport; obtaining the viewport size of the scene viewport and initializing the viewport structure based on the viewport size to obtain the initialized viewport structure; obtaining the viewport information of the initialized viewport structure and obtaining the bounding box of the scene viewport from the viewport information.

[0250] In another implementation, the version information includes a major version identifier and a minor version identifier. When calling the projection transformation method that matches the version information to obtain the depth value range to which the pixel should be mapped during pixel rendering, the calling unit 1402 can specifically perform the following: if the major version identifier is less than a first value, or the major version identifier is equal to the first value and the minor version identifier is less than a second value, then a detection result is obtained to characterize that the version of the rendering engine is lower than a preset version; based on the detection result, the projection transformation method that matches the version information is called to obtain the depth value range to which the pixel should be mapped during pixel rendering.

[0251] In another embodiment, the pixel rendering unit 1404 can also be used to perform: increasing the number of bits of the depth value stored by the rendering engine to obtain a target number of bits; during the pixel rendering of the target virtual object, if the total number of bits of the depth value of the rendered pixel is greater than the target number of bits, then the data in the depth value of the rendered pixel that has more bits than the target number of bits is discarded to obtain a processed depth value, and the processed depth value is stored with the target number of bits; if the total number of bits of the depth value of the rendered pixel is less than or equal to the target number of bits, then the depth value of the rendered pixel is stored with the target number of bits.

[0252] In another embodiment, based on the aforementioned scheme, when the pixel rendering unit 1404 increases the number of bits of the depth value that the rendering engine supports storing to obtain the target number of bits, it can specifically perform the following: obtain the depth buffer precision parameter managed by the rendering subsystem for resource management in the rendering engine; replace the original pixel storage format of the depth buffer precision parameter with the target pixel storage format, and use the number of bits of data that the target pixel storage format supports storing as the target number of bits; wherein, the number of bits of data that the target pixel storage format supports storing is greater than the number of bits of data that the original pixel storage format supports storing.

[0253] According to one embodiment of this application, Figure 4 and Figure 9 The steps involved in the method shown can be derived from... Figure 14 The rendering of the virtual scene shown is performed by individual units within the rendering device. For example, Figure 6 The step S601 shown can be performed by Figure 14 The acquisition unit 1401 in the rendering device of the virtual scene shown is used to execute the step; step S602 can be performed by... Figure 14 The rendering device of the virtual scene shown is used to execute the calling unit 1402; steps S603 to S604 can be performed by... Figure 14 The processing unit 1403 in the rendering device of the virtual scene shown is responsible for executing step S605; step S605 can be performed by... Figure 14 The pixel rendering unit 1404 in the rendering device of the virtual scene shown is used to perform the rendering.

[0254] According to another embodiment of this application, Figure 14 The units in the virtual scene rendering apparatus shown are divided based on logical functions. These units can be individually or entirely merged into one or more other units, or some of these units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. In other embodiments of this application, the virtual scene-based rendering apparatus may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and multiple units can collaborate to achieve them.

[0255] According to another embodiment of this application, a general-purpose computing device, such as a computer device, including processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), can be used to run an application capable of performing tasks such as... Figure 4 or Figure 14 The computer program (including program code) involved in each step of the method shown is used to construct, for example... Figure 9 The present invention describes a rendering apparatus for a virtual scene and a rendering method for implementing the embodiments of the present application. A computer program may be recorded on, for example, a computer storage medium, loaded onto the aforementioned computer device via the computer storage medium, and run therein.

[0256] In this embodiment, by assigning the coordinate range to which geometric points should be mapped to the normalized device coordinate system during projection transformation to the depth value range, the coordinate values ​​of virtual objects can be mapped to the depth value range required for pixel rendering during the projection transformation process. Furthermore, the coordinate mapping of geometric points during projection transformation is proportional, unlike pixel rendering which crudely processes negative numbers to the same value, leading to information loss in virtual objects and rendering jitter, thus affecting the overall rendering effect of the virtual scene. Therefore, this solution automatically avoids the rendering jitter problem caused by secondary compression mapping of depth values ​​during pixel rendering without manual intervention, which is beneficial for improving rendering effects.

[0257] Based on the above method and apparatus embodiments, this application also provides an electronic device. See also Figure 15 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 15 The electronic device shown may include at least a processor 1501, an input interface 1502, an output interface 1503, and a computer storage medium 1504. The processor 1501, input interface 1502, output interface 1503, and computer storage medium 1504 may be connected via a bus or other means.

[0258] Computer storage medium 1504 can be stored in the memory of electronic device. Computer storage medium 1504 is used to store computer programs, which include program instructions. Processor 1501 is used to execute the program instructions stored in computer storage medium 1504. Processor 1501 (or CPU (Central Processing Unit)) is the computing and control core of electronic device. It is suitable for implementing one or more instructions, specifically for loading and executing one or more instructions to realize the rendering method flow or corresponding functions of the above-mentioned virtual scene.

[0259] This application embodiment also provides a computer storage medium (Memory), which is a memory device in an electronic device used to store programs and data. It is understood that the computer storage medium here can include the built-in storage medium in a terminal, or it can include an extended storage medium supported by the terminal. The computer storage medium provides storage space, which stores the terminal's operating system. Furthermore, the storage space also stores one or more instructions suitable for loading and execution by the processor 1501. These instructions can be one or more computer programs (including program code). It should be noted that the computer storage medium here can be a high-speed random access memory (RAM), or it can be non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer storage medium located remotely from the aforementioned processor.

[0260] In one embodiment, processor 1501 may load and execute one or more instructions stored in computer storage medium to implement the aforementioned related... Figure 4 and Figure 9 In the corresponding steps of the method embodiment for rendering a virtual scene, in a specific implementation, one or more instructions in the computer storage medium are loaded and executed by the processor 1501, such as... Figure 4 and Figure 9 The steps in the embodiment of the virtual scene rendering method shown.

[0261] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the aforementioned actions. Figure 4 and Figure 9 The method embodiment shown. The computer-readable storage medium may be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0262] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims. Furthermore, this application does not limit the execution order of the various steps in the specific embodiments.

Claims

1. A method for rendering a virtual scene, characterized in that, The method includes: Get the version information of the rendering engine used to render the virtual scene; Invoke the projection transformation method that matches the version information, obtain the depth value range to which the pixel should be mapped during the pixel rendering process, and assign the coordinate range to which the geometric point of the projection transformation to the normalized device coordinate system should be mapped to the depth value range. The geometric points corresponding to the virtual object to be rendered in the virtual scene are projected and transformed into the coordinate interval to obtain the target virtual object located in the normalized device coordinate system. The target virtual object is rendered pixel by pixel to generate a rendered image corresponding to the virtual scene.

2. The method according to claim 1, characterized in that, Before projecting and transforming the geometric points corresponding to the virtual object to be rendered in the virtual scene into the coordinate interval to obtain the target virtual object located in the normalized device coordinate system, the method further includes: The scene viewport of the virtual scene is determined based on the relative positional relationship between the virtual camera and the virtual scene; Based on the bounding box of the scene viewport and the virtual objects in the virtual scene, the virtual objects in the scene viewport are determined, and the virtual objects in the scene viewport are used as the virtual objects to be rendered.

3. The method according to claim 2, characterized in that, The virtual objects in the scene viewport include multiple objects; the step of projecting and transforming the geometric points corresponding to the virtual objects to be rendered in the virtual scene to the coordinate interval to obtain the target virtual object located in the normalized device coordinate system includes: Obtain the distance between each virtual object in the scene viewport and the virtual camera; Based on the distances corresponding to multiple virtual objects in the scene viewport, the geometric points corresponding to the multiple virtual objects in the scene viewport are sequentially projected and transformed into the coordinate interval to obtain multiple target virtual objects located in the normalized device coordinate system.

4. The method according to claim 3, characterized in that, The step of sequentially projecting and transforming the geometric points corresponding to the multiple virtual objects in the scene viewport to the coordinate interval based on the distances corresponding to the multiple virtual objects in the scene viewport, to obtain multiple target virtual objects located in the normalized device coordinate system, includes: Write the virtual object with the largest corresponding distance from the plurality of virtual objects into the list to be rendered; Select the virtual object with the largest corresponding distance from the remaining virtual objects and write it into the list to be rendered. Repeat the step of selecting the virtual object with the largest corresponding distance from the remaining virtual objects and writing it into the list to be rendered until all the virtual objects are written into the list to be rendered. According to the writing order of each virtual object in the list to be rendered, virtual objects are selected sequentially from the list to be rendered, and the geometric points corresponding to the selected virtual objects are projected and transformed into the coordinate range to obtain multiple target virtual objects located in the normalized device coordinate system.

5. The method according to claim 2, characterized in that, The virtual objects in the virtual scene include multiple virtual objects; determining the virtual objects in the scene viewport based on the bounding box of the scene viewport and the virtual objects in the virtual scene includes: Obtain the bounding box of the scene viewport; Traverse the virtual objects in the virtual scene and obtain the bounding box corresponding to the currently traversed virtual object; If the obtained bounding box intersects with the bounding box of the scene viewport, the currently traversed virtual object is determined as a virtual object in the scene viewport, and the next virtual object in the virtual scene is traversed until all virtual objects in the virtual scene have been traversed.

6. The method according to claim 5, characterized in that, The step of obtaining the bounding box of the scene viewport includes: Based on the pitch and yaw angles of the virtual camera relative to the virtual scene, and the viewport matrix of the scene viewport, construct the viewport structure of the scene viewport; Obtain the viewport size of the scene viewport, and initialize the viewport structure based on the viewport size to obtain the initialized viewport structure; Obtain the viewport information of the initialized viewport structure, and obtain the bounding box of the scene viewport from the viewport information.

7. The method according to claim 1, characterized in that, The version information includes a major version identifier and a minor version identifier; the step of calling a projection transformation method matching the version information to obtain the depth value range to which the pixel should be mapped during pixel rendering includes: If the major version identifier is less than the first value, or the major version identifier is equal to the first value and the minor version identifier is less than the second value, then a detection result is obtained to characterize that the version of the rendering engine is lower than the preset version. Based on the detection results, a projection transformation method matching the version information is invoked to obtain the depth value range to which the pixel should be mapped during the pixel rendering process.

8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: The number of bits for the depth values ​​that the rendering engine can store is increased to obtain the target number of bits. During the pixel rendering process of the target virtual object, if the total number of bits of the depth value of the rendered pixel is greater than the target number of bits, then the data with a number of bits greater than the target number of bits in the depth value of the rendered pixel is discarded to obtain the processed depth value, and the processed depth value is stored with the target number of bits. If the total number of bits of the depth value of the rendered pixel is less than or equal to the target number of bits, then the depth value of the rendered pixel is stored using the target number of bits.

9. The method according to claim 8, characterized in that, The step of increasing the number of bits of the depth values ​​that the rendering engine can store to obtain the target number of bits includes: Obtain the depth buffer precision parameters managed by the rendering subsystem used for resource management in the rendering engine; The original pixel storage format of the depth buffer precision parameter is replaced with the target pixel storage format, and the number of data bits that the target pixel storage format supports is used as the target data bits; wherein, the number of data bits that the target pixel storage format supports is greater than the number of data bits that the original pixel storage format supports.

10. A rendering device for a virtual scene, characterized in that, The device includes an acquisition unit, a calling unit, a processing unit, and a pixel rendering unit, wherein: The acquisition unit is used to acquire version information of the rendering engine used to render the virtual scene; The calling unit is used to call the projection transformation method that matches the version information, obtain the depth value range to which the pixel should be mapped during the pixel rendering process, and assign the coordinate range to which the geometric point of the projection transformation to the normalized device coordinate system should be mapped to the depth value range. The processing unit is used to project and transform the geometric points corresponding to the virtual object to be rendered in the virtual scene into the coordinate interval to obtain the target virtual object located in the normalized device coordinate system. The pixel rendering unit is used to perform pixel rendering on the target virtual object to generate a rendered image corresponding to the virtual scene.

11. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the rendering method of the virtual scene as described in any one of claims 1 to 9.

12. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the rendering method of the virtual scene as described in any one of claims 1 to 9.

13. A computer program product, characterized in that, The computer program product includes a computer program adapted to be loaded by a processor and executed as a rendering method for a virtual scene as described in any one of claims 1 to 9.