Dynamic resolution rendering method and device, electronic equipment and readable storage medium

By generating a target scaling ratio and a resolution to be adjusted, and adjusting the rendered texture and camera viewport size, the problem of wasted resources in resolution adjustment on terminal devices is solved, dynamic resolution rendering is achieved, rendering resources are saved, and performance is improved.

CN114913067BActive Publication Date: 2026-01-23BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210403276.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-30
Publication Date
2026-01-23
Estimated Expiration
2041-06-30

AI Technical Summary

Technical Problem

In existing technologies, software applications need to continuously generate new-sized rendering images when adjusting the resolution on terminal devices, leading to resource waste and performance impact.

Method used

By generating a target scaling ratio and a resolution to be adjusted, the rendering texture and camera viewport size are adjusted, and the target rendering image is generated using the adjusted rendering texture and camera viewport, thus avoiding the generation of a new size rendering image.

Benefits of technology

It enables dynamic resolution adjustment, saves rendering resources, and improves the performance of terminal devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114913067B_ABST
    Figure CN114913067B_ABST
Patent Text Reader

Abstract

The application discloses a dynamic resolution rendering method and device, electronic equipment and a readable storage medium, and relates to the technical field of computers. The resolution is adjusted by resampling and rendering on a rendering texture, a new size of rendering picture is not generated, a large amount of rendering resources is avoided, and the purpose of saving resources is achieved. The method comprises the following steps: generating a target scaling ratio and a to-be-adjusted resolution; adjusting the rendering texture according to the to-be-adjusted resolution, and adjusting the size of the camera viewport of the scene camera of the animation scene according to the target scaling ratio; rendering the animation scene by using the adjusted camera viewport and the adjusted rendering texture, and obtaining a first rendering picture; performing scaling sampling rendering on the adjusted rendering texture and returning to a color buffer, and rendering the color buffer by using the interface camera of the animation scene, and obtaining a second rendering picture; and superimposing the second rendering picture on the first rendering picture to generate a target rendering picture.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of Chinese Patent Application No. 202110735362.5, filed with the Chinese Patent Office on June 30, 2021, entitled "Rendering method, apparatus, electronic device and readable storage medium with dynamic resolution". Technical Field

[0002] This application relates to the field of computer technology, and in particular to a dynamic resolution rendering method, apparatus, electronic device, and readable storage medium. Background Technology

[0003] With the continuous development of computer technology, smartphones, tablets, and other terminal devices have gradually become widespread, becoming an indispensable part of people's lives, studies, and entertainment, profoundly impacting all aspects of social life. Currently, terminal devices have varying configurations. When developing software applications, in order to ensure that the software application runs at a sufficiently high resolution on the terminal device and avoid blurry text and 2D images displayed by the software application, it is necessary to continuously adjust the resolution of the software application based on software development tools.

[0004] In related technologies, when adjusting the resolution of a software application, it is necessary to determine the current frame rate of the software application, determine the resolution to be rendered based on the current frame rate, generate a rendering image with a size that matches the resolution to be rendered, and use the rendering image to render the page of the software application at the current frame rate, thereby realizing the resolution adjustment.

[0005] In the process of developing this application, the applicant discovered that the relevant technology has at least the following problems:

[0006] Adjusting the resolution by continuously generating new renders requires constantly generating new renders of different sizes during the software application's operation, consuming a large amount of rendering resources and resulting in resource waste. Summary of the Invention

[0007] In view of this, this application provides a dynamic resolution rendering method, apparatus, electronic device, and readable storage medium, the main purpose of which is to solve the problem of constantly generating rendering images of new sizes, which consumes a lot of rendering resources and causes resource waste.

[0008] According to a first aspect of this application, a dynamic resolution rendering method is provided, the method comprising: generating a target scaling ratio and a resolution to be adjusted; adjusting a rendering texture according to the resolution to be adjusted, and adjusting the size of the camera viewport of the scene camera of the animation scene according to the target scaling ratio; rendering the animation scene using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image; scaling and sampling the adjusted rendering texture back to a color buffer, and rendering the color buffer using the interface camera of the animation scene to obtain a second rendering image; and superimposing the second rendering image onto the first rendering image to generate a target rendering image.

[0009] Optionally, generating the target scaling ratio and the resolution to be adjusted includes: reading the current frame time of the current frame of the animation scene; querying the time information of the historical frames, calculating the average time of the historical frames by averaging the time information of the historical frames; determining a preset expected frame rate, calculating a first ratio of the current frame time to the average time, and a second ratio of the first ratio to the preset expected frame rate, and using the second ratio as the target scaling ratio; reading the current resolution of the current frame, calculating a first product of the current resolution and the target scaling ratio, and using the first product as the resolution to be adjusted.

[0010] Optionally, the step of scaling and sampling the adjusted rendering texture back to the color buffer, and rendering the color buffer using the interface camera of the animation scene to obtain a second rendering image includes: stretching the adjusted rendering texture according to the target scaling ratio to obtain a rendering texture to be sampled; sampling the rendering texture to be sampled and adding the sampled pixels to the color buffer; and using the interface camera to perform interface rendering based on the data in the color buffer to obtain the second rendering image.

[0011] Optionally, the method further includes: determining a first axis of the first rendered image and a second axis of the second rendered image, comparing the first axis with the second axis; when there is a deviation between the first axis and the second axis, scaling and repositioning the second rendered image to control the first axis to coincide with the second axis.

[0012] Optionally, the method further includes: if the animation scene is associated with a high dynamic range rendering effect, then deleting the rendering texture in the target rendering map rendered for the animation scene in each frame.

[0013] According to a second aspect of this application, a dynamic resolution rendering apparatus is provided, comprising: a generation module for generating a target scaling ratio and a resolution to be adjusted; an adjustment module for adjusting a rendering texture according to the resolution to be adjusted and adjusting the size of the camera viewport of a scene camera of an animation scene according to the target scaling ratio; a first rendering module for rendering the animation scene using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image; a second rendering module for scaling and sampling the adjusted rendering texture back to a color buffer and rendering the color buffer using the interface camera of the animation scene to obtain a second rendering image; and an overlay module for overlaying the second rendering image onto the first rendering image to generate a target rendering image.

[0014] Optionally, the generation module is specifically configured to: read the current frame time of the current frame of the animation scene; query the time information of the historical frames, calculate the average time of the historical frames by averaging the time information of the historical frames; determine a preset expected frame rate, calculate a first ratio of the current frame time to the average time, and a second ratio of the first ratio to the preset expected frame rate, and use the second ratio as the target scaling ratio; read the current resolution of the current frame, calculate a first product of the current resolution and the target scaling ratio, and use the first product as the resolution to be adjusted.

[0015] Optionally, the second rendering module is specifically used to stretch the adjusted rendering texture according to the target scaling ratio to obtain a rendering texture to be sampled; to sample the rendering texture to be sampled and add the sampled pixels to the color buffer; and to use the interface camera to perform interface rendering based on the data in the color buffer to obtain the second rendering image.

[0016] Optionally, the second rendering module is further configured to determine the first axis of the first rendering image and the second axis of the second rendering image, compare the first axis with the second axis; when there is a deviation between the first axis and the second axis, scale and position the second rendering image to control the first axis to coincide with the second axis.

[0017] Optionally, the apparatus further includes a deletion module, configured to delete the rendering texture in the target rendering map rendered for the animation scene in each frame if the animation scene is associated with a high dynamic range rendering effect.

[0018] According to a third aspect of this application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in any of the first aspects above.

[0019] According to a fourth aspect of this application, a readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first aspects above.

[0020] By utilizing the above technical solution, this application provides a dynamic resolution rendering method, apparatus, electronic device, and readable storage medium. The solution first determines the target scaling ratio and the resolution to be adjusted. Then, it adjusts the rendering texture according to the resolution to be adjusted, adjusts the size of the camera viewport of the animation scene's camera according to the target scaling ratio, and renders the animation scene using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image. Next, it scales and samples the adjusted rendering texture and renders it back to the color buffer, and then renders the color buffer using the interface camera of the animation scene to obtain a second rendering image. Finally, it overlays the second rendering image onto the first rendering image to generate the required target rendering image. By resampling and rendering on the rendering texture, dynamic resolution adjustment is achieved without generating a new size rendering image, thus avoiding the consumption of large amounts of rendering resources and achieving resource saving.

[0021] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0022] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0023] Figure 1 A schematic diagram of a dynamic resolution rendering method provided in an embodiment of this application is shown;

[0024] Figure 2 A schematic diagram of a dynamic resolution rendering method provided in an embodiment of this application is shown;

[0025] Figure 3A A schematic diagram of the structure of a dynamic resolution rendering apparatus provided in an embodiment of this application is shown;

[0026] Figure 3B A schematic diagram of the structure of a dynamic resolution rendering apparatus provided in an embodiment of this application is shown;

[0027] Figure 3CA schematic diagram of the structure of a dynamic resolution rendering apparatus provided in an embodiment of this application is shown;

[0028] Figure 4 A schematic diagram of the device structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0029] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.

[0030] This application provides a dynamic resolution rendering method, such as... Figure 1 As shown, the method includes:

[0031] 101. In response to the resolution adjustment command, generate the target scaling ratio and the resolution to be adjusted based on the time information of the current frame and historical frames of the animation scene.

[0032] 102. Adjust the rendered texture according to the resolution to be adjusted, and adjust the size of the camera viewport of the scene camera in the animation scene according to the target scaling ratio.

[0033] 103. Render the animation scene using the adjusted camera viewport and the adjusted rendering texture to obtain the first rendering image.

[0034] 104. Scale and sample the adjusted rendered texture back to the color buffer, and use the interface camera of the animation scene to render the color buffer to obtain the second rendered image.

[0035] 105. Overlay the second rendering image onto the first rendering image to generate a target rendering image that matches the resolution to be adjusted.

[0036] The method provided in this application determines the target scaling ratio and the resolution to be adjusted based on the time information of the current frame and historical frames of the animation scene in the game. The rendering texture is adjusted according to the resolution to be adjusted, and the size of the camera viewport of the scene camera of the animation scene is adjusted according to the target scaling ratio. The animation scene is then rendered using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image. The adjusted rendering texture is scaled, sampled, and rendered back to the color buffer. The color buffer is then rendered using the interface camera of the animation scene to obtain a second rendering image. The second rendering image is then superimposed on the first rendering image to generate a target rendering image that conforms to the resolution to be adjusted. By resampling and rendering on the rendering texture, dynamic resolution adjustment is achieved without generating a new size rendering image, thus avoiding the occupation of a large amount of rendering resources and achieving the purpose of saving resources.

[0037] This application provides a dynamic resolution rendering method, such as... Figure 2 As shown, the method includes:

[0038] 201. In response to the resolution adjustment command, generate the target scaling ratio and the resolution to be adjusted based on the time information of the current frame and historical frames of the animation scene.

[0039] In recent years, with the continuous development of computer technology, game development platforms have emerged to facilitate game development. A game development platform is a platform for creating and operating real-time 3D (3D) interactive content, such as Unity. Game development platforms provide a complete software solution for creating, operating, and monetizing any real-time interactive 2D (2D) and 3D content, supporting platforms including mobile phones, tablets, PCs (Personal Computers), game consoles, augmented reality, and virtual reality devices. While game development platforms have interfaces for setting game resolution, these interfaces alter the overall game resolution, resulting in a reduced UI (User Interface) resolution and blurred text and 2D images that are unreadable. Therefore, during game development and operation, it is necessary to continuously generate new scene renderings of different sizes based on the frame rate for front-end display, thereby adjusting the resolution.

[0040] However, the applicant recognizes that continuously generating new scene rendering images during resolution adjustment consumes a large amount of rendering resources, resulting in significant rendering overhead, wasting resources, and potentially impacting game performance. Therefore, this application proposes a dynamic resolution rendering method. This method determines the target scaling ratio and the resolution to be adjusted based on the time information of the current and historical frames of the animation scene in the game. The rendering texture is adjusted according to the resolution to be adjusted, and the camera viewport size of the animation scene's camera is adjusted according to the target scaling ratio. The animation scene is then rendered using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image. The adjusted rendering texture is then scaled, sampled, and rendered back to the color buffer. The color buffer is then rendered using the animation scene's interface camera to obtain a second rendering image. This second rendering image is then superimposed on the first rendering image to generate a target rendering image that conforms to the resolution to be adjusted. By resampling and rendering on the rendering texture, dynamic resolution adjustment is achieved without generating new rendering images of a new size, thus avoiding the consumption of large amounts of rendering resources and achieving resource conservation.

[0041] In practical applications, game development platforms come in two versions: one is a C# (C++ Sharpe, an object-oriented programming language) version, and the other is a C++ (a computer programming language) version. The C# version implements this solution as a component, that is, by attaching a DynamicResolutionLayer to the scene camera and the interface camera. However, this component-based approach is not suitable for the C++ version. Therefore, to ensure successful dynamic resolution adjustment in the C++ version, initialization and setting of the original rendering image are required. Specifically, during initialization, a preset number of class properties need to be determined and added to the quality settings class. These preset class properties are the maximum scaling value, the minimum scaling value, and the preset expected frame rate. Initialization involves the game development platform's engine layer extending the `maxResolution` (maximum scaling value), `minResolution` (minimum scaling value), and `DynamicResolutionTargetFrame` (preset expected frame rate) class in the `QualitySettings` class. The C# layer then assigns values ​​to these three class properties before enabling them. Additionally, during initialization, it's necessary to enable the scene camera (which requires dynamic resolution) in the C# layer. Generally, the interface camera is not enabled by default. After initialization, the scene camera is invoked to set its default rendering texture, i.e., to set the built-in rendering texture for the scene camera, ensuring its application in subsequent operations.

[0042] It should be noted that an animation scene may have multiple main cameras. Therefore, when calling the scene camera, a camera list is formed based on the multiple main cameras, and all cameras in the camera list are used as the scene camera to be called, so that the scene camera is one or more main cameras in the animation scene, thereby achieving the purpose of supporting multiple 3D cameras.

[0043] Optionally, the dynamic resolution rendering operation in this embodiment can be triggered periodically or manually. Specifically, a resolution adjustment period can be set, such as 0.5 seconds, and the current time point can be continuously detected. When the current time point meets the adjustment period, it is determined that a resolution adjustment command has been received, and dynamic resolution rendering begins. Alternatively, it is also possible to determine that a resolution adjustment command has been received and to begin dynamic resolution rendering when the resolution adjustment entry is detected to be triggered. This application does not specifically limit the triggering method of dynamic resolution rendering.

[0044] In response to a resolution adjustment command, the system begins generating a target scaling ratio and a resolution to be adjusted based on the time information of the current and historical frames of the animation scene. Subsequently, dynamic resolution rendering is performed according to the target scaling ratio and the resolution to be adjusted. Specifically, when generating the target scaling ratio, the system first reads the current frame's duration (i.e., the value assigned to `Time.deltaTime`) of the current frame of the animation scene and queries the time information of historical frames, averaging the historical frame durations to obtain the average duration of the historical frames. Next, a preset desired frame rate is determined, and a first ratio of the current frame's duration to the average duration and a second ratio of the first ratio to the preset desired frame rate are calculated. The second ratio is used as the target scaling ratio. After generating the target scaling ratio, the current resolution of the current frame is read, and a first product of the current resolution and the target scaling ratio is calculated. This first product is used as the resolution to be adjusted.

[0045] It should be noted that if based on the C++ version, the Statistics method can be registered in the initialization. The Statistics method is called every frame, so that the target scaling ratio and the resolution to be adjusted are calculated every 0.5 seconds to ensure the continuous updating of the target scaling ratio.

[0046] 202. Adjust the rendered texture according to the resolution to be adjusted, and adjust the size of the camera viewport of the scene camera in the animation scene according to the target scaling ratio.

[0047] In this embodiment, after determining the target scaling ratio and the resolution to be adjusted, rendering at the new resolution begins. The rendered texture is adjusted according to the resolution to be adjusted, and the size of the scene camera's viewport is adjusted according to the target scaling ratio. Subsequently, the animation scene is rendered using the adjusted camera viewport and the adjusted rendered texture. Since the game development platform has two versions, different versions actually require different methods to adjust the camera viewport size.

[0048] For the C++ version, since the animation scene in the C++ version has the function of setting the scene camera, the scene camera mounted in the animation scene can be directly determined, the texture size of the rendered texture can be obtained, the second product of the texture size and the target scaling ratio can be calculated, and the length and width of the scene camera's viewport can be adjusted according to the second product.

[0049] For the C# version, since the scene camera needs to be called for the animation scene, the scene camera to be called is determined in the animation scene, the texture size of the rendered texture is obtained, the second product of the texture size and the target scaling ratio is calculated, and the length and width of the scene camera's viewport are adjusted according to the second product.

[0050] 203. Render the animation scene using the adjusted camera viewport and the adjusted rendering texture to obtain the first rendering image.

[0051] In this embodiment of the application, in order to ensure that the interface rendering operation has a rendering basis when performing interface rendering later, after adjusting the camera viewport and the rendering texture, it is necessary to use the adjusted camera viewport and the adjusted rendering texture to render the animation scene to obtain a first rendering image, so that the first rendering image not only meets the target scaling ratio, but also includes all the content in the animation scene.

[0052] 204. Scale and sample the adjusted rendered texture back to the color buffer, and use the interface camera of the animation scene to render the color buffer to obtain the second rendered image.

[0053] In this embodiment of the application, after generating the first rendering image, considering that the rendering image provided to the player in the game needs to display interface content such as buttons and maps that can be interacted with by the player, it is necessary to scale and sample the adjusted rendering texture and render it back to the color buffer, and use the interface camera of the animation scene to render the color buffer to obtain the second rendering image, so as to ensure that the rendering image conforms to the actual game scene while realizing dynamic resolution rendering.

[0054] When generating the second render image, firstly, because the screens of the terminal devices on the front end have a certain size, and the interface camera in versions such as C++ does not have the function of automatically adjusting the size, the currently obtained render texture is scaled down. To display it at the correct size on the terminal device, the adjusted render texture is stretched according to the target scaling ratio to obtain the sampled render texture. This ensures that the size of the render image displayed to the player on the front end matches the preset terminal display size. Then, the sampled render texture is sampled, and the sampled pixels are added to the color buffer. Using the interface camera, the interface is rendered based on the data in the color buffer to obtain the second render image.

[0055] When rendering the interface based on the data from the color buffer, different methods can be used for different versions:

[0056] For the C++ version, when stretching the adjusted rendered texture, the C# layer can call the BlitDynamicResolution interface to shrink the size of the adjusted rendered texture at the desired resolution and sample it back to the normal size rendered texture. Then, at the start of rendering, the desired resolution can be set in the interface camera, and a RenderRectangle can be obtained. The size of the RenderRectangle is adjusted to the second product, which then serves as the adjusted camera viewport, thereby achieving rendering of the area at the desired resolution and saving rendering overhead.

[0057] For the C# version, firstly, the texture to be rendered is sampled, and the sampled pixels are added to the color buffer. Then, using the interface camera, the interface is rendered based on the data in the color buffer to obtain the second rendered image. In practical applications, during rendering, a second rendering can be performed before opaque rendering, causing the colors in the texture to be sampled to be scaled and sampled back to the color buffer. Then, the shader of the interface camera is set to achieve the shading processing of the animation scene and re-rendering.

[0058] 205. Overlay the second rendering image onto the first rendering image to generate a target rendering image that matches the resolution to be adjusted.

[0059] In this embodiment of the application, after generating the first rendering image and the second rendering image, since the first rendering image indicates the content in the animation scene and the second rendering image indicates the content on the interface, the second rendering image can be superimposed on the first rendering image to generate a target rendering image that conforms to the resolution to be adjusted.

[0060] It should be noted that to ensure the correctness of the overlay and avoid deviations, the rendered images can be scaled and shifted. The specific process is as follows: Determine the first axis of the first rendered image and the second axis of the second rendered image, and compare the first and second axes. When there is a deviation between the first and second axes, scale and reposition the second rendered image to ensure the first and second axes coincide. Additionally, for the GrabPass effect (a type of effect with content grabbing and writing capabilities), when the viewport is set in the interface camera and APIs such as DX (Data Register) and Vulkan (Cross-Platform Graphics Application Programming Interface) are used, the built-in variable UNITY_UV_STARTS_AT_TOP may have an issue where the grabbed texture is incorrectly positioned on the scene model. Therefore, for compatibility, RenderRectangle needs to be changed to the center of the screen's y-axis. Furthermore, some additional visual effects set in animation scenes also have incorrect UV coordinates, which also require adjustment of the UVs using the FrameDebugger.

[0061] In practical applications, if the animation scene is associated with high dynamic range rendering effects, such as enabling the Bloom feature, the rendered texture needs to be removed from the target rendering image for each frame of the animation scene. For example, if the scene camera has Bloom enabled, the rendering image needs to be cleaned every frame to prevent the colors of the HDR Texture (High-Dynamic Range Texture) from being convolved and displayed on the front-end interface. Additionally, for HDR functionality, if the animation scene has HDR enabled, the format of the rendered texture needs to be adjusted to a format compatible with HDR to ensure format compatibility.

[0062] In summary, this application actually provides different technical solutions for different versions:

[0063] For the C# version, it is implemented as a component named DynamicResolutionLayer, which is attached to both the scene camera and the interface camera. The interface camera obtains the rendered texture from the scene camera, sets this rendered texture as the MainTexture, sets its resolution to be adjusted, and scales and samples the pixels in the rendered texture back to the color buffer to achieve dynamic resolution rendering of the component under the 3D camera.

[0064] For the C++ version, the maximum scaling value, minimum scaling value, and preset expected frame rate are set by the C# logic layer. Then, the game platform's engine calculates the resolution to be adjusted for the current frame based on these values, sets the scene camera to offscreen (camera viewport), and adjusts the size of the camera viewport according to the resolution to be adjusted to save rendering overhead. Before post-processing, the BlitDynamicResolution interface is called, which returns a target rendering image with a size that meets the preset terminal display size for display.

[0065] The method provided in this application determines the target scaling ratio and the resolution to be adjusted based on the time information of the current frame and historical frames of the animation scene in the game. The rendering texture is adjusted according to the resolution to be adjusted, and the size of the camera viewport of the scene camera of the animation scene is adjusted according to the target scaling ratio. The animation scene is then rendered using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image. The adjusted rendering texture is scaled, sampled, and rendered back to the color buffer. The color buffer is then rendered using the interface camera of the animation scene to obtain a second rendering image. The second rendering image is then superimposed on the first rendering image to generate a target rendering image that conforms to the resolution to be adjusted. By resampling and rendering on the rendering texture, dynamic resolution adjustment is achieved without generating a new size rendering image, thus avoiding the occupation of a large amount of rendering resources and achieving the purpose of saving resources.

[0066] Furthermore, as Figure 1 To specifically implement the method, this application provides a dynamic resolution rendering device, such as... Figure 3A As shown, the device includes: a generation module 301, an adjustment module 302, a first rendering module 303, a second rendering module 304, and an overlay module 305.

[0067] The generation module 301 is used to generate a target scaling ratio and a resolution to be adjusted based on the time information of the current frame and historical frames of the animation scene in response to a resolution adjustment command.

[0068] The adjustment module 302 is used to adjust the rendering texture according to the resolution to be adjusted, and to adjust the size of the camera viewport of the scene camera of the animation scene according to the target scaling ratio.

[0069] The first rendering module 303 is used to render the animation scene using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image;

[0070] The second rendering module 304 is used to scale and sample the adjusted rendering texture and render it back to the color buffer, and use the interface camera of the animation scene to render the color buffer to obtain a second rendering image.

[0071] The overlay module 305 is used to overlay the second rendering image onto the first rendering image to generate a target rendering image that conforms to the resolution to be adjusted.

[0072] In specific application scenarios, such as Figure 3B As shown, the device also includes a detection module 306.

[0073] The detection module 306 is used to detect the current time point and determine that the resolution adjustment instruction has been received when the current time point meets the adjustment cycle; or, determine that the resolution adjustment instruction has been received when the resolution adjustment entry is detected to be triggered.

[0074] In a specific application scenario, the generation module 301 is used to read the current frame time of the current frame of the animation scene; query the time information of the historical frames, calculate the average time of the historical frames by averaging the time information of the historical frames; determine the preset expected frame rate, calculate a first ratio of the current frame time to the average time, and a second ratio of the first ratio to the preset expected frame rate, and use the second ratio as the target scaling ratio; read the current resolution of the current frame, calculate a first product of the current resolution and the target scaling ratio, and use the first product as the resolution to be adjusted.

[0075] In a specific application scenario, the adjustment module 302 is used to determine the scene camera mounted in the animation scene; obtain the texture size of the rendered texture; calculate the second product of the texture size and the target scaling ratio; and adjust the length and width of the camera viewport of the scene camera according to the second product.

[0076] In a specific application scenario, the second rendering module 304 is used to stretch the adjusted rendering texture according to the target scaling ratio to obtain a rendering texture to be sampled; to sample the rendering texture to be sampled and add the sampled pixels to the color buffer; and to use the interface camera to perform interface rendering based on the data in the color buffer to obtain the second rendering image.

[0077] In specific application scenarios, the second rendering module 304 is also used to determine the first axis of the first rendering image and the second axis of the second rendering image, and compare the first axis with the second axis; when there is a deviation between the first axis and the second axis, the second rendering image is scaled and its position is processed to control the first axis to coincide with the second axis.

[0078] In specific application scenarios, such as Figure 3CAs shown, the deletion module 307 is used to delete the rendering texture in the target rendering map of the animation scene rendered in each frame if the animation scene is associated with a high dynamic range rendering effect.

[0079] The apparatus provided in this application determines the target scaling ratio and the resolution to be adjusted based on the time information of the current frame and historical frames of the animation scene in the game. It adjusts the rendering texture according to the resolution to be adjusted, adjusts the size of the camera viewport of the scene camera of the animation scene according to the target scaling ratio, and renders the animation scene using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image. It then scales and samples the adjusted rendering texture and renders it back to the color buffer, and renders the color buffer using the interface camera of the animation scene to obtain a second rendering image. Finally, it overlays the second rendering image onto the first rendering image to generate a target rendering image that conforms to the resolution to be adjusted. By resampling and rendering on the rendering texture, dynamic resolution adjustment is achieved without generating a new size rendering image, thus avoiding the occupation of a large amount of rendering resources and achieving the purpose of saving resources.

[0080] It should be noted that other corresponding descriptions of the functional units involved in the dynamic resolution rendering apparatus provided in this application embodiment can be found by referring to... Figure 1 and Figure 2 The corresponding descriptions in [the document] will not be repeated here.

[0081] In an exemplary embodiment, see Figure 4 The invention also provides a device comprising a communication bus, a processor, a memory, and a communication interface, and may further include an input / output interface and a display device, wherein the various functional units can communicate with each other via the bus. The memory stores a computer program, and the processor executes the program stored in the memory to perform the dynamic resolution rendering method described in the above embodiments.

[0082] A computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the steps of the dynamic resolution rendering method.

[0083] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented in hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0084] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application.

[0085] Those skilled in the art will understand that the modules in the apparatus of the implementation scenario can be distributed within the apparatus of the implementation scenario as described, or they can be located in one or more apparatuses different from this implementation scenario, with corresponding changes. The modules of the above-described implementation scenario can be combined into one module, or they can be further divided into multiple sub-modules.

[0086] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of the implementation scenario.

[0087] The above disclosures are only a few specific implementation scenarios of this application. However, this application is not limited to these. Any variations that can be conceived by those skilled in the art should fall within the protection scope of this application.

Claims

1. A dynamic resolution rendering method, characterized in that, include: Generating a target scaling ratio and a resolution to be adjusted; wherein, generating the target scaling ratio and the resolution to be adjusted includes: reading the current frame time of the current frame of the animation scene; querying the time information of historical frames, calculating the average time of the historical frames by averaging the time information of the historical frames; determining a preset expected frame rate, calculating a first ratio of the current frame time to the average time, and a second ratio of the first ratio to the preset expected frame rate, and using the second ratio as the target scaling ratio; reading the current resolution of the current frame, calculating a first product of the current resolution and the target scaling ratio, and using the first product as the resolution to be adjusted; Adjust the rendered texture according to the resolution to be adjusted, and adjust the size of the camera viewport of the scene camera of the animation scene according to the target scaling ratio; The animation scene is rendered using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image; The adjusted rendering texture is scaled, sampled, and rendered back to the color buffer. The color buffer is then rendered using the interface camera of the animation scene to obtain a second rendering image. The second rendering image is overlaid on the first rendering image to generate the target rendering image.

2. The method according to claim 1, characterized in that, The process of scaling and sampling the adjusted rendered texture back to the color buffer, and then rendering the color buffer using the interface camera of the animation scene to obtain a second rendered image includes: The adjusted rendering texture is stretched according to the target scaling ratio to obtain the rendering texture to be sampled; The texture to be rendered is sampled, and the sampled pixels are added to the color buffer. Using the interface camera, the interface is rendered based on the data in the color buffer to obtain the second rendered image.

3. The method according to claim 1, characterized in that, The method further includes: Determine the first axis of the first rendered image and the second axis of the second rendered image, and compare the first axis with the second axis; When there is a deviation between the first axis and the second axis, the second rendered image is scaled and its position is adjusted to ensure that the first axis and the second axis coincide.

4. The method according to claim 1, characterized in that, The method further includes: If the animation scene is associated with a high dynamic range rendering effect, then the rendering texture is deleted in the target rendering map rendered for the animation scene in each frame.

5. A dynamic resolution rendering apparatus, characterized in that, include: The generation module is used to generate the target scaling ratio and the resolution to be adjusted. The generation module is specifically used to read the current frame time of the current frame of the animation scene; query the time information of historical frames; calculate the average time of the historical frames by averaging the time information of the historical frames; Determine a preset desired frame rate, calculate a first ratio of the current frame time to the average time, and a second ratio of the first ratio to the preset desired frame rate, and use the second ratio as the target scaling ratio; read the current resolution of the current frame, calculate a first product of the current resolution and the target scaling ratio, and use the first product as the resolution to be adjusted; An adjustment module is used to adjust the rendered texture according to the resolution to be adjusted, and to adjust the size of the camera viewport of the scene camera of the animation scene according to the target scaling ratio; The first rendering module is used to render the animation scene using the adjusted camera viewport and the adjusted rendering texture to obtain a first rendering image; The second rendering module is used to scale and sample the adjusted rendering texture and render it back to the color buffer, and use the interface camera of the animation scene to render the color buffer to obtain the second rendering image. An overlay module is used to overlay the second rendering image onto the first rendering image to generate a target rendering image.

6. The apparatus according to claim 5, characterized in that: The second rendering module is specifically used to stretch the adjusted rendering texture according to the target scaling ratio to obtain a rendering texture to be sampled; to sample the rendering texture to be sampled and add the sampled pixels to the color buffer; and to use the interface camera to perform interface rendering based on the data in the color buffer to obtain the second rendering image.

7. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the dynamic resolution rendering method according to any one of claims 1 to 4.

8. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the dynamic resolution rendering method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Frame times by dynamically adjusting frame buffer resolution

    US20140184626A1