Image rendering method and device, electronic equipment and storage medium

By calculating the distance between the image acquisition device and the object to be rendered and the pixel proportion of the rendered picture, the video memory loading is optimized, and the problem of degradation in large industrial scenarios is solved, achieving more efficient rendering loading and performance improvement.

CN119444953APending Publication Date: 2025-02-14CISDI ENGINEERING CO LTD +1
View PDF 0 Cites 8 Cited by

Patent Information

Application Number
CN202411584359.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In large-scale industrial scenarios, especially in the field of steel and metallurgy, the existing technology is difficult to effectively manage video memory resources, resulting in a decline in rendering performance and unable to meet the needs of large-scale scene rendering.

Method used

By calculating the distance between the virtual image acquisition device and the object to be rendered, the image distance is determined as the first loading factor, and the pixel proportion of the rendered picture is determined as the second loading factor based on the preset cone size information, and the rendering loading priority is generated Sequence and determine model-level resource files and texture-level resource files to optimize memory loading.

Benefits of technology

It improves the immediacy and immersion of the rendering loading process, avoids waste of video memory resources, reduces video memory usage and CPU/GPU burden, and improves the overall rendering performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444953A_ABST
    Figure CN119444953A_ABST
Patent Text Reader

Abstract

The invention provides an image rendering method and device, electronic equipment and a storage medium, and the method comprises the steps: calculating a distance between a virtual image obtaining device and a to-be-rendered object through determining the to-be-rendered object in a to-be-rendered scene, and determining the distance as a first loading factor; determining a rendering picture pixel proportion of each to-be-rendered object based on preset view cone size information, determining the rendering picture pixel proportion as a second loading factor, generating a rendering loading priority sequence according to the first loading factor, and determining a model level resource file and a texture level resource file according to the second loading factor, loading the resources to a video memory for rendering according to the sequence; the priority is determined by calculating the distance between the camera and the to-be-rendered object, it is ensured that a high-quality model and texture of a close-range object are loaded preferentially, the instantaneity of the rendering loading process is improved, texture and model grade division is conducted through the pixel proportion of the to-be-rendered object in the picture, and the rendering efficiency is improved. The occupation of a video memory is reduced, and the overall rendering performance of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to an image rendering method, device, electronic device and storage medium. Background Art

[0002] Rendering resources include data and assets such as 3D models and texture materials required to generate the final image frame. Models are digital reproductions of the geometric form of real or fictional objects, interwoven with vertices, edges, and polygonal patches, used to build physical structures in virtual scenes. Textures are 2D images covering the surface of 3D models, designed to enhance the visual sense of reality. Common texture types include: normal textures that simulate the bumps and undulations of surfaces, diffuse textures that represent the color and roughness characteristics of the surface of objects, and environmental textures that depict the sky or distant backgrounds. By matching and using various textures, diverse and realistic visual scenes can be created. Model and texture data are usually stored in hard disks or solid-state drives. When applications are executed, these data must be loaded from the hard disk to the system memory and graphics processor memory.

[0003] In large-scale industrial scenes, especially in the field of iron and steel metallurgy, a factory covering the entire chain of steel production often includes multiple subsystems such as raw material preparation areas, ironmaking facilities, steelmaking workshops, continuous casting production lines, and steel rolling processes. Given the different working environments of each subsystem, a large number of different types of models and texture data need to be called. In such rendering tasks, under the condition of limited existing video memory resources, the current rendering process management of large-scale rendering resource loading processes cannot support effective rendering progress, which is reflected in the low utilization efficiency of video memory, which in turn leads to a decline in rendering performance and cannot meet the large-scale scene rendering management in industry. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide an image rendering method, device, electronic device and storage medium to solve the above technical problems.

[0005] The present invention provides an image rendering method, which includes: in response to an image rendering request, determining an object to be rendered in a scene to be rendered, and acquiring position information of a virtual image acquisition device, wherein the scene to be rendered includes at least one object to be rendered; calculating the distance between the virtual image acquisition device and each object to be rendered, obtaining an image distance of each object to be rendered, and determining the image distance as a first loading factor; determining a pixel ratio of a rendering screen of each object to be rendered based on preset view frustum size information and position information of the virtual image acquisition device, and determining the pixel ratio of the rendering screen as a second loading factor; generating a rendering loading priority sequence according to the first loading factor, and determining a model level resource file and a texture level resource file corresponding to each object to be rendered according to the second loading factor; loading the model level resource file and the texture level resource file into a video memory according to the loading priority sequence, so as to render the object to be rendered in the scene to be rendered.

[0006] In one embodiment of the present invention, before responding to an image rendering request, the image rendering method also includes: obtaining an original model data file and an original texture data file; compressing the original model data file and the original texture data file respectively to obtain an initial model data file and an initial texture data file; creating a level detail version of the initial model data file based on a mesh simplification algorithm to obtain a plurality of model level resource files with different static level details; creating a resolution version of the initial texture data file based on a texture mapping method to obtain a plurality of texture level resource files with different rendering resolutions.

[0007] In one embodiment of the present invention, determining the objects to be rendered in the scene to be rendered includes: performing model proxies on the initial rendering objects in the scene to be rendered, and pre-rendering the scene to be rendered according to the proxy models to obtain an initial pre-rendering scene; performing a culling operation on invisible models in the initial pre-rendering scene according to position information of a virtual image acquisition device to obtain a calculated pre-rendering scene, and determining the initial rendering objects corresponding to the remaining proxy models in the scene to be rendered as the objects to be rendered, wherein the invisible models include proxy models outside the field of view and proxy models completely blocked by other proxy models.

[0008] In one embodiment of the present invention, calculating the distance between the virtual image acquisition device and each object to be rendered includes: calculating the distance between the virtual image acquisition device and each remaining proxy model in the pre-rendering scene to obtain the proxy image distance of each proxy model; and determining the proxy image distance of each remaining proxy model as the image distance of each corresponding object to be rendered.

[0009] In one embodiment of the present invention, after the proxy image distance of each remaining proxy model is determined as the image distance of each corresponding object to be rendered, the image rendering method further includes: recording all model data indexes and texture data indexes required for rendering in the current image; sorting all model data indexes and texture data indexes based on the bitonal sorting method, and performing a deduplication operation to obtain a current rendering model data index and a current rendering texture data index.

[0010] In one embodiment of the present invention, determining the model level resource files and texture level resource files corresponding to each object to be rendered according to the second loading factor includes: determining a preset division threshold interval hit by each second loading factor; determining the corresponding model level resource information and texture level resource information according to the preset division threshold interval hit by each second loading factor; calling the model level resource file in the current rendering model data index according to the model level resource information, and calling the texture level resource file in the current rendering texture data index according to the texture level resource information, to obtain the model level resource files and texture level resource files corresponding to each object to be rendered.

[0011] In one embodiment of the present invention, generating a rendering loading priority sequence based on the first loading factor includes: performing binary value conversion on each of the first loading factors to obtain multiple base-converted values; sorting each of the base-converted values ​​based on a radix sorting method to obtain a base-converted value queue, and replacing the base-converted values ​​in the base-converted value queue with the corresponding first loading factor to obtain a rendering loading priority sequence.

[0012] An embodiment of the present invention also provides an image rendering device, which includes: a rendering object determination module, which is used to determine the objects to be rendered in the scene to be rendered in response to an image rendering request, and obtain the position information of the virtual image acquisition device, wherein the scene to be rendered includes at least one object to be rendered; a rendering factor determination module, which is used to calculate the distance between the virtual image acquisition device and each object to be rendered, obtain the image distance of each object to be rendered, and determine the image distance as a first loading factor; determine the rendering screen pixel ratio of each object to be rendered based on preset frustum size information and the position information of the virtual image acquisition device, and determine the rendering screen pixel ratio as a second loading factor; a rendering resource loading module, which is used to generate a rendering loading priority sequence according to the first loading factor, and determine the model level resource file and texture level resource file corresponding to each object to be rendered according to the second loading factor; load the model level resource file and the texture level resource file into the video memory according to the loading priority sequence to render the objects to be rendered in the scene to be rendered.

[0013] An embodiment of the present invention also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements an image rendering method as described in any one of the above embodiments.

[0014] An embodiment of the present invention further provides a computer-readable storage medium on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the image rendering method as described in any one of the above embodiments.

[0015] The present invention provides an image rendering method, device, electronic device and storage medium, which determines the object to be rendered in the scene to be rendered, calculates the distance between the virtual image acquisition device and the object to be rendered and determines it as a first loading factor, determines the pixel ratio of the rendering screen of each object to be rendered based on the preset frustum size information and determines it as a second loading factor, generates a rendering loading priority sequence according to the first loading factor, and determines the model level resource file and the texture level resource file according to the second loading factor, so as to load the resources into the video memory in sequence for rendering; the present application determines the image distance of each object by calculating the distance between the camera and the object to be rendered, and the smaller the image distance value, the higher the priority. High, priority loading ensures that high-resolution models and high-quality textures of close objects are loaded into the video memory first, improving the immediacy and immersion of the rendering loading process. By calculating the pixel ratio of each object to be rendered in the final rendering picture, the larger the pixel ratio, the higher the level of video memory resources allocated to the model and texture loading of these objects, avoiding the waste of video memory resources, not only reducing the usage of video memory, but also reducing the burden on the CPU and GPU, and improving the overall rendering performance of the system. Furthermore, in the real-time rendering process, when the perspective is moved or approaching an object, the system can quickly adjust the loading strategy, provide higher resolution details in time, and enhance the user's interactive experience.

[0016] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0018] Figure 1 is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application;

[0019] Figure 2 is a flowchart of an image rendering method shown in an exemplary embodiment of the present application;

[0020] Figure 3 is a flowchart of a specific image rendering method shown in an exemplary embodiment of the present application;

[0021] Figure 4 is a specific rendering resource screening flow chart shown in an exemplary embodiment of the present application;

[0022] Figure 5 is a schematic diagram of an image rendering device shown in an exemplary embodiment of the present application;

[0023] Figure 6 It is a structural diagram of a computer system of an electronic device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will describe the embodiments of the present invention with reference to the accompanying drawings and specific embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.

[0025] It should be noted that the illustrations provided in the following embodiments are only used to illustrate the basic concept of the present invention in a schematic manner, and thus the illustrations only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0026] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0027] The "and / or" mentioned in this application describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0028] Figure 1 It is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application.

[0029] Reference Figure 1 As shown, the system architecture may include a scene file to be rendered 110 and a computer device 120. The computer device 120 determines the objects to be rendered in the scene to be rendered in the scene file to be rendered 110 in response to an image rendering request, and obtains the position information of the virtual image acquisition device, wherein the scene to be rendered includes at least one object to be rendered; the computer device 120 calculates the distance between the virtual image acquisition device and each object to be rendered, obtains the image distance of each object to be rendered, and determines the image distance as a first loading factor; the computer device 120 determines the pixel ratio of the rendering screen of each object to be rendered based on the preset frustum size information and the position information of the virtual image acquisition device, and determines the pixel ratio of the rendering screen as a second loading factor; generates a rendering loading priority sequence according to the first loading factor, and determines the model level resource file and the texture level resource file corresponding to each object to be rendered according to the second loading factor; the computer device 120 loads the model level resource file and the texture level resource file into the video memory according to the loading priority sequence, so as to render the objects to be rendered in the scene to be rendered. The computer device 120 may be at least one of a microcomputer, an embedded computer, a network computer, an industrial computer, etc. The scene file to be rendered 110 includes scene information to be rendered and file content.

[0030] Illustratively, the computer device 120 determines the objects to be rendered in the scene to be rendered in the scene file 110 to be rendered in response to an image rendering request, and obtains the position information of the virtual image acquisition device, wherein the scene to be rendered includes at least one object to be rendered; the computer device 120 calculates the distance between the virtual image acquisition device and each object to be rendered, obtains the image distance of each object to be rendered, and determines the image distance as a first loading factor; the computer device 120 determines the pixel ratio of the rendering screen of each object to be rendered based on the preset view frustum size information and the position information of the virtual image acquisition device, and determines the pixel ratio of the rendering screen as a second loading factor; generates a rendering loading priority sequence according to the first loading factor, and determines the model level resource files and texture level resource files corresponding to each object to be rendered according to the second loading factor; the computer device 120 loads the model level resource files and texture level resource files according to the loading priority sequence. The level resource file is loaded into the video memory to render the objects to be rendered in the rendering scene; the application determines the image distance of each object by calculating the distance between the camera and the object to be rendered. The smaller the image distance value, the higher the priority, and the loading is given priority, ensuring that the high-resolution model and high-quality texture of the close object are loaded into the video memory first, improving the immediacy and immersion of the rendering loading process, and by calculating the pixel ratio of each object to be rendered in the final rendering picture, the larger the pixel ratio, the higher the level of video memory resources are allocated to the model and texture loading of these objects, avoiding the waste of video memory resources, not only reducing the occupancy of video memory, but also reducing the burden on the CPU and GPU, and improving the overall rendering performance of the system. Furthermore, in the real-time rendering process, when the perspective is moved or approaching an object, the system can quickly adjust the loading strategy, provide higher resolution details in a timely manner, and enhance the user's interactive experience.

[0031] Figure 2 is a flowchart of an image rendering method shown in an exemplary embodiment of the present application. The image rendering method can be Figure 1 The implementation environment may be implemented in other implementation environments, and the above implementation environments are not specifically limited here. Figure 2 As shown, the flowchart of the image rendering method includes at least steps S210 to S250, which are described in detail as follows:

[0032] In step S210 , in response to an image rendering request, an object to be rendered in a scene to be rendered is determined, and position information of a virtual image acquisition device is acquired.

[0033] In one embodiment of the present application, the above-mentioned scene to be rendered includes at least one object to be rendered. For example, the scene to be rendered is a steel production plant, which contains multiple sub-scenes, including a raw material yard, an ironmaking workshop, a steelmaking workshop, a continuous casting workshop, a rolling mill workshop, etc., then the equipment, devices, raw materials and other elements included therein are all rendering objects under the sub-scene.

[0034] In one embodiment of the present application, before responding to an image rendering request, an original model data file and an original texture data file are obtained, and the original model data file and the original texture data file are compressed respectively to obtain an initial model data file and an initial texture data file, and a level detail version is created for the initial model data file based on a mesh simplification algorithm to obtain a plurality of model level resource files with different static level details, and a resolution version is created for the initial texture data file based on a texture mapping method to obtain a plurality of texture level resource files with different rendering resolutions.

[0035] The original model data file and the original texture data file can be obtained by reading from a local hard disk or downloading from the cloud. In the embodiment of the present application, an exemplary example is given of obtaining resource files from a hard disk.

[0036] The compression process of the original model data file to obtain the initial model data file includes optimizing the floating point precision for the original model data file in the hard disk, using 16-bit or 8-bit integers instead of 32-bit floating point numbers to reduce the storage space required for each vertex; avoiding repeated storage of vertex data by indexing shared vertices; and using a compression algorithm based on entropy coding to encode the index data according to its frequency of occurrence to further reduce the amount of data. Indexing shared vertices is a technology for optimizing graphics rendering, mainly used to reduce vertex data redundancy and improve rendering efficiency. In three-dimensional models, especially for mesh models, many vertices are shared by multiple faces. Under normal conditions, each face needs to store vertex information separately, resulting in a large amount of data redundancy, increasing memory usage and transmission overhead. Indexing shared vertex technology solves this problem by creating a vertex list and an index list.

[0037] A specific implementation method of compressing the original texture data file to obtain the initial texture data file includes: for the original texture data file in the hard disk, using the DXT (S3TC) format for compression, splitting the texture into 4x4 pixel blocks, using two 16-bit data to represent the extreme color in the pixel block, and then using 16 2-bit data to represent the color index, thereby compressing the 256-bit 4x4 pixel block to 64 bits, with a compression ratio of 6. DXT (also known as S3 TextureCompression, S3TC for short) is a format specifically used for compressing texture images, and is widely used in real-time three-dimensional graphics rendering. The main purpose of the DXT format is to significantly reduce the storage space requirements and transmission bandwidth consumption of texture data while maintaining good image quality, thereby improving rendering performance and efficiency.

[0038] In the implementable environment of the present application, three LOD versions of high polygon, medium polygon and low polygon are created for the model in a static level of detail (LOD) manner through a mesh simplification algorithm. The model close to the camera uses the high polygon version, and the model far away uses the low polygon version. Static level of detail (LOD) is a commonly used optimization technique for balancing visual quality and performance in three-dimensional graphics rendering. By preparing different levels of detail versions of the same object in advance, LOD allows the appropriate model version to be automatically selected for rendering based on the distance between the object and the observer or other factors, which helps to reduce unnecessary calculations and memory usage while maintaining good visual effects.

[0039] In the implementable environment of the present application, resolution versions are created for the initial texture data file based on the texture mapping method. Specifically, the texture mapping Mipmap technology is used to create high, medium and low resolution versions for the texture image, and each version is halved in length and width compared to the previous version.

[0040] In one embodiment of the present application, determining the objects to be rendered in the scene to be rendered includes performing model proxies on the initial rendering objects in the scene to be rendered, and pre-rendering the scene to be rendered according to the proxy models to obtain an initial pre-rendering scene; performing a culling operation on invisible models in the initial pre-rendering scene according to position information of a virtual image acquisition device to obtain a calculated pre-rendering scene, and determining the initial rendering objects corresponding to the remaining proxy models in the scene to be rendered as the objects to be rendered, wherein the invisible models include proxy models outside the field of view and proxy models completely obscured by other proxy models.

[0041] In one embodiment of the present application, an axis-aligned bounding box is created for the model, and the bounding box is used as a proxy model to pre-render the rendering scene.

[0042] Among them, the invisible models in the initial pre-rendering scene are culled according to the position information of the virtual image acquisition device, including culling the proxy models outside the field of view through the frustum culling algorithm; and then using the Early-Z algorithm to determine the occlusion of the model in the frustum, and culling the proxy models that are completely occluded by other proxy models. The frustum culling algorithm is a commonly used optimization technology for improving the efficiency of three-dimensional graphics rendering. It determines whether the objects in the scene are within the visible area of ​​the camera, that is, the camera's view frustum, before rendering. If an object is completely outside the view frustum, it can be determined that it will not appear in the final picture, so it does not need to be further processed or rendered, thereby saving computing resources. The Early-Z algorithm is a technology for optimizing depth testing in the three-dimensional graphics rendering process. The goal is to discard invisible pixels before the pixel shading stage, thereby reducing unnecessary calculations and improving rendering efficiency. Its working principle includes but is not limited to vertex shading, rasterization, fragment shading, depth testing and other steps.

[0043] In step S220, the distance between the virtual image acquisition device and each object to be rendered is calculated to obtain the image distance of each object to be rendered, and the image distance is determined as the first loading factor.

[0044] In one embodiment of the present application, in calculating the pre-rendering scene, the distance between the virtual image acquisition device and each remaining proxy model is calculated respectively to obtain the proxy image distance of each proxy model, and the proxy image distance of each remaining proxy model is determined as the image distance of each corresponding object to be rendered.

[0045] Specifically, in the calculation shader, the distance between the axis-aligned bounding box of each remaining proxy model and the virtual image acquisition device is calculated, and all model data indexes and texture data indexes required for rendering in the current image are recorded.

[0046] In one embodiment of the present application, after obtaining the image distance of each object to be rendered, it also includes recording all model data indexes and texture data indexes required for rendering in the current image, sorting all model data indexes and texture data indexes based on the bitonal sorting method, and performing a deduplication operation to obtain the current rendering model data index and the current rendering texture data index.

[0047] In one embodiment of the present application, since there is a large amount of duplicate data in the index and the range of index values ​​is wide, a resource index sorting module is used, and the index is efficiently sorted using a bitonic sorting algorithm, and then a deduplication operation is performed to optimize data processing efficiency and reduce storage space usage. Since bitonic sorting is a sorting method that is independent of the initial order of the data, it is suitable for parallel computing on a GPU. Specifically, for any input sequence, two adjacent monotonic subsequences with opposite monotony are first regarded as a bitonic sequence, and the two monotonic subsequences are merged into a new bitonic sequence each time, and a bitonic sort is performed on it. After completing a sort, the length of the subsequence is doubled, and the bitonic sort is continued until the length of the subsequence is equal to the length of the entire sequence. After this, the entire sequence is finally sorted to obtain a completely ordered result. By performing a deduplication operation on the sorted results, a model and texture data index without duplicates can be obtained.

[0048] In step S230, the pixel ratio of the rendered screen of each object to be rendered is determined based on the preset view cone size information and the position information of the virtual image acquisition device, and the pixel ratio of the rendered screen is determined as the second loading factor.

[0049] In one embodiment of the present application, the pixel ratio of each bounding box in the rendered image is calculated based on the distance between each remaining proxy model and the virtual image acquisition device and the preset viewing cone size information by using the similar triangle theorem.

[0050] Specifically, the straight-line distance between the center point of each proxy model and the virtual image acquisition device is calculated, and the distance formula between two points in three-dimensional space is used to input the coordinates of the center point of the proxy model and the coordinates of the virtual image acquisition device, and the distance between them is calculated, and the horizontal and vertical field of view angles (FOV) of the view cone, as well as the distances between the near clipping plane and the far clipping plane, are obtained. The width and height of the near clipping plane are calculated according to the near clipping plane distance and the field of view angle of the view cone. Similarly, the width and height of the far clipping plane are calculated according to the far clipping plane distance and the field of view angle of the view cone. Using the properties of similar triangles, the ratio of the width of the far clipping plane to the width of the near clipping plane is equal to the ratio of the far clipping plane distance to the near clipping plane distance, and the ratio of the height of the far clipping plane to the height of the near clipping plane is also equal. For the bounding box of each proxy model, its projection size on the near clipping plane is calculated according to its actual size in the world coordinate system and its distance from the virtual image acquisition device. The projection width is equal to the actual width of the proxy model multiplied by the near clipping plane distance divided by the distance between the proxy model and the virtual image acquisition device. The calculation method of the projection height is the same as above. Finally, divide the projected width of the bounding box by the width of the near clipping plane to get the pixel width ratio; divide the projected height of the bounding box by the height of the near clipping plane to get the pixel height ratio; divide the product of the two by the total area of ​​the near clipping plane to get the total pixel ratio of the bounding box in the rendered image.

[0051] In step S240, a rendering loading priority sequence is generated according to the first loading factor, and a model level resource file and a texture level resource file corresponding to each object to be rendered are determined according to the second loading factor.

[0052] In one embodiment of the present application, generating a rendering loading priority sequence according to the first loading factor includes performing binary value conversion on each first loading factor to obtain multiple base conversion values, sorting each base conversion value based on the radix sorting method to obtain a base conversion value queue, and replacing the base conversion value in the base conversion value queue with the corresponding first loading factor to obtain a rendering loading priority sequence. Radix sorting is a non-comparative integer sorting algorithm that implements sorting by multiple allocation and collection operations in order from low to high, and the sorting operation can be executed in parallel on the GPU side. The algorithm flow is as follows: in binary form, extract the lowest bit of the distance value to be sorted, scan and calculate the prefix sum of the lowest bit being 0 and the lowest bit being 1; calculate the position of each value after sorting based on the prefix sum result, and move to the new position to generate a new sequence. The above process is iterated from low to high in sequence, and finally an ordered distance value is obtained, thereby determining the priority of resource loading.

[0053] In one embodiment of the present application, determining the model level resource files and texture level resource files corresponding to each object to be rendered according to the second loading factor includes determining a preset division threshold interval hit by each second loading factor, determining the corresponding model level resource information and texture level resource information according to the preset division threshold interval hit by each second loading factor, calling the model level resource file in the current rendering model data index according to the model level resource information, and calling the texture level resource file in the current rendering texture data index according to the texture level resource information, to obtain the model level resource files and texture level resource files corresponding to each object to be rendered.

[0054] In step S250, the model level resource file and the texture level resource file are loaded into the video memory according to the loading priority sequence, so as to render the objects to be rendered in the scene to be rendered.

[0055] In one embodiment of the present application, the corresponding model level resource files and texture level resource files are asynchronously loaded into the video memory according to the loading priority sequence. The resource loading is completed by the background thread, and the main thread continues to execute the rendering logic, which can fully utilize the computing power of the multi-core CPU.

[0056] In one embodiment of the present application, in addition, a resource cache module is set to quickly reuse loaded resources without reloading, and a resource management module is used to uniformly track and manage loaded resources, including loading and unloading of resources.

[0057] Reference Figure 3 As shown, Figure 3 FIG. 1 is a flowchart of a specific image rendering method shown in an exemplary embodiment of the present application. Figure 3 As shown, in a specific embodiment of the present application, the model data and texture data files in the hard disk are compressed, and multiple levels of detail (LOD) and multiple Mipmap levels are established respectively; the bounding box is used as a proxy model to pre-render the rendering scene, record and count the rendering resource index in the current frame, and calculate the distance of the bounding box from the camera; according to the distance of the bounding box from the camera, the model LOD level and the texture Mipmap level are calculated to determine the resource loading priority; according to the required resource index and its loading priority, the resources are asynchronously loaded into the video memory by multiple threads.

[0058] Reference Figure 4 As shown, Figure 4 FIG. 1 is a specific rendering resource screening flow chart shown in an exemplary embodiment of the present application. Figure 4As shown, in a specific embodiment of the present application, an axis-aligned bounding box is created for the model, and the bounding box is used as a proxy model to pre-render the rendering scene. The frustum is culled according to the size and position of the bounding box. The bounding box is occluded by the early-z algorithm to eliminate invisible content. During the rendering resource screening, the model and texture indexes required for rendering in this frame are recorded on the GPU side through the compute shader, and the statistical model and texture indexes are sorted in parallel and bitonally, and duplicate index data are removed. During the pre-rendering process, the loading priority of each model and texture is determined according to the distance between the camera and each bounding box, and they are sorted by priority using radix sorting; the corresponding model LOD level and texture Mipmap level are calculated according to the size of the pixel ratio of the model instance during rendering, and finally the model and texture indexes required for the current image and the ordered loading priority queue are obtained.

[0059] The present invention provides an image rendering method, device, electronic device and storage medium, which determines the object to be rendered in the scene to be rendered, calculates the distance between the virtual image acquisition device and the object to be rendered and determines it as a first loading factor, determines the pixel ratio of the rendering screen of each object to be rendered based on the preset frustum size information and determines it as a second loading factor, generates a rendering loading priority sequence according to the first loading factor, and determines the model level resource file and the texture level resource file according to the second loading factor, so as to load the resources into the video memory in sequence for rendering; the present application determines the image distance of each object by calculating the distance between the camera and the object to be rendered, and the smaller the image distance value, the higher the priority. High, priority loading ensures that high-resolution models and high-quality textures of close objects are loaded into the video memory first, improving the immediacy and immersion of the rendering loading process. By calculating the pixel ratio of each object to be rendered in the final rendering picture, the larger the pixel ratio, the higher the level of video memory resources allocated to the model and texture loading of these objects, avoiding the waste of video memory resources, not only reducing the usage of video memory, but also reducing the burden on the CPU and GPU, and improving the overall rendering performance of the system. Furthermore, in the real-time rendering process, when the perspective is moved or approaching an object, the system can quickly adjust the loading strategy, provide higher resolution details in time, and enhance the user's interactive experience.

[0060] The following describes an apparatus embodiment of the present application, which can be used to execute the image rendering method in the above-mentioned embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above-mentioned embodiment of the image rendering method of the present application.

[0061] Figure 5 is a schematic diagram of an image rendering device shown in an exemplary embodiment of the present application. The device can be applied to Figure 2 The method implementation process shown in the figure can be based on Figure 1The present invention is executed in the implementation environment shown in the figure, and may also be applicable to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the apparatus is applicable.

[0062] like Figure 5 As shown, the exemplary image rendering device includes: a rendering object determination module 501 , a rendering factor determination module 502 , and a rendering resource loading module 503 .

[0063] Among them, the rendering object determination module 501 is used to determine the objects to be rendered in the scene to be rendered in response to the image rendering request, and obtain the position information of the virtual image acquisition device, and the scene to be rendered includes at least one object to be rendered; the rendering factor determination module 502 is used to calculate the distance between the virtual image acquisition device and each object to be rendered, obtain the image distance of each object to be rendered, and determine the image distance as the first loading factor; based on the preset frustum size information and the position information of the virtual image acquisition device, determine the rendering screen pixel ratio of each object to be rendered, and determine the rendering screen pixel ratio as the second loading factor; the rendering resource loading module 503 is used to generate a rendering loading priority sequence according to the first loading factor, and determine the model level resource file and texture level resource file corresponding to each object to be rendered according to the second loading factor; according to the loading priority sequence, the model level resource file and the texture level resource file are loaded into the video memory to render the objects to be rendered in the scene to be rendered.

[0064] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the image rendering method provided in the above-mentioned embodiments.

[0065] Figure 6 is a schematic diagram of the structure of a computer system of an electronic device according to an exemplary embodiment of the present application. It should be noted that: Figure 6 The computer system 600 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0066] like Figure 6As shown, computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in a read-only memory (ROM) 602 or the program loaded from the storage part to a random access memory (RAM) 603, such as the method in the above embodiment. In RAM 603, various programs and data required for system operation are also stored. CPU 601, ROM 602 and RAM 603 are connected to each other via a bus. Input / output (I / O) interface 605 is also connected to bus 604.

[0067] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section performs communication processing via a network such as the Internet. A drive is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.

[0068] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 609, and / or installed from a removable medium 611. When the computer program is executed by a central processing unit (CPU) 601, various functions defined in the system of the present application are executed.

[0069] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0070] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0071] In the corresponding drawings of the above embodiments, connecting lines may indicate the connection relationship between the various components to indicate more constituent signal paths (constituent_signalpath) and / or one or more ends of some lines may have arrows to indicate the main information flow direction. Connecting lines, as a mark, are not a limitation to the scheme itself, but the use of these lines in combination with one or more exemplary embodiments helps to connect circuits or logic units more easily. Any represented signal (determined by design requirements or preferences) may actually include one or more signals that can be transmitted in either direction and implemented with any appropriate type of signal scheme.

[0072] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0073] Another aspect of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0074] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0075] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0076] It should be noted that the present application can be used in many general or special computing system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.

[0077] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0078] It should be understood that the above content of the present application is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. Ordinary technicians in this field can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application should be the scope of protection required by the claims.

Claims

1. An image rendering method, characterized in that: The image rendering method comprises: In response to an image rendering request, determining an object to be rendered in a scene to be rendered, and acquiring position information of a virtual image acquisition device, wherein the scene to be rendered includes at least one object to be rendered; Calculating the distance between the virtual image acquisition device and each object to be rendered, obtaining the image distance of each object to be rendered, and determining the image distance as the first loading factor; Determine the pixel ratio of the rendered screen of each object to be rendered based on the preset view cone size information and the position information of the virtual image acquisition device, and determine the pixel ratio of the rendered screen as the second loading factor; generating a rendering loading priority sequence according to the first loading factor, and determining a model level resource file and a texture level resource file corresponding to each object to be rendered according to the second loading factor; The model level resource file and the texture level resource file are loaded into the video memory according to the loading priority sequence, so as to render the object to be rendered in the scene to be rendered.

2. The image rendering method according to claim 1, characterized in that: Before responding to the image rendering request, the image rendering method further includes: Obtaining original model data files and original texture data files; Compressing the original model data file and the original texture data file respectively to obtain an initial model data file and an initial texture data file; Creating a level detail version of the initial model data file based on a mesh simplification algorithm to obtain a plurality of model level resource files with different static level details; Based on the texture mapping method, the resolution version of the initial texture data file is created to obtain a plurality of texture level resource files with different rendering resolutions.

3. The image rendering method according to claim 1, characterized in that: Determine the objects to be rendered in the scene to be rendered include: Performing model proxy on initial rendering objects in the scene to be rendered respectively, and pre-rendering the scene to be rendered according to each proxy model to obtain an initial pre-rendering scene; A culling operation is performed on invisible models in the initial pre-rendering scene according to the position information of the virtual image acquisition device to obtain a calculated pre-rendering scene, and the initial rendering object corresponding to the remaining proxy models in the scene to be rendered is determined as the object to be rendered, wherein the invisible models include proxy models outside the field of view and proxy models completely blocked by other proxy models.

4. The image rendering method according to claim 3, characterized in that: Calculating the distance between the virtual image acquisition device and each object to be rendered includes: In calculating the pre-rendering scene, respectively calculating the distance between the virtual image acquisition device and each remaining proxy model to obtain a proxy image distance of each proxy model; The proxy image distances of the remaining proxy models are determined as the image distances of the corresponding objects to be rendered.

5. The image rendering method according to claim 4, characterized in that: After determining the proxy image distances of the remaining proxy models as the image distances of the corresponding objects to be rendered, the image rendering method further includes: Record all model data indexes and texture data indexes required for rendering in the current image; All model data indexes and texture data indexes are sorted based on the bitonic sorting method, and a deduplication operation is performed to obtain a current rendering model data index and a current rendering texture data index.

6. The image rendering method according to claim 5, characterized in that: Determining the model level resource file and the texture level resource file corresponding to each to-be-rendered object according to the second loading factor includes: Determine a preset partition threshold interval hit by each of the second loading factors; Determine the corresponding model level resource information and texture level resource information according to the preset division threshold interval hit by each of the second loading factors; The model level resource file is called in the current rendering model data index according to the model level resource information, and the texture level resource file is called in the current rendering texture data index according to the texture level resource information to obtain the model level resource file and texture level resource file corresponding to each object to be rendered.

7. The image rendering method according to any one of claims 1 to 6, characterized in that: Generating a rendering loading priority sequence according to the first loading factor includes: Performing binary value conversion on each of the first loading factors to obtain a plurality of base-converted values; The base-converted values ​​are sorted based on a radix sorting method to obtain a base-converted value queue, and the base-converted values ​​in the base-converted value queue are replaced with corresponding first loading factors to obtain a rendering loading priority sequence.

8. An image rendering device, characterized in that: The image rendering device comprises: A rendering object determination module, configured to determine an object to be rendered in a scene to be rendered in response to an image rendering request, and obtain position information of a virtual image acquisition device, wherein the scene to be rendered includes at least one object to be rendered; A rendering factor determination module is used to calculate the distance between the virtual image acquisition device and each object to be rendered, obtain the image distance of each object to be rendered, and determine the image distance as a first loading factor; determine the rendering screen pixel ratio of each object to be rendered based on the preset view cone size information and the position information of the virtual image acquisition device, and determine the rendering screen pixel ratio as a second loading factor; A rendering resource loading module is used to generate a rendering loading priority sequence according to the first loading factor, and determine the model level resource files and texture level resource files corresponding to each object to be rendered according to the second loading factor; load the model level resource files and texture level resource files into the video memory according to the loading priority sequence to render the objects to be rendered in the scene to be rendered.

9. An electronic device, characterized in that: It comprises a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the image rendering method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is used to enable a computer to execute the image rendering method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Large BIM model optimization method and system based on intelligent loading

    CN120030661A

  • Method and device for generating three-dimensional virtual picture, equipment and medium

    CN120259514A

  • Dong minority culture content information generation method and device

    CN120406742A

  • Distributed parallel processing and loading method for large-scene three-dimensional model data

    CN120931471A

  • A distributed parallel processing and loading method for large scene three-dimensional model data

    CN120931471B