Object rendering method and device, storage medium, and electronic device

By allocating the rendering texture space in real time in the video memory and selecting the target rendering texture according to the camera parameters, the problem of large resource overhead during 3D picture rendering is solved, efficient memory usage and hardware resource utilization are achieved, and the balance between computing and aesthetics is achieved.

CN114898029BActive Publication Date: 2025-03-14SIKELI CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210551494.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-18
Publication Date
2025-03-14
Estimated Expiration
2042-05-18

AI Technical Summary

Technical Problem

The prior art has high resource overhead in 3D picture rendering, resulting in high memory consumption and low hardware resource utilization efficiency, making it difficult to find a balance between computing and aesthetics.

Method used

By allocating the rendering texture space in real time in the video memory, selecting the target rendering texture according to the camera parameters of the virtual camera, rendering the scene object to the display screen, achieving 3D visual effects with different precisions.

Benefits of technology

It reduces memory consumption during 3D rendering, improves the efficiency of hardware resources, reduces resource overhead, and achieves a balance between computing and aesthetics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114898029B_ABST
    Figure CN114898029B_ABST
Patent Text Reader

Abstract

The present invention provides an object rendering method and device, a storage medium, and an electronic device, wherein the method comprises: allocating a rendering texture space in real time in a video memory, wherein the rendering texture space is used to store a plurality of rendering textures, each rendering texture corresponding to a display resolution; obtaining camera parameters of a virtual camera in a current virtual scene, wherein the virtual scene includes a scene object; selecting a target rendering texture in the rendering texture space according to the camera parameters; and rendering the scene object to a display screen using the target rendering texture. The present invention solves the technical problem of high resource overhead in the related art when performing 3D image rendering, reduces memory consumption in the 3D rendering process, improves the utilization efficiency of hardware resources, and reduces resource overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an object rendering method and device, a storage medium, and an electronic device. Background Art

[0002] In related technologies, displaying high-quality model textures through 3D rendering, showing stunning images, realistic characters, and moving light and shadow effects are the pursuit of all developers and players. However, due to the limitations of hardware and existing human technology development, a large amount of computing consumption has become a huge bottleneck, and the second best option is to find a balance between computing and aesthetics.

[0003] In the related technology, in order to reduce the consumption of high-quality 3D model rendering as much as possible, there is the following solution 1: LOD (Levels-Of-Lighting). LOD technology refers to determining the resource allocation for object rendering based on the position and importance of the node of the object model in the display environment, reducing the number of faces and details of non-important objects, and thus obtaining efficient rendering operations. LOD makes several sets of models for the same building, and performs corresponding model rendering according to the viewing distance or model adaptation, which can better achieve the rendering quality of objects with a high screen-to-body ratio to meet the standards of art, and at the same time achieve a better balance between performance and effect. Through scene flow technology, block loading and unloading can be performed on demand to keep the memory in a reasonable range. However, when the project is large, there are many scenes and objects, the project lacks planning in the mid-term, and the version progress is tight. This tedious and detailed configuration work of the stack is difficult to implement. Even if there is a plan at the beginning, the image quality of the LOD itself is reduced, the package size is increased, and the memory is increased. It cannot be solved, and there is also a certain cost in performance. 2: 3d Billboard (3d bulletin board technology), in order to display the content of the real 3d grid similar to the advertising board, it will bake the image content of several angles according to the current viewing angle, and then merge them together for rendering. 3d Billboard technology is used more in the vegetation system. The 3d object is pre-baked on an atlas at a set angle for rendering. Under certain circumstances, a specific material renderer can restore the original 3d effect better according to the atlas. The performance consumption vs stage has reached the best, but because many atlases need to be pre-baked, the files increase. A slight change in the rendering effect parameters will require the entire project to be re-baked. The game's light and shadow effects are changeable, and it is difficult to use a set of atlases to fully simulate 3d objects. Real-time effects are prone to problems, and the application is relatively limited. There are also problems with package size increase, workflow problems, and memory increase.

[0004] With respect to the above-mentioned problems existing in the related technologies, no effective solutions have been found so far. Summary of the invention

[0005] Embodiments of the present invention provide an object rendering method and device, a storage medium, and an electronic device.

[0006] According to one embodiment of the present invention, there is provided an object rendering method, comprising: allocating a rendering texture space in real time in a video memory, wherein the rendering texture space is used to store a plurality of rendering textures, each rendering texture corresponding to a display resolution; obtaining camera parameters of a virtual camera in a current virtual scene, wherein the virtual scene includes a scene object; selecting a target rendering texture in the rendering texture space according to the camera parameters; and rendering the scene object to a display screen using the target rendering texture.

[0007] Optionally, obtaining the camera parameters of the virtual camera in the current virtual scene includes: obtaining the following camera parameters of the virtual camera in the current scene: camera position information, camera viewing angle information, update frequency information of the virtual scene, and single-frame update quantity information.

[0008] Optionally, selecting a target rendering texture in the rendering texture space according to the camera parameters includes: determining whether the scene object is in a visualization list of a current display frame according to the camera parameters; if the scene object is in the visualization list of the current display frame, obtaining display parameters of the scene object; calculating a display resolution of the scene object in the current frame according to the display parameters and the camera parameters; and searching for a target rendering texture that matches the display resolution in the rendering texture space.

[0009] Optionally, calculating the display resolution of the scene object in the current frame according to the display parameters and the camera parameters includes: reading a bounding box size in the display parameters, and reading a focal length parameter in the camera parameters, wherein the focal length parameter is used to characterize the distance between the virtual camera and the scene object; calculating a screen-to-body ratio of the scene object in the current frame according to the bounding box size and the focal length parameter, wherein the screen-to-body ratio is positively correlated with the bounding box size, and the screen-to-body ratio is negatively correlated with the focal length parameter; calculating the display resolution of the scene object in the current frame according to the screen-to-body ratio, wherein the display resolution is positively correlated with the screen-to-body ratio.

[0010] Optionally, after searching for a target rendering texture that matches the display resolution in the rendering texture space, the method further includes: if no target rendering texture that matches the display resolution is found in the rendering texture space, and the rendering texture space is smaller than a preset storage space, requesting generation of a new rendering texture that matches the display resolution from a preset resource pool; and adding the new rendering texture to the rendering texture space, the new rendering texture being the rendering texture of the scene object.

[0011] Optionally, after searching for a target rendering texture that matches the display resolution in the rendering texture space, the method further includes: if no target rendering texture that matches the display resolution is found in the rendering texture space, and the rendering texture space is greater than or equal to a preset storage space, allocating a designated rendering texture to the scene object, wherein the designated rendering texture is a rendering texture with the smallest resolution in the rendering texture space; obtaining a multi-level-of-detail resource for the scene object; and rendering the scene object to a display screen using the multi-level-of-detail resource.

[0012] Optionally, using the target rendering texture to render the scene object to the display screen includes: object rendering a 2D face of the scene object to the surface of the target rendering texture, and saving mesh information of the target rendering texture, wherein the mesh information includes a texture map and corresponding UV coordinates; using the mesh information to render the target rendering texture single-sidedly to a background buffer to display the image of the scene object on the display screen.

[0013] Optionally, before allocating rendering texture space in real time in the video memory, the method further includes: parsing scene feature information of the target scene, selecting the scene object from a set of scene components of the target scene; obtaining the following state parameters of the scene object: the spatial size of a bounding box, the angular range of a bounding box, the display resolution range of the scene object, and the update frequency of the scene object; and mounting the state parameters and the model parameters of the scene object to the scene components of the target scene.

[0014] According to another embodiment of the present invention, there is provided an object rendering device, comprising: an allocation module, for allocating a rendering texture space in real time in a video memory, wherein the rendering texture space is used to store a plurality of rendering textures, each rendering texture corresponding to a display resolution; a first acquisition module, for acquiring camera parameters of a virtual camera in a current virtual scene, wherein the virtual scene includes a scene object; a selection module, for selecting a target rendering texture in the rendering texture space according to the camera parameters; and a first rendering module, for rendering the scene object to a display screen using the target rendering texture.

[0015] Optionally, the first acquisition module includes: an acquisition unit, used to acquire the following camera parameters of the virtual camera in the current scene: camera position information, camera viewing angle information, update frequency information of the virtual scene, and single-frame update quantity information.

[0016] Optionally, the selection module includes: a judgment unit, used to judge whether the scene object is in the visualization list of the current display frame according to the camera parameters; an acquisition unit, used to acquire the display parameters of the scene object if the scene object is in the visualization list of the current display frame; a calculation unit, used to calculate the display resolution of the scene object in the current frame according to the display parameters and the camera parameters; and a search unit, used to search for a target rendering texture that matches the display resolution in the rendering texture space.

[0017] Optionally, the calculation unit includes: a reading subunit, used to read the bounding box size in the display parameters, and read the focal length parameters in the camera parameters, wherein the focal length parameters are used to characterize the distance between the virtual camera and the scene object; a first calculation subunit, used to calculate the screen-to-body ratio of the scene object in the current frame according to the bounding box size and the focal length parameters, wherein the screen-to-body ratio is positively correlated with the bounding box size, and the screen-to-body ratio is negatively correlated with the focal length parameter; a second calculation subunit, used to calculate the display resolution of the scene object in the current frame according to the screen-to-body ratio, wherein the display resolution is positively correlated with the screen-to-body ratio.

[0018] Optionally, the selection module also includes: a request unit, used to request generation of a new rendering texture matching the display resolution from a preset resource pool after the search unit searches for a target rendering texture matching the display resolution in the rendering texture space, if the target rendering texture matching the display resolution is not found in the rendering texture space, and the rendering texture space is smaller than a preset storage space; and an adding unit, used to add the new rendering texture to the rendering texture space, the new rendering texture being the rendering texture of the scene object.

[0019] Optionally, the device also includes: an allocation module, which is used to allocate a specified rendering texture to the scene object after the selection module searches for a target rendering texture that matches the display resolution in the rendering texture space, if the target rendering texture that matches the display resolution is not found in the rendering texture space, and the rendering texture space is greater than or equal to a preset storage space; wherein the specified rendering texture is the rendering texture with the smallest resolution in the rendering texture space; a second acquisition module, which is used to acquire multi-level-of-detail resources of the scene object; and a second rendering module, which is used to render the scene object to a display screen using the multi-level-of-detail resources.

[0020] Optionally, the first rendering module includes: a first rendering unit, used to render the 2D face of the scene object to the surface of the target rendering texture, and save the mesh information of the target rendering texture, wherein the mesh information includes a texture map and corresponding UV coordinates; a second rendering unit, used to use the mesh information to render the target rendering texture on one side to the background buffer, so as to display the image of the scene object on the display screen.

[0021] Optionally, the device also includes: a parsing module, used to parse scene feature information of the target scene and select the scene object from the scene component set of the target scene before the allocation module allocates rendering texture space in real time in the video memory; a third acquisition module, used to acquire the following state parameters of the scene object: the spatial size of the bounding box, the angular range of the bounding box, the display resolution range of the scene object, and the update frequency of the scene object; and a mounting module, used to mount the state parameters and the model parameters of the scene object to the scene components of the target scene.

[0022] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.

[0023] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0024] By means of the present invention, a rendering texture space is allocated in real time in a video memory, wherein the rendering texture space is used to store a plurality of rendering textures, each rendering texture corresponds to a display resolution, and camera parameters of a virtual camera in a current virtual scene are obtained, wherein the virtual scene includes a scene object, and a target rendering texture is selected in the rendering texture space according to the camera parameters; the scene object is rendered to a display screen using the target rendering texture, and a target rendering texture corresponding to a display resolution is selected according to the camera parameters of the scene object, and 3D visual effects of different precisions are achieved by selecting different rendering textures, thereby solving the technical problem of high resource overhead in performing 3D picture rendering in related technologies, reducing memory consumption in the 3D rendering process, improving the utilization efficiency of hardware resources, and reducing resource overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0026] Figure 1 is a hardware structure block diagram of an object rendering computer according to an embodiment of the present invention;

[0027] Figure 2 is a flowchart of an object rendering method according to an embodiment of the present invention;

[0028] Figure 3 is a schematic diagram of displaying a virtual object in an embodiment of the present invention;

[0029] Figure 4 is a schematic diagram of rendering texture in an embodiment of the present invention;

[0030] Figure 5 is a rendering flow chart of a programmatic execution of an embodiment of the present invention;

[0031] Figure 6 is a structural block diagram of an object rendering device according to an embodiment of the present invention;

[0032] Figure 7 It is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0033] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0035] Example 1

[0036] The method embodiment provided in the first embodiment of the present application can be executed in a mobile phone, tablet, server, computer or similar electronic terminal. Taking running on a computer as an example, Figure 1 1 is a hardware structure block diagram of an object rendering computer according to an embodiment of the present invention. Figure 1 As shown, the computer may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0037] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to an object rendering method in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. In this embodiment, the processor 104 is used to respond to human-computer interaction instructions and game strategies, and control the target virtual character to perform specified operations to complete the game task. The memory 104 is used to store program scripts, configuration information, attribute information of virtual characters, etc. of electronic games.

[0038] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0039] Optionally, the input and output device 108 further includes a human-computer interaction screen for obtaining human-computer interaction instructions through a human-computer interaction interface, and for presenting a rendered scene image;

[0040] In this embodiment, a method for rendering an object is provided. Figure 2 is a flow chart of an object rendering method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0041] Step S202, allocating a rendering texture space in real time in a video memory, wherein the rendering texture space is used to store a plurality of rendering textures, each rendering texture corresponding to a display resolution;

[0042] Optionally, this embodiment can be applied to virtual game scenes, interactive animations, movies, and other virtual scenes including several objects.

[0043] Step S204, obtaining camera parameters of a virtual camera in a current virtual scene, wherein the virtual scene includes a scene object;

[0044] Figure 3 It is a schematic diagram of displaying virtual objects in an embodiment of the present invention. The scene includes spherical scene objects. The virtual camera projects the scene objects in the virtual scene onto a rendering texture (RenderTextur, RT) of a predetermined size within the camera's line of sight to display the image of the scene object.

[0045] Optionally, obtaining the camera parameters of the virtual camera in the current virtual scene includes: obtaining the following camera parameters of the virtual camera in the current scene: camera position information, camera viewing angle information, update frequency information of the virtual scene, and single frame update quantity information. The above camera parameters can be stored in the dynamic configuration information of the virtual camera or in the component information of the scene object.

[0046] Step S206, selecting a target rendering texture in the rendering texture space according to the camera parameters;

[0047] Step S208: Render the scene object to the display screen using the target rendering texture.

[0048] Through the above steps, a rendering texture space is allocated in real time in the video memory, wherein the rendering texture space is used to store multiple rendering textures, each rendering texture corresponds to a display resolution, and the camera parameters of the virtual camera in the current virtual scene are obtained. The virtual scene includes a scene object, and a target rendering texture is selected in the rendering texture space according to the camera parameters; the scene object is rendered to the display screen using the target rendering texture, and a target rendering texture corresponding to the display resolution is selected according to the camera parameters of the scene object. 3D visual effects of different precisions are achieved by selecting different rendering textures, thereby solving the technical problem of high resource overhead when performing 3D image rendering in the related technology, reducing memory consumption in the 3D rendering process, improving the utilization efficiency of hardware resources, and reducing resource overhead.

[0049] In this embodiment, selecting a target rendering texture in the rendering texture space according to the camera parameter includes:

[0050] S11, determining whether the scene object is in a visualization list of a current display frame according to the camera parameters;

[0051] Optionally, the visualization list can be updated based on the current camera position, viewing angle, update frequency, number of single-frame updates, and other conditions.

[0052] S12, if the scene object is in the visualization list of the current display frame, obtaining display parameters of the scene object;

[0053] Optionally, the display parameters include a size of a bounding box of the scene object, where the bounding box of the scene object is a 3D box body, and a shape corresponds to a shape of the scene object.

[0054] S13, calculating the display resolution of the scene object in the current frame according to the display parameters and the camera parameters;

[0055] In some scenarios, calculating the display resolution of the scene object in the current frame according to the display parameters and the camera parameters includes: reading the bounding box size in the display parameters, and reading the focal length parameters in the camera parameters, wherein the focal length parameters are used to characterize the distance between the virtual camera and the scene object; calculating the screen-to-body ratio of the scene object in the current frame according to the bounding box size and the focal length parameters, wherein the screen-to-body ratio is positively correlated with the bounding box size, and the screen-to-body ratio is negatively correlated with the focal length parameters; calculating the display resolution of the scene object in the current frame according to the screen-to-body ratio, wherein the display resolution is positively correlated with the screen-to-body ratio.

[0056] When the focal length parameter is fixed, that is, the distance between the virtual camera and the scene object is constant, the larger the bounding box size is, the larger the screen ratio in the current frame is. On the contrary, if the bounding box sizes of the two scene objects are the same, if the focal length parameter is larger, that is, the distance between the virtual camera and the scene object is larger, the screen ratio in the current frame is smaller.

[0057] In order to ensure the display effect, the larger the screen-to-body ratio, the larger the resolution required for display, in order to show more details so that the picture is not distorted. For scene objects with a small screen-to-body ratio, even if a smaller resolution is used for display, it is not easy to be detected by the naked eye and will not affect the visual effect.

[0058] During the rendering process, you can set a minimum resolution and a maximum resolution, and set multiple groups of resolutions, such as 128*128, 512*512, and 64*64. The more pixels per unit, the higher the resolution. Each resolution corresponds to a screen-to-body ratio range. In an example, 512*512 corresponds to a 30% to 100% screen-to-body ratio, 64*64 corresponds to a 0% to 5% screen-to-body ratio, and 512*512 corresponds to a 5% to 30% screen-to-body ratio.

[0059] S14, searching for a target rendering texture matching the display resolution in the rendering texture space.

[0060] For example, the render texture space stores three render textures, namely 64*64, 128*128, and 256*256. Among them, 256*256 matches the display resolution of 1080P and above, 128*128 matches the display resolution of 720P, and 64*64 matches the display resolution of 480P.

[0061] In some implementations of this embodiment, after searching for a target rendering texture that matches the display resolution in the rendering texture space, the method further includes: if no target rendering texture that matches the display resolution is found in the rendering texture space, and the rendering texture space is smaller than a preset storage space, requesting generation of a new rendering texture that matches the display resolution from a preset resource pool; and adding the new rendering texture to the rendering texture space, the new rendering texture being the rendering texture of the scene object.

[0062] In this embodiment, a dynamic allocation method is adopted to allocate target rendering textures for different scene objects. Each scene object is allocated a rendering texture. The rendering texture is pre-divided into grids. For example, if the size is fixed to 1024, it can be grouped into rendering texture groups of 64*64, 128*128, and 256*256. Each rendering texture group includes several rendering textures of the same resolution, and then different rendering textures are used according to the screen ratio dynamically calculated by the scene object. If there is no free target rendering texture in the rendering texture space and the rendering texture space is not full, new rendering textures can continue to be applied from the memory or cached resource pool and added to the rendering texture space. On the other hand, if the scene object A of the previous frame does not need to be displayed in the current frame, the rendering texture used by scene object A will be released to the rendering texture space.

[0063] Figure 4 is a schematic diagram of rendering textures in an embodiment of the present invention. In one example, the current scene includes scene object 1, scene object 2, and scene object 3. The calculated resolutions are 256*256, 128*128, and 512*512, respectively. Figure 4 Render Texture 1, Render Texture 2, and Render Texture 3 correspond to each other. The more faces a render texture has per unit size, the more texture grids there are, and each texture grid corresponds to an RT block.

[0064] Optionally, after searching for a target rendering texture that matches the display resolution in the rendering texture space, the method further includes: if no target rendering texture that matches the display resolution is found in the rendering texture space, and the rendering texture space is greater than or equal to a preset storage space, allocating a designated rendering texture to the scene object, wherein the designated rendering texture is a rendering texture with the smallest resolution in the rendering texture space; obtaining a multi-level-of-detail resource for the scene object; and rendering the scene object to a display screen using the multi-level-of-detail resource.

[0065] In this embodiment, the maximum memory limit of the rendering texture space is pre-set, such as 40-50M. After exceeding the limit, it is only allocated to the RT grid with the smallest resolution of 64*64. Since the grid of the rendering texture with the smallest resolution will affect the effect, when the actual resolution of the scene object is greater than the minimum resolution, it is automatically restored to the effect of the original 3D object without reducing the image quality, thereby achieving a balanced rendering and display solution between memory, performance, and display effect.

[0066] In this embodiment, using the target rendering texture to render the scene object to the display screen includes: object rendering the 2D face of the scene object to the surface of the target rendering texture, and saving mesh information of the target rendering texture, wherein the mesh information includes a texture map and corresponding UV coordinates; using the mesh information to render the target rendering texture to a backbuffer on a single side to display the image of the scene object on the display screen.

[0067] Optionally, the mesh information is stored in the color channel of the vertex of the target render texture, and the target render texture is mapped to the screen coordinates based on the mesh information.

[0068] When rendering a scene object, this embodiment first renders the scene object on the surface of a target rendering texture, then renders the target rendering texture itself, and finally displays the image of the scene object on a display screen. A number of 2D facets are set for each scene object, and the display resolution of the 2D facets is adjusted according to the target rendering texture. The rendering is performed using the resources of the rendering texture and the 2D facets. The rendering texture resources can be reused in the rendering process of multiple frames, thereby reducing memory consumption and graphics card pressure.

[0069] Optionally, before allocating rendering texture space in real time in the video memory, the method further includes: parsing scene feature information of the target scene, selecting the scene object from a set of scene components of the target scene; obtaining the following state parameters of the scene object: the spatial size of a bounding box, the angular range of a bounding box, the display resolution range of the scene object, and the update frequency of the scene object; and mounting the state parameters and the model parameters of the scene object to the scene components of the target scene.

[0070] In the rendering preparation stage, you can configure in the scene editor, add which objects (scene objects) need to be rendered in the control panel according to the characteristics of the scene, or set all nodes to be rendered using the solution of this embodiment. After making the corresponding settings, the scene component automatically mounts the scene component, which automatically fills in the space size of the object bounding box, angle changes, maximum and minimum resolution ranges, update frequency, and parameters for convenient debugging of the current state. In an example, the state parameters include: Size / QuadSize / Z Offset: a parameter used to calculate the screen ratio according to the camera distance and then calculate the RT grid block to be occupied; Fade Transition Time / Delta CameraAngle / Delta Di stance / Use Update By Time / Time Interval / Use Delta Light Angle / Delta Light Angle, used to control the refresh frequency of the patch; Min Texture Resolution / Max TextureResolution, used to control the minimum and maximum values ​​of the occupied RT picture grid; Now Scene Size / Now Distance / SoRT Index / Now Texture Resolution, used to debug the current RT grid size occupied by the patch size sorting queue.

[0071] After the settings are completed, the programmatic automatic calculation process is carried out. Based on the calculation of UPR (Universal-Renderer-Pipeline), special feature rendering parameters are added to the overall rendering pipeline. After the settings are completed, the programmatic rendering stage is entered.

[0072] Figure 5It is a rendering flowchart of the programmatic execution of an embodiment of the present invention. Rendering starts based on the UPR scene. Data of objects (scene objects) that need to be rendered 3D are initialized and registered in the object management system. Objects are visualized and culled using the AABB (Axis-aligned bounding box) viewing distance. The visualization list is updated according to the current camera position, viewing angle, update frequency, single-frame update quantity and other conditions. In the current frame, it is determined that a rendering texture is needed to render 3D scene objects. The visualization list calculated in a loop is used to calculate the resolution according to the size occupied by the object and which RT block is used. If there is no RT, a new RT is applied to the pool. The super memory executes the corresponding strategy. After all data execution is completed and the size of the space occupied by the image is determined, the objects that need to be updated are rendered onto the RT, and the corresponding mesh UV coordinates and other information are saved. The final single-sided rendering is performed based on the generated mesh information and the RT.

[0073] In order to improve 3D rendering performance, reduce overhead and ensure the effect, the scheme of this embodiment allocates a small amount of RT space in real time, and renders the required objects to RTs of different resolutions according to the camera status. If the game runs at 30 frames / s, there is a high-poly model with 100,000 faces. The rendering effect is stored on RT in the first frame. After that, for the remaining 29 frames, only two triangles need to be rendered. The overall performance is changed from 3 million faces / s to 100,000 faces / s. Excluding its own consumption, the overhead is greatly reduced. The entire process is automated, the package size does not increase, the memory consumption is low and controllable, the performance is significantly improved, and the operation process is simple. The memory consumption can be customized, and low-resolution consumption or original object LOD rendering is executed when the memory limit is exceeded. The scheme of this embodiment can be applied to all scenes involving 3D rendering. The package size of the rendering data packet does not increase, the memory growth is extremely low, the performance is significantly improved, and there is no difference in visual effects.

[0074] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0075] Example 2

[0076] In this embodiment, an object rendering device is also provided to implement the above-mentioned embodiments and preferred implementation modes, which have been described and will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0077] Figure 6 is a structural block diagram of an object rendering device according to an embodiment of the present invention. Figure 6 As shown, the device includes: an allocation module 60, a first acquisition module 62, a selection module 64, and a first rendering module 66, wherein:

[0078] An allocation module 60, configured to allocate a rendering texture space in real time in a video memory, wherein the rendering texture space is used to store a plurality of rendering textures, each rendering texture corresponding to a display resolution;

[0079] A first acquisition module 62, used to acquire camera parameters of a virtual camera in a current virtual scene, wherein the virtual scene includes a scene object;

[0080] A selection module 64, configured to select a target rendering texture in the rendering texture space according to the camera parameters;

[0081] The first rendering module 66 is configured to render the scene object onto a display screen using the target rendering texture.

[0082] Optionally, the first acquisition module includes: an acquisition unit, used to acquire the following camera parameters of the virtual camera in the current scene: camera position information, camera viewing angle information, update frequency information of the virtual scene, and single-frame update quantity information.

[0083] Optionally, the selection module includes: a judgment unit, used to judge whether the scene object is in the visualization list of the current display frame according to the camera parameters; an acquisition unit, used to acquire the display parameters of the scene object if the scene object is in the visualization list of the current display frame; a calculation unit, used to calculate the display resolution of the scene object in the current frame according to the display parameters and the camera parameters; and a search unit, used to search for a target rendering texture that matches the display resolution in the rendering texture space.

[0084] Optionally, the calculation unit includes: a reading subunit, used to read the bounding box size in the display parameters, and read the focal length parameters in the camera parameters, wherein the focal length parameters are used to characterize the distance between the virtual camera and the scene object; a first calculation subunit, used to calculate the screen-to-body ratio of the scene object in the current frame according to the bounding box size and the focal length parameters, wherein the screen-to-body ratio is positively correlated with the bounding box size, and the screen-to-body ratio is negatively correlated with the focal length parameter; a second calculation subunit, used to calculate the display resolution of the scene object in the current frame according to the screen-to-body ratio, wherein the display resolution is positively correlated with the screen-to-body ratio.

[0085] Optionally, the selection module also includes: a request unit, used to request generation of a new rendering texture matching the display resolution from a preset resource pool after the search unit searches for a target rendering texture matching the display resolution in the rendering texture space, if the target rendering texture matching the display resolution is not found in the rendering texture space, and the rendering texture space is smaller than a preset storage space; and an adding unit, used to add the new rendering texture to the rendering texture space, the new rendering texture being the rendering texture of the scene object.

[0086] Optionally, the device also includes: an allocation module, which is used to allocate a specified rendering texture to the scene object after the selection module searches for a target rendering texture that matches the display resolution in the rendering texture space, if the target rendering texture that matches the display resolution is not found in the rendering texture space, and the rendering texture space is greater than or equal to a preset storage space; wherein the specified rendering texture is the rendering texture with the smallest resolution in the rendering texture space; a second acquisition module, which is used to acquire multi-level-of-detail resources of the scene object; and a second rendering module, which is used to render the scene object to a display screen using the multi-level-of-detail resources.

[0087] Optionally, the first rendering module includes: a first rendering unit, used to render the 2D face of the scene object to the surface of the target rendering texture, and save the mesh information of the target rendering texture, wherein the mesh information includes a texture map and corresponding UV coordinates; a second rendering unit, used to use the mesh information to render the target rendering texture on one side to the background buffer, so as to display the image of the scene object on the display screen.

[0088] Optionally, the device also includes: a parsing module, used to parse scene feature information of the target scene and select the scene object from the scene component set of the target scene before the allocation module allocates rendering texture space in real time in the video memory; a third acquisition module, used to acquire the following state parameters of the scene object: the spatial size of the bounding box, the angular range of the bounding box, the display resolution range of the scene object, and the update frequency of the scene object; and a mounting module, used to mount the state parameters and the model parameters of the scene object to the scene components of the target scene.

[0089] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0090] Example 3

[0091] The present application also provides an electronic device, Figure 7 is a structural diagram of an electronic device according to an embodiment of the present invention, such as Figure 7 As shown, it includes a processor 71, a communication interface 72, a memory 73 and a communication bus 74, wherein the processor 71, the communication interface 72, and the memory 73 communicate with each other through the communication bus 74, and the memory 73 is used to store computer programs;

[0092] The processor 71 is used to execute the program stored in the memory 73, and implements the following steps: allocating a rendering texture space in real time in the video memory, wherein the rendering texture space is used to store multiple rendering textures, each rendering texture corresponds to a display resolution; obtaining camera parameters of a virtual camera in a current virtual scene, wherein the virtual scene includes a scene object; selecting a target rendering texture in the rendering texture space according to the camera parameters; and rendering the scene object to a display screen using the target rendering texture.

[0093] Optionally, obtaining the camera parameters of the virtual camera in the current virtual scene includes: obtaining the following camera parameters of the virtual camera in the current scene: camera position information, camera viewing angle information, update frequency information of the virtual scene, and single-frame update quantity information.

[0094] Optionally, selecting a target rendering texture in the rendering texture space according to the camera parameters includes: determining whether the scene object is in a visualization list of a current display frame according to the camera parameters; if the scene object is in the visualization list of the current display frame, obtaining display parameters of the scene object; calculating a display resolution of the scene object in the current frame according to the display parameters and the camera parameters; and searching for a target rendering texture that matches the display resolution in the rendering texture space.

[0095] Optionally, calculating the display resolution of the scene object in the current frame according to the display parameters and the camera parameters includes: reading a bounding box size in the display parameters, and reading a focal length parameter in the camera parameters, wherein the focal length parameter is used to characterize the distance between the virtual camera and the scene object; calculating the display resolution of the scene object in the current frame according to the bounding box size and the focal length parameter, wherein the display resolution is positively correlated with the bounding box size, and the display resolution is negatively correlated with the focal length parameter.

[0096] Optionally, after searching for a target rendering texture that matches the display resolution in the rendering texture space, the method further includes: if no target rendering texture that matches the display resolution is found in the rendering texture space, and the rendering texture space is smaller than a preset storage space, requesting generation of a new rendering texture that matches the display resolution from a preset resource pool; and adding the new rendering texture to the rendering texture space, the new rendering texture being the rendering texture of the scene object.

[0097] Optionally, after searching for a target rendering texture that matches the display resolution in the rendering texture space, the method further includes: if no target rendering texture that matches the display resolution is found in the rendering texture space, and the rendering texture space is greater than or equal to a preset storage space, allocating a designated rendering texture to the scene object, wherein the designated rendering texture is a rendering texture with the smallest resolution in the rendering texture space; obtaining a multi-level-of-detail resource for the scene object; and rendering the scene object to a display screen using the multi-level-of-detail resource.

[0098] Optionally, using the target rendering texture to render the scene object to the display screen includes: object rendering a 2D face of the scene object to the surface of the target rendering texture, and saving mesh information of the target rendering texture, wherein the mesh information includes a texture map and corresponding UV coordinates; using the mesh information to render the target rendering texture single-sidedly to a background buffer to display the image of the scene object on the display screen.

[0099] Optionally, before allocating rendering texture space in real time in the video memory, the method further includes: parsing scene feature information of the target scene, selecting the scene object from a set of scene components of the target scene; obtaining the following state parameters of the scene object: the spatial size of a bounding box, the angular range of a bounding box, the display resolution range of the scene object, and the update frequency of the scene object; and mounting the state parameters and the model parameters of the scene object to the scene components of the target scene.

[0100] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0101] The communication interface is used for communication between the above terminal and other devices.

[0102] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0103] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0104] In another embodiment provided in the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the object rendering method described in any one of the above embodiments.

[0105] In another embodiment provided by the present application, a computer program product including instructions is also provided. When the computer program product is run on a computer, the computer executes the object rendering method described in any one of the above embodiments.

[0106] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0107] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0108] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0109] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0110] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0111] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0112] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly or all or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc., which can store program code.

[0113] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. An object rendering method, characterized in that: include: Allocating a rendering texture space in real time in a video memory, wherein the rendering texture space is used to store a plurality of rendering textures, each rendering texture corresponding to a display resolution; Obtaining camera parameters of a virtual camera in a current virtual scene, wherein the virtual scene includes a scene object; Selecting a target render texture in the render texture space according to the camera parameters; Rendering the scene object to a display screen using the target rendering texture; Wherein, selecting a target rendering texture in the rendering texture space according to the camera parameters includes: determining whether the scene object is in a visualization list of a current display frame according to the camera parameters; if the scene object is in a visualization list of a current display frame, obtaining display parameters of the scene object; calculating a display resolution of the scene object in the current frame according to the display parameters and the camera parameters; searching for a target rendering texture matching the display resolution in the rendering texture space; wherein, calculating the display resolution of the scene object in the current frame according to the display parameters and the camera parameters includes: reading a bounding box size in the display parameters, and reading a focal length parameter in the camera parameters, wherein the focal length parameter is used to characterize the distance between the virtual camera and the scene object; calculating a screen-to-body ratio of the scene object in the current frame according to the bounding box size and the focal length parameter, wherein the screen-to-body ratio is positively correlated with the bounding box size, and the screen-to-body ratio is negatively correlated with the focal length parameter; calculating the display resolution of the scene object in the current frame according to the screen-to-body ratio, wherein the display resolution is positively correlated with the screen-to-body ratio.

2. The method according to claim 1, characterized in that Obtaining the camera parameters of the virtual camera in the current virtual scene includes: Get the following camera parameters of the virtual camera in the current scene: camera position information, camera viewing angle information, update frequency information of the virtual scene, and single frame update quantity information.

3. The method according to claim 1, characterized in that After searching the rendering texture space for a target rendering texture that matches the display resolution, the method further includes: If a target rendering texture matching the display resolution is not found in the rendering texture space, and the rendering texture space is smaller than a preset storage space, requesting generation of a new rendering texture matching the display resolution from a preset resource pool; The newly added rendering texture is added to the rendering texture space, where the newly added rendering texture is the rendering texture of the scene object.

4. The method according to claim 1, characterized in that After searching the rendering texture space for a target rendering texture that matches the display resolution, the method further includes: If a target rendering texture matching the display resolution is not found in the rendering texture space, and the rendering texture space is greater than or equal to a preset storage space, assigning a designated rendering texture to the scene object, wherein the designated rendering texture is a rendering texture with the smallest resolution in the rendering texture space; Acquire multiple level-of-detail resources of the scene object; The scene objects are rendered onto a display screen using the multiple level-of-detail resources.

5. The method according to claim 1, characterized in that Rendering the scene object to a display screen using the target rendering texture includes: Rendering the 2D face of the scene object to the surface of the target rendering texture, and saving the mesh information of the target rendering texture, wherein the mesh information includes a texture map and corresponding UV coordinates; The target rendering texture is rendered single-sidedly to a background buffer using the grid information to display the image of the scene object on a display screen.

6. An object rendering device, characterized in that: include: An allocation module, used for allocating a rendering texture space in real time in a video memory, wherein the rendering texture space is used to store a plurality of rendering textures, each rendering texture corresponding to a display resolution; A first acquisition module is used to acquire camera parameters of a virtual camera in a current virtual scene, wherein the virtual scene includes a scene object; A selection module, configured to select a target rendering texture in the rendering texture space according to the camera parameters; A first rendering module, configured to render the scene object to a display screen using the target rendering texture; Wherein, the selection module includes: a judgment unit, used to judge whether the scene object is in the visualization list of the current display frame according to the camera parameters; an acquisition unit, used to acquire the display parameters of the scene object if the scene object is in the visualization list of the current display frame; a calculation unit, used to calculate the display resolution of the scene object in the current frame according to the display parameters and the camera parameters; a search unit, used to search for a target rendering texture matching the display resolution in the rendering texture space; wherein, the calculation unit includes: a reading subunit, used to read the bounding box size in the display parameters, and read the focal length parameter in the camera parameters, wherein the focal length parameter is used to characterize the distance between the virtual camera and the scene object; a first calculation subunit, used to calculate the screen ratio of the scene object in the current frame according to the bounding box size and the focal length parameter, wherein the screen ratio is positively correlated with the bounding box size, and the screen ratio is negatively correlated with the focal length parameter; a second calculation subunit, used to calculate the display resolution of the scene object in the current frame according to the screen ratio, wherein the display resolution is positively correlated with the screen ratio.

7. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 5 when executed.

8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Virtual scene display method and device, equipment and storage medium

    CN112370784A

  • Virtual scene rendering method and device, computer equipment and storage medium

    CN113269858A