WO2023273114A1 - 动态分辨率的渲染方法、装置、设备、程序和可读介质 - Google Patents

动态分辨率的渲染方法、装置、设备、程序和可读介质 Download PDF

Info

Publication number
WO2023273114A1
WO2023273114A1 PCT/CN2021/132538 CN2021132538W WO2023273114A1 WO 2023273114 A1 WO2023273114 A1 WO 2023273114A1 CN 2021132538 W CN2021132538 W CN 2021132538W WO 2023273114 A1 WO2023273114 A1 WO 2023273114A1
Authority
WO
WIPO (PCT)
Prior art keywords
rendering
resolution
adjusted
camera
texture
Prior art date
Application number
PCT/CN2021/132538
Other languages
English (en)
French (fr)
Inventor
张凌云
Original Assignee
完美世界(北京)软件科技发展有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 完美世界(北京)软件科技发展有限公司 filed Critical 完美世界(北京)软件科技发展有限公司
Publication of WO2023273114A1 publication Critical patent/WO2023273114A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4023Scaling of whole images or parts thereof, e.g. expanding or contracting based on decimating pixels or lines of pixels; based on inserting pixels or lines of pixels
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/40Analysis of texture

Definitions

  • the present application relates to the field of computer technology, in particular to a dynamic resolution rendering method, device, device, program and readable medium.
  • terminal devices such as smartphones and tablet computers have gradually become popular, becoming an indispensable part of people's life, study and entertainment, and deeply affecting all aspects of people's social life.
  • the configurations of terminal devices are different.
  • software applications in order to ensure that the resolution of the software applications is high enough when running on the terminal devices, and to avoid blurring of words and 2D pictures displayed by the software applications, it is necessary to use software development tools to develop software applications. The resolution is continuously adjusted.
  • the method of continuously generating rendering images to achieve resolution adjustment needs to continuously generate rendering images of new sizes during the running of the software application, which occupies a large amount of rendering resources and causes a waste of resources.
  • a dynamic resolution rendering method including: in response to a resolution adjustment instruction, generating a target zoom ratio and a resolution to be adjusted according to the time information of the current frame of the animation scene and the historical frame;
  • the resolution to be adjusted adjusts the rendering texture, adjusting the size of the camera viewport of the scene camera of the animation scene according to the target zoom ratio; using the adjusted camera viewport and the adjusted rendering texture to adjust the
  • the animation scene is rendered to obtain the first rendering image; the adjusted rendering texture is scaled and sampled and rendered back to the color buffer, and the interface camera of the animation scene is used to render the color buffer to obtain the second rendering image.
  • a rendering image and superimposing the second rendering image on the first rendering image to generate a target rendering image conforming to the resolution to be adjusted.
  • a dynamic resolution rendering device including: a generation module, configured to generate a target scaling ratio and The resolution to be adjusted; the adjustment module is used to adjust the rendering 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 first rendering module is used to utilize The adjusted camera viewport and the adjusted rendering texture render the animation scene to obtain a first rendering image; the second rendering module is used to scale and sample the adjusted rendering texture and render it back a color buffer, and use the interface camera of the animation scene to render the color buffer to obtain a second rendering; and an overlay module, configured to superimpose the second rendering on the first rendering, Generate a target rendering image conforming to the resolution to be adjusted.
  • a computer device including a memory, a processor, and computer programs/instructions stored on the memory.
  • the processor executes the computer program/instructions, the dynamic resolution provided by the present invention is realized.
  • the steps of the rendering method of the rate is realized.
  • a computer-readable medium on which computer programs/instructions are stored, and when the computer programs/instructions are executed by a processor, the steps of the dynamic resolution rendering method provided by the present invention are implemented. .
  • a computer program product including computer programs/instructions, and when the computer program/instructions are executed by a processor, the steps of the dynamic resolution rendering method provided by the present invention are implemented.
  • the present application provides a dynamic resolution rendering method, device, equipment, program and readable medium.
  • the information determines the target zoom ratio and the resolution to be adjusted, 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 zoom ratio, and utilizes the adjusted camera viewport and the adjusted rendering
  • the texture is rendered to the animation scene to obtain the first rendering image
  • the adjusted rendering texture is scaled and sampled to render back to the color buffer
  • the interface camera of the animation scene is used to render the color buffer to obtain the second rendering image
  • the second rendering image is superimposed on the first rendering image to generate a target rendering image that meets the resolution to be adjusted.
  • Dynamic resolution adjustment is achieved by re-sampling and rendering on the rendering texture without generating a new size rendering image to avoid occupation A large number of rendering resources to achieve the purpose of saving resources.
  • FIG. 1 shows a schematic flowchart of a dynamic resolution rendering method provided by an embodiment of the present application
  • FIG. 2 shows a schematic flowchart of a dynamic resolution rendering method provided by an embodiment of the present application
  • FIG. 3A shows a schematic structural diagram of a dynamic resolution rendering device provided by an embodiment of the present application
  • FIG. 3B shows a schematic structural diagram of a dynamic resolution rendering device provided by an embodiment of the present application
  • FIG. 3C shows a schematic structural diagram of a dynamic resolution rendering device provided by an embodiment of the present application.
  • FIG. 4 shows a schematic structural diagram of a computer device provided by an embodiment of the present application
  • FIG. 5 shows a schematic structural diagram of a computer program product provided by an embodiment of the present application.
  • the embodiment of the present application provides a dynamic resolution rendering method, as shown in Figure 1, the method includes:
  • a resolution adjustment instruction In response to a resolution adjustment instruction, generate a target scaling ratio and a resolution to be adjusted according to the time information of the current frame and the historical frame of the animation scene.
  • the method provided by the embodiment of the present application determines the target zoom ratio and the resolution to be adjusted according to the time information of the current frame and the historical frame of the animation scene in the game, adjusts the rendering texture according to the resolution to be adjusted, and adjusts the scene camera of the animation scene according to the target zoom ratio
  • the interface camera of the animation scene renders the color buffer to obtain the second rendering image, and then superimposes the second rendering image on the first rendering image to generate a target rendering image that meets the resolution to be adjusted, and re-sampling on the rendering texture And rendering realizes dynamic resolution adjustment, without generating a new size rendering image, avoiding taking up a lot of rendering resources, and achieving the purpose of saving resources.
  • the embodiment of the present application provides a dynamic resolution rendering method, as shown in Figure 2, the method includes:
  • a resolution adjustment instruction In response to a resolution adjustment instruction, generate a target scaling ratio and a resolution to be adjusted according to the time information of the current frame and the historical frame of the animation scene.
  • a game development platform is a platform for real-time 3D (3 Dimensions, three-dimensional) interactive content creation and operation, such as the Unity (a game development platform) platform.
  • the game development platform provides a complete set of software solutions, which can be used to create, operate and realize any real-time interactive 2D (2 Dimensions, two-dimensional) and 3D content.
  • the supported platforms include mobile phones, tablets, PCs (Personal Computer, personal computers), game consoles, augmented reality and virtual reality devices, etc.
  • this application proposes a dynamic resolution rendering method, which determines the target zoom ratio and the resolution to be adjusted according to the time information of the current frame and historical frames of the animation scene in the game, adjusts the rendering texture according to the resolution to be adjusted, and zooms according to the target
  • the ratio adjusts the size of the camera viewport of the scene camera of the animation scene, and uses the adjusted camera viewport and the adjusted rendering texture to render the animation scene to obtain the first rendering image, and performs zoom sampling rendering on the adjusted rendering texture 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, and then superimpose the second rendering image on the first rendering image to generate a target rendering image that meets the resolution to be adjusted.
  • the game development platform is divided into two versions, one is the C# (C Sharpe, an object-oriented programming language) version, and the other is the C++ (a computer programming language) version.
  • the C# version implements this solution in the form of components, that is, mount DynamicResolutionLayer (dynamic resolution layer) on the scene camera and interface camera.
  • mount DynamicResolutionLayer dynamic resolution layer
  • this method of component mounting is not applicable to the C++ version. Therefore, in order to ensure successful dynamic adjustment of the resolution in the C++ version, initialization and setting of the original rendering image are required. Specifically, during initialization, a preset number of class attributes needs to be determined, and the preset number of class attributes are added to the quality setting class.
  • the preset number of class attributes are the maximum zoom value, the minimum zoom value and the preset expected frame rate.
  • Initialization means that the engine layer of the game development platform extends maxResolution (maximum zoom value) and minResolution in the QualitySettings (quality settings) class. (Minimum scaling value) and DynamicResolutionTargetFrame (preset expected frame rate), these three class attributes are assigned by the C# layer before Enable (operable).
  • maxResolution maximum zoom value
  • minResolution in the QualitySettings quality settings
  • DynamicResolutionTargetFrame preset expected frame rate
  • the interface camera is not enabled by default. After the initialization is complete, call the scene camera to set the default rendering texture for the scene camera, that is, set the built-in rendering texture for the scene camera to ensure the subsequent application of the default rendering texture.
  • an animation scene there may be multiple main cameras. Therefore, when the scene camera is called, a camera list is formed based on the multiple main cameras, and the camera list is used as the called scene camera, so that the scene camera It is one or more than one main camera in the animation scene, so as to achieve the purpose of supporting multiple 3D cameras.
  • the rendering operation of the dynamic resolution in this embodiment of the application may be triggered periodically or manually.
  • the resolution adjustment period can be set, such as 0.5 seconds, and then the current time point is continuously detected. When the current time point meets the adjustment period, it is determined that the resolution adjustment instruction is received, and dynamic resolution rendering starts.
  • the present application does not specifically limit the way of triggering the rendering of the dynamic resolution.
  • the target scaling ratio and the resolution In response to the resolution adjustment command, start to generate the target scaling ratio and the resolution to be adjusted according to the time information of the current frame and the historical frame of the animation scene, and then perform dynamic resolution rendering according to the target scaling ratio and the resolution to be adjusted subsequently.
  • the target zoom ratio it is necessary to read the current frame time of the current frame of the animation scene (that is, the assignment of Time.deltaTime), and query the time information of the historical frame, and average the time information of the historical frame Calculate and get the average time-consuming of historical frames.
  • determine the preset expected frame rate calculate the first ratio of the current frame time-consuming to the average time-consuming, and the second ratio of the first ratio to the preset expected frame rate, and use the second ratio as the target scaling ratio.
  • the target scaling ratio After the target scaling ratio is generated, read the current resolution of the current frame, calculate the first product of the current resolution and the target scaling ratio, and use the first product as the resolution to be adjusted.
  • the Statistics method can be registered in the initialization, and the Statistics method is called every frame, so that the calculation of the target zoom ratio and the resolution to be adjusted is completed every 0.5 seconds to ensure Continuous update of the target zoom ratio.
  • the rendering of the resolution is started again, the rendering texture is adjusted according to the resolution to be adjusted, and the camera viewport of the scene camera of the animation scene is adjusted according to the target zoom ratio , so that the animation scene is subsequently rendered according to the adjusted camera viewport and the adjusted rendering texture. Since the game development platform is divided into two versions, in fact, different versions need to use different methods to adjust the size of the camera viewport.
  • the scene camera mounted in the animation scene can be directly determined, the texture size of the rendering texture can be obtained, and the second product of the texture size and the target scaling ratio can be calculated , adjust the length and width of the camera viewport of the scene camera according to the second product.
  • the scene camera to be called is determined in the animation scene, and the texture size of the rendering texture is obtained, and the second product of the texture size and the target scaling ratio is calculated , adjust the length and width of the camera viewport of the scene camera according to the second product.
  • the final rendering texture renders the animation scene to obtain the 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.
  • the currently obtained rendering texture is The scaled ones will be displayed in the normal size on the terminal device later. Therefore, stretch the adjusted rendering texture according to the target scaling ratio to obtain the rendering texture to be sampled, so that the size and preset terminal display will be displayed for the player on the front end. Target renders with matching dimensions. Then, sample the rendering texture to be sampled, add the sampled pixels to the color buffer, use the interface camera, perform interface rendering according to the data in the color buffer, and obtain a second rendering image.
  • the C# layer when stretching the adjusted rendering texture, can call the BlitDynamicResolution (Blit Dynamic Resolution) interface to reduce the size of the adjusted rendering texture with the resolution to be adjusted and sample Blit back to the normal size The render texture. Then, when starting rendering, you can set the resolution to be adjusted in the interface camera, and obtain a RenderRectangle (rendering rectangle), adjust the size of RenderRectangle to the second product, and then use it as the adjusted camera viewport, so as to realize the resolution to be adjusted High-rate area rendering to achieve the purpose of saving rendering overhead.
  • BlitDynamicResolution Blit Dynamic Resolution
  • the rendering texture to be sampled is sampled, and the sampled pixels are added to the color buffer.
  • the interface camera is used to perform interface rendering according to the data in the color buffer to obtain a second rendering image.
  • one rendering can be performed before opaque rendering, so that the color in the rendering texture to be sampled is scaled and sampled and rendered back to the color buffer, and then the Shader (shader) of the interface camera is set to realize Shading and re-rendering of animated scenes.
  • the second rendering is superimposed on the first rendering image to generate a target rendering image conforming to the resolution to be adjusted.
  • zooming and displacement processing of the rendering can be performed.
  • the specific process is as follows: determine the first axis of the first rendering and the second axis of the second rendering, Compare the first axis with the second axis. When there is a deviation between the first axis and the second axis, zooming and position processing are performed on the second rendering image, and the coincidence of the first axis and the second axis is controlled.
  • the GrabPass effect uses DX (data register) and Vulkan (cross-platform drawing application) when the interface camera is set to the camera viewport Interface) and other APIs (Application Program Interface, application program interface), the built-in variable UNITY_UV_STARTS_AT_TOP will have the problem that the captured texture is in the wrong position on the scene model. Therefore, for compatibility, it is necessary to change the RenderRectangle to the middle of the y-axis of the screen. In addition, for some additional visual effects in the animation scene, there is also the problem of incorrect UV coordinates. It is also necessary to adjust the UV in conjunction with the FrameDebugger (frame debugger).
  • the rendering texture needs to be deleted in the target rendering image rendered for the animation scene every frame.
  • the rendering texture needs to be cleaned every frame to prevent the color convolution of the HDR Texture (High-Dynamic Range Texture, high-dynamic light rendering texture) from being displayed on the front-end display interface.
  • the HDR Texture High-Dynamic Range Texture, high-dynamic light rendering texture
  • the format of the rendering texture needs to be adjusted to match the HDR function, so as to ensure the compatibility of the format.
  • the component is named DynamicResolutionLayer and is hung on the scene camera and the interface camera.
  • the interface camera obtains the rendering texture rendered by the scene camera, sets this rendering texture as MainTexture (main texture), sets its resolution to be adjusted, and scales and samples the pixels in the rendering texture back to the color buffer to realize the dynamics of components under the 3D camera resolution rendering.
  • MainTexture main texture
  • the C# logic layer sets the maximum zoom value, minimum zoom value, and preset expected frame rate, and then the engine of the game platform calculates the resolution to be adjusted under the current frame based on these values, and sets the scene camera to Set it to offscreen (camera viewport), and adjust the size of the camera viewport according to the resolution to be adjusted to save rendering overhead, and call the BlitDynamicResolution interface before post-processing, and this interface returns a size that meets the preset display size of the terminal Target rendering for display.
  • the method provided by the embodiment of the present application determines the target zoom ratio and the resolution to be adjusted according to the time information of the current frame and the historical frame of the animation scene in the game, adjusts the rendering texture according to the resolution to be adjusted, and adjusts the scene camera of the animation scene according to the target zoom ratio
  • the interface camera of the animation scene renders the color buffer to obtain the second rendering image, and then superimposes the second rendering image on the first rendering image to generate a target rendering image that meets the resolution to be adjusted, and re-sampling on the rendering texture And rendering realizes dynamic resolution adjustment, without generating a new size rendering image, avoiding taking up a lot of rendering resources, and achieving the purpose of saving resources.
  • an embodiment of the present application provides a dynamic resolution rendering device.
  • 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 .
  • the generating module 301 is configured to generate a target scaling ratio and a resolution to be adjusted according to the time information of the current frame and the historical frame of the animation scene in response to the resolution adjustment instruction;
  • the adjustment module 302 is configured to adjust the rendering 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 first rendering module 303 is configured to use the adjusted camera viewport and the adjusted rendering texture to render the animation scene to obtain a first rendering image
  • the second rendering module 304 is configured to scale and sample the adjusted rendering texture and render it back to a color buffer, and use the interface camera of the animation scene to render the color buffer to obtain a second rendering image;
  • the overlay module 305 is configured to overlay the second rendered image on the first rendered image to generate a target rendered image conforming to the resolution to be adjusted.
  • the device further includes: a detection module 306 .
  • the detection module 306 is configured to detect the current time point, and when the current time point conforms to the adjustment cycle, determine that the resolution adjustment instruction is received; or, when it is detected that the resolution adjustment entry is triggered, determine that the resolution adjustment instruction is received The resolution adjustment command described above.
  • the generation module 301 is used to read the current frame time-consuming of the current frame of the animation scene; query the time information of the historical frame, and calculate the average value of the time information of the historical frame , to obtain the average time-consuming of the historical frame; determine the preset expected frame rate, calculate the first ratio of the current frame time-consuming to the average time-consuming, and the ratio of the first ratio to the preset expected frame rate The second ratio, using the second ratio as the target scaling ratio; reading the current resolution of the current frame, calculating the first product of the current resolution and the target scaling ratio, and using the first The product is used as the resolution to be adjusted.
  • the adjustment module 302 is configured to determine the scene camera mounted in the animation scene; obtain the texture size of the rendering texture, and calculate the second ratio between the texture size and the target scaling ratio Two products: adjust the length and width of the camera viewport of the scene camera according to the second product.
  • the second rendering module 304 is configured 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, Adding the sampled pixels to the color buffer; using the interface camera to perform interface rendering according to the data in the color buffer to obtain the second rendering image.
  • the second rendering module 304 is also used to determine the first axis of the first rendering and the second axis of the second rendering, and combine the first axis with the second Compare the two axes; when there is a deviation between the first axis and the second axis, perform scaling and position processing on the second rendering image, and control the coincidence of the first axis and the second axis .
  • the deletion module 307 is configured to, if the animation scene is associated with a high dynamic range rendering effect, delete the animation scene in the target rendering image rendered for the animation scene in each frame. The above render texture is removed.
  • the device provided by the embodiment of the present application determines the target zoom ratio and the resolution to be adjusted according to the time information of the current frame and the historical frame of the animation scene in the game, adjusts the rendering texture according to the resolution to be adjusted, and adjusts the scene camera of the animation scene according to the target zoom ratio
  • the interface camera of the animation scene renders the color buffer to obtain the second rendering image, and then superimposes the second rendering image on the first rendering image to generate a target rendering image that meets the resolution to be adjusted, and re-sampling on the rendering texture And rendering realizes dynamic resolution adjustment, without generating a new size rendering image, avoiding taking up a lot of rendering resources, and achieving the purpose of saving resources.
  • the various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof.
  • a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the dynamic resolution rendering apparatus according to the embodiments of the present invention.
  • DSP digital signal processor
  • the present invention can also be implemented as programs/instructions (eg, computer programs/instructions and computer program products) of devices or means for performing part or all of the methods described herein.
  • Such programs/instructions for implementing the present invention may be stored on a computer-readable medium, or may exist in the form of one or more signals, such signals may be downloaded from an Internet website, or provided on a carrier signal, or in any form Available in other formats.
  • Computer-readable media including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
  • Information may be computer readable instructions, data structures, modules of a program, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by computing devices.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • ROM read only memory
  • EEPROM Electrically Er
  • FIG. 4 schematically shows a computer device that can implement the dynamic resolution rendering method according to the present invention
  • the computer device includes a processor 410 and a computer-readable medium in the form of a memory 420 .
  • Memory 420 is one example of a computer readable medium having storage space 430 for storing computer programs/instructions 431 .
  • the computer program/instruction 431 is executed by the processor 410, various steps in the dynamic resolution rendering method described above can be realized.
  • Fig. 5 schematically shows a block diagram of a computer program product implementing the method according to the invention.
  • the computer program product includes computer program/instructions 510 which, when executed by a processor, such as processor 410 shown in FIG. 4, enable dynamic resolution rendering as described above steps in the method.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Processing Or Creating Images (AREA)
  • Image Generation (AREA)
  • Image Processing (AREA)

Abstract

本发明公开了一种动态分辨率的渲染方法、装置、设备、程序和可读介质,所述方法包括:响应于分辨率调整指令,生成目标缩放比率和待调整分辨率;按照待调整分辨率调整渲染纹理,按照目标缩放比率调整动画场景的场景相机的相机视口的尺寸;利用调整后的相机视口和调整后的渲染纹理对动画场景进行渲染,得到第一渲染图;对调整后的渲染纹理进行缩放采样渲染回颜色缓冲区,并利用动画场景的界面相机对颜色缓冲区进行渲染,得到第二渲染图;以及将第二渲染图叠加至第一渲染图,生成目标渲染图。上述方案通过在渲染纹理上重新进行采样和渲染渲染实现分辨率的调整,无需生成新尺寸的渲染图,避免占用大量的渲染资源,达到节省资源的目的。

Description

动态分辨率的渲染方法、装置、设备、程序和可读介质
交叉引用
本申请要求2021年06月30日递交的、申请号为“202110735362.5”、发明名称为“动态分辨率的渲染方法、装置、电子设备及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其是涉及到一种动态分辨率的渲染方法、装置、设备、程序和可读介质。
背景技术
随着计算机技术的不断发展,智能手机、平板电脑等终端设备逐渐普及,成为人们生活、学习、娱乐中不可或缺的一部分,深入地影响了人们社会生活的方方面面。目前,终端设备的配置各异,在开发软件应用时,为了保证软件应用在终端设备上运行时分辨率足够高,避免软件应用展示的字、2D图片等模糊,需要基于软件开发工具对软件应用的分辨率不断进行调整。
相关技术中,在对软件应用的分辨率进行调整时,需要确定软件应用的当前帧率,根据当前帧率确定待渲染的分辨率,生成尺寸与该待渲染的分辨率相符的渲染图,利用该渲染图渲染软件应用在当前帧率的页面,实现分辨率调整。
在实现本申请的过程中,申请人发现相关技术至少存在以下问题:
采用不断生成渲染图的方式实现分辨率的调整需要在软件应用的运行过程中不断生成新尺寸的渲染图,占用大量的渲染资源,造成资源的浪费。
发明内容
本发明提出以下技术方案以克服或者至少部分地解决或者减缓上述 问题:
根据本发明的一个方面,提供了一种动态分辨率的渲染方法,包括:响应于分辨率调整指令,根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨率;按照所述待调整分辨率调整渲染纹理,按照所述目标缩放比率调整所述动画场景的场景相机的相机视口的尺寸;利用调整后的所述相机视口和调整后的所述渲染纹理对所述动画场景进行渲染,得到第一渲染图;对调整后的所述渲染纹理进行缩放采样渲染回颜色缓冲区,并利用所述动画场景的界面相机对所述颜色缓冲区进行渲染,得到第二渲染图;以及将所述第二渲染图叠加至所述第一渲染图,生成符合所述待调整分辨率的目标渲染图。
根据本发明的另一个方面,提供了一种动态分辨率的渲染装置,包括:生成模块,用于响应于分辨率调整指令,根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨率;调整模块,用于按照所述待调整分辨率调整渲染纹理,按照所述目标缩放比率调整所述动画场景的场景相机的相机视口的尺寸;第一渲染模块,用于利用调整后的所述相机视口和调整后的所述渲染纹理对所述动画场景进行渲染,得到第一渲染图;第二渲染模块,用于对调整后的所述渲染纹理进行缩放采样渲染回颜色缓冲区,并利用所述动画场景的界面相机对所述颜色缓冲区进行渲染,得到第二渲染图;以及叠加模块,用于将所述第二渲染图叠加至所述第一渲染图,生成符合所述待调整分辨率的目标渲染图。
根据本发明的又一个方面,提供了一种计算机设备,包括存储器、处理器及存储在存储器上的计算机程序/指令,所述处理器执行所述计算机程序/指令时实现本发明提供的动态分辨率的渲染方法的步骤。
根据本发明的再一个方面,提供了一种计算机可读介质,其上存储有计算机程序/指令,所述计算机程序/指令被处理器执行时实现本发明提供的动态分辨率的渲染方法的步骤。
根据本发明的再一个方面,提供了一种计算机程序产品,包括计算机程序/指令,所述计算机程序/指令被处理器执行时实现本发明提供的动态分辨率的渲染方法的步骤。
本发明的有益效果为:借由上述技术方案,本申请提供了一种动态分辨率的渲染方法、装置、设备、程序和可读介质,本申请根据游戏中动画场景当前帧以及历史帧的时间信息确定目标缩放比率以及待调整分辨率,按照待调整分辨率调整渲染纹理,按照目标缩放比率调整动画场景的场景 相机的相机视口的尺寸,并利用调整后的相机视口和调整后的渲染纹理对动画场景进行渲染,得到第一渲染图,对调整后的渲染纹理进行缩放采样渲染回颜色缓冲区,并利用动画场景的界面相机对颜色缓冲区进行渲染,得到第二渲染图,进而将第二渲染图叠加至第一渲染图,生成符合待调整分辨率的目标渲染图,通过在渲染纹理上重新进行采样和渲染实现动态的分辨率的调整,无需生成新尺寸的渲染图,避免占用大量的渲染资源,达到节省资源的目的。
附图说明
通过阅读下文优选实施方式的详细描述,本发明的上述及各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。在附图中:
图1示出了本申请实施例提供的一种动态分辨率的渲染方法流程示意图;
图2示出了本申请实施例提供的一种动态分辨率的渲染方法流程示意图;
图3A示出了本申请实施例提供的一种动态分辨率的渲染装置的结构示意图;
图3B示出了本申请实施例提供的一种动态分辨率的渲染装置的结构示意图;
图3C示出了本申请实施例提供的一种动态分辨率的渲染装置的结构示意图;
图4示出了本申请实施例提供的一种计算机设备的结构示意图;
图5示出了本申请实施例提供的一种计算机程序产品的结构示意图。
具体实施方式
下面结合附图和具体的实施方式对本发明作进一步的描述。以下描述仅为说明本发明的基本原理而并非对其进行限制。
本申请实施例提供了一种动态分辨率的渲染方法,如图1所示,该方法包括:
101、响应于分辨率调整指令,根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨率。
102、按照待调整分辨率调整渲染纹理,按照目标缩放比率调整动画场景的场景相机的相机视口的尺寸。
103、利用调整后的相机视口和调整后的渲染纹理对动画场景进行渲染,得到第一渲染图。
104、对调整后的渲染纹理进行缩放采样渲染回颜色缓冲区,并利用动画场景的界面相机对颜色缓冲区进行渲染,得到第二渲染图。
105、将第二渲染图叠加至第一渲染图,生成符合待调整分辨率的目标渲染图。
本申请实施例提供的方法,根据游戏中动画场景当前帧以及历史帧的时间信息确定目标缩放比率以及待调整分辨率,按照待调整分辨率调整渲染纹理,按照目标缩放比率调整动画场景的场景相机的相机视口的尺寸,并利用调整后的相机视口和调整后的渲染纹理对动画场景进行渲染,得到第一渲染图,对调整后的渲染纹理进行缩放采样渲染回颜色缓冲区,并利用动画场景的界面相机对颜色缓冲区进行渲染,得到第二渲染图,进而将第二渲染图叠加至第一渲染图,生成符合待调整分辨率的目标渲染图,通过在渲染纹理上重新进行采样和渲染实现动态的分辨率的调整,无需生成新尺寸的渲染图,避免占用大量的渲染资源,达到节省资源的目的。
本申请实施例提供了一种动态分辨率的渲染方法,如图2所示,该方法包括:
201、响应于分辨率调整指令,根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨率。
近年来,计算机技术不断发展,为了便于开发人员开发游戏,游戏开发平台应运而生。游戏开发平台是一种实时3D(3 Dimensions,三维)互动内容创作和运营的平台,比如Unity(一种游戏开发平台)平台。游戏开发平台提供了一整套完善的软件解决方案,可用于创作、运营和变现任何实时互动的2D(2 Dimensions,二维)和3D内容,支持平台包括手机、平板电脑、PC(Personal Computer,个人计算机)、游戏主机、增强现实和虚拟现实设备等。游戏开发平台中有对应的设置游戏分辨率的接口,但是此接口会造成整个游戏分辨率的改变,导致UI(User Interface,用户界面)的分辨率降低,游戏中的字和2D图片模糊到无法直视。因此,在游戏的开发以及运行的过程中,需要根据帧率不断生成新的不同尺寸的场景渲染图供前端展示,从而实现对分辨率大小的调整。
但是,申请人认识到,在调整分辨率的过程中持续不断的生成新的场景渲染图会占用大量的渲染资源,渲染的开销很大,不仅造成资源的浪费,而且还可能会影响游戏的性能。因此,本申请提出了一种动态分辨率的渲染方法,根据游戏中动画场景当前帧以及历史帧的时间信息确定目标缩放比率以及待调整分辨率,按照待调整分辨率调整渲染纹理,按照目标缩放比率调整动画场景的场景相机的相机视口的尺寸,并利用调整后的相机视口和调整后的渲染纹理对动画场景进行渲染,得到第一渲染图,对调整后的渲染纹理进行缩放采样渲染回颜色缓冲区,并利用动画场景的界面相机对颜色缓冲区进行渲染,得到第二渲染图,进而将第二渲染图叠加至第一渲染图,生成符合待调整分辨率的目标渲染图,通过在渲染纹理上重新进行采样和渲染实现动态的分辨率的调整,无需生成新尺寸的渲染图,避免占用大量的渲染资源,达到节省资源的目的。
实际应用的过程中,游戏开发平台分为两种版本,一种是C#(C Sharpe,一种面向对象的编程语言)版本,另外一种是C++(一种计算机程序设计语言)版本。C#版本是以组件形式实现的本方案,也即在场景相机和界面相机上挂载DynamicResolutionLayer(动态分辨层)。而这种组件挂载的方式并不适用于C++版本,所以,为了保证在C++版本中成功进行分辨率的动态调整,需要进行初始化以及原始渲染图的设置。具体地,在进行初始化时,需要确定预设数目的类属性,将预设数目的类属性添加至质量设置类中。其中,预设数目的类属性为最大缩放值、最小缩放值和预设期望帧率,初始化也即是游戏开发平台的引擎层在QualitySettings(质量设置)类中扩展maxResolution(最大缩放值)、minResolution(最小缩放值)以及DynamicResolutionTargetFrame(预设期望帧率)这三个类属性,由C#层在Enable(可操作)前调用三个类属性的赋值。另外,在初始化过程中,还需要在C#层设置开启需要进行动态分辨率的场景相机,一般来说,界面相机默认不进行开启。初始化完毕后,调用场景相机,为场景相机设置默认的渲染纹理,也即为场景相机设置内置的渲染纹理,保证后续对该默认的渲染纹理的应用。
需要说明的是,对于一个动画场景来说,可能设置有多个主相机,因此,在调用场景相机时,基于多个主相机形成相机列表,将相机列表均作为调用的场景相机,使得场景相机为动画场景中一个或者一个以上的主相机,从而达到支持多个3D相机的目的。
可选地,本申请实施例中动态分辨率的渲染操作可以周期性的触发或 者人工手动触发。具体地,可以设置分辨率的调整周期,比如0.5秒,进而持续的检测当前时间点,在当前时间点符合调整周期时,确定接收到分辨率调整指令,并开始进行动态分辨率的渲染。或者,也可以在检测到分辨率调整入口被触发时,确定接收到分辨率调整指令,并开始进行动态分辨率的渲染。本申请对动态分辨率的渲染的触发方式不进行具体限定。
响应于分辨率调整指令,开始根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨率,进而在后续按照目标缩放比率以及待调整分辨率进行动态分辨率的渲。其中,在生成目标缩放比率时,需要先读取动画场景的当前帧的当前帧耗时(也即Time.deltaTime的赋值),并查询历史帧的时间信息,对历史帧的时间信息进行平均值计算,得到历史帧的平均耗时。接着,确定预设期望帧率,计算当前帧耗时与平均耗时的第一比值、第一比值与预设期望帧率的第二比值,将第二比值作为目标缩放比率。生成目标缩放比率后,读取当前帧的当前分辨率,计算当前分辨率与目标缩放比率的第一乘积,将第一乘积作为待调整分辨率。
需要说明的是,若基于C++版本进行,则可将Statistics(统计)方法注册到初始化中,每帧调用Statistics方法,使得每隔0.5秒完成一次目标缩放比率以及待调整分辨率的计算,以保证目标缩放比率的持续更新。
202、按照待调整分辨率调整渲染纹理,按照目标缩放比率调整动画场景的场景相机的相机视口的尺寸。
在本申请实施例中,确定了目标缩放比率以及待调整分辨率后,开始重新进行分辨率的渲染,按照待调整分辨率调整渲染纹理,按照目标缩放比率调整动画场景的场景相机的相机视口的尺寸,从而在后续按照调整后的相机视口和调整后的渲染纹理对动画场景进行渲染。由于游戏开发平台分为两种版本,因此,实际上不同的版本需要采用不同的方式进行相机视口尺寸的调整。
针对C++版本,由于C++版本的动画场景中具有设置场景相机的功能,因此,可以直接确定动画场景中挂载的场景相机,获取渲染纹理的纹理尺寸,计算纹理尺寸与目标缩放比率的第二乘积,根据第二乘积对场景相机的相机视口的长宽进行调整。
而针对C#版本,由于需要为C#版本的动画场景调用场景相机,因此,在动画场景中确定为其调用的场景相机,并获取渲染纹理的纹理尺寸,计算纹理尺寸与目标缩放比率的第二乘积,根据第二乘积对场景相机的相机视口的长宽进行调整。
203、利用调整后的相机视口和调整后的渲染纹理对动画场景进行渲染,得到第一渲染图。
在本申请实施例中,为了后续在进行界面渲染时保证界面渲染的操作能有一个渲染的基础,因此,在对相机视口以及渲染纹理进行调整后,需要利用调整后的相机视口和调整后的渲染纹理对动画场景进行渲染,得到第一渲染图,使第一渲染图不仅尺寸满足目标缩放比率,而且还包括了动画场景中的全部内容。
204、对调整后的渲染纹理进行缩放采样渲染回颜色缓冲区,并利用动画场景的界面相机对颜色缓冲区进行渲染,得到第二渲染图。
在本申请实施例中,生成了第一渲染图后,考虑到游戏中提供给玩家的渲染图上需要显示按键、地图等能够与玩家进行交互的界面内容,因此,需要对调整后的渲染纹理进行缩放采样渲染回颜色缓冲区,并利用动画场景的界面相机对颜色缓冲区进行渲染,得到第二渲染图,从而在实现动态分辨率渲染的同时,保证渲染图符合实际的游戏场景。
在生成第二渲染图时,首先,由于前端所搭载的终端设备的屏幕都是有一定的尺寸的,而诸如C++等版本中的界面相机不具备自动调控尺寸的功能,使得当前得到渲染纹理是缩小的,后续要在终端设备上显示正常的尺寸,因此,根据目标缩放比率对调整后的渲染纹理进行拉伸,得到待采样渲染纹理,以使得后续在前端为玩家展示尺寸与预设终端展示尺寸匹配的目标渲染图。随后,对待采样渲染纹理进行采样,将采样得到的像素点添加至颜色缓冲区,利用界面相机,根据颜色缓冲区的数据进行界面渲染,得到第二渲染图。
其中,在根据颜色缓冲区的数据进行界面渲染时,针对不同的版本,可采用不同的方式:
针对C++版本,在对调整后的渲染纹理进行拉伸时,可以由C#层调用BlitDynamicResolution(比利特动态分辨率)接口将待调整分辨率的调整后的渲染纹理缩小尺寸并采样Blit回正常尺寸的渲染纹理。接着,开始渲染时,可在界面相机中设置待调整分辨率,并获取一个RenderRectangle(渲染矩形),将RenderRectangle的尺寸调整为第二乘积,进而作为调整后的相机视口,从而实现对待调整分辨率的区域渲染,达到节省渲染开销的目的。
而针对C#版本,首先,对待采样渲染纹理进行采样,将采样得到的像素点添加至颜色缓冲区。随后,利用界面相机,根据颜色缓冲区的数据进 行界面渲染,得到第二渲染图。实际应用中,在进行渲染时,可在不透明渲染前执行一次渲染,使待采样渲染纹理中的颜色进行缩放采样渲染回颜色缓冲区,并接着对界面相机的Shader(着色器)进行设置,实现动画场景的着色处理以及重新渲染。
205、将第二渲染图叠加至第一渲染图,生成符合待调整分辨率的目标渲染图。
在本申请实施例中,生成了第一渲染图和第二渲染图后,由于第一渲染图指示了动画场景中的内容,第二渲染图指示了界面上的内容,因此,将第二渲染图叠加至第一渲染图,便可以生成符合待调整分辨率的目标渲染图。
需要说明的是,为了保证叠加的正确性,避免叠加发生偏差,可以进行渲染图的缩放以及位移处理,具体过程如下:确定第一渲染图的第一轴线、第二渲染图的第二轴线,将第一轴线与第二轴线进行比对。当第一轴线与第二轴线之间存在偏差时,对第二渲染图进行缩放以及位置处理,控制第一轴线与第二轴线重合。另外,针对GrabPass(一种具有内容抓取以及写入功能的类型)效果,GrabPass效果在界面相机设置了相机视口的情况下,在使用DX(数据寄存器)和Vulkan(跨平台的绘图应用程序接口)等API(Application Program Interface,应用程序接口)时,内置变量UNITY_UV_STARTS_AT_TOP会有抓取的纹理在场景模型上所处的位置不对的问题,因此,为了兼容需要把RenderRectangle改为屏幕y轴中间。再有,针对动画场景中额外设置的一些视觉后效,也存在UV坐标不正确的问题,同样需要结合FrameDebugger(帧调试器)对UV进行调整。
实际应用中,若动画场景关联了高动态范围渲染效果,比如开启了Bloom(光华)功能,则需要在每帧为动画场景渲染的目标渲染图中将渲染纹理删除。比如,如果场景相机开启了bloom(特效),需要每帧对渲染图进行清洗,防止HDR Texture(High-Dynamic Range Texture,高动态光照渲染纹理)的颜色卷积后显示到前端展示的界面中。另外,针对HDR功能,如果动画场景开启了HDR,需要将渲染纹理的格式调整为与HDR功能匹配的格式,从而保证格式的兼容。
综上,实际上本申请针对不同的版本提供了不同的技术方案:
针对C#版本,以组件形式实现,该组件命名为DynamicResolutionLayer,挂到场景相机和界面相机上。界面相机获取场景相机渲染的渲染纹理,将此渲染纹理设置为MainTexture(主纹理),设置其待调整分辨率,将渲染 纹理中的像素进行缩放采样回颜色缓冲区,实现3D相机下组件的动态分辨率渲染。
而针对C++版本,由C#逻辑层设置最大缩放值、最小缩放值以及预设期望帧率,再由游戏平台的引擎根据这些值进行计算得出当前帧下的待调整分辨率,将场景相机设置为offscreen(相机视口),并按照待调整分辨率调整相机视口的尺寸,以节省渲染时开销,并在后处理之前调用BlitDynamicResolution接口,由该接口返回一张尺寸满足预设终端展示尺寸的目标渲染图供展示。
本申请实施例提供的方法,根据游戏中动画场景当前帧以及历史帧的时间信息确定目标缩放比率以及待调整分辨率,按照待调整分辨率调整渲染纹理,按照目标缩放比率调整动画场景的场景相机的相机视口的尺寸,并利用调整后的相机视口和调整后的渲染纹理对动画场景进行渲染,得到第一渲染图,对调整后的渲染纹理进行缩放采样渲染回颜色缓冲区,并利用动画场景的界面相机对颜色缓冲区进行渲染,得到第二渲染图,进而将第二渲染图叠加至第一渲染图,生成符合待调整分辨率的目标渲染图,通过在渲染纹理上重新进行采样和渲染实现动态的分辨率的调整,无需生成新尺寸的渲染图,避免占用大量的渲染资源,达到节省资源的目的。
进一步地,作为图1所述方法的具体实现,本申请实施例提供了一种动态分辨率的渲染装置,如图3A所示,所述装置包括:生成模块301,调整模块302,第一渲染模块303,第二渲染模块304和叠加模块305。
该生成模块301,用于响应于分辨率调整指令,根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨率;
该调整模块302,用于按照所述待调整分辨率调整渲染纹理,按照所述目标缩放比率调整所述动画场景的场景相机的相机视口的尺寸;
该第一渲染模块303,用于利用调整后的所述相机视口和调整后的所述渲染纹理对所述动画场景进行渲染,得到第一渲染图;
该第二渲染模块304,用于对调整后的所述渲染纹理进行缩放采样渲染回颜色缓冲区,并利用所述动画场景的界面相机对所述颜色缓冲区进行渲染,得到第二渲染图;
该叠加模块305,用于将所述第二渲染图叠加至所述第一渲染图,生成符合所述待调整分辨率的目标渲染图。
在具体的应用场景中,如图3B所示,该装置还包括:检测模块306。
该检测模块306,用于检测当前时间点,在所述当前时间点符合调整周期时,确定接收到所述分辨率调整指令;或,在检测到分辨率调整入口被触发时,确定接收到所述分辨率调整指令。
在具体的应用场景中,该生成模块301,用于读取所述动画场景的当前帧的当前帧耗时;查询所述历史帧的时间信息,对所述历史帧的时间信息进行平均值计算,得到所述历史帧的平均耗时;确定预设期望帧率,计算所述当前帧耗时与所述平均耗时的第一比值、所述第一比值与所述预设期望帧率的第二比值,将所述第二比值作为所述目标缩放比率;读取所述当前帧的当前分辨率,计算所述当前分辨率与所述目标缩放比率的第一乘积,将所述第一乘积作为所述待调整分辨率。
在具体的应用场景中,该调整模块302,用于确定所述动画场景中挂载的所述场景相机;获取所述渲染纹理的纹理尺寸,计算所述纹理尺寸与所述目标缩放比率的第二乘积;根据所述第二乘积对所述场景相机的相机视口的长宽进行调整。
在具体的应用场景中,该第二渲染模块304,用于根据所述目标缩放比率对调整后的所述渲染纹理进行拉伸,得到待采样渲染纹理;对所述待采样渲染纹理进行采样,将采样得到的像素点添加至所述颜色缓冲区;利用所述界面相机,根据所述颜色缓冲区的数据进行界面渲染,得到所述第二渲染图。
在具体的应用场景中,该第二渲染模块304,还用于确定所述第一渲染图的第一轴线、所述第二渲染图的第二轴线,将所述第一轴线与所述第二轴线进行比对;当所述第一轴线与所述第二轴线之间存在偏差时,对所述第二渲染图进行缩放以及位置处理,控制所述第一轴线与所述第二轴线重合。
在具体的应用场景中,如图3C所示,该删除模块307,用于若所述动画场景关联了高动态范围渲染效果,则在每帧为所述动画场景渲染的目标渲染图中将所述渲染纹理删除。
本申请实施例提供的装置,根据游戏中动画场景当前帧以及历史帧的时间信息确定目标缩放比率以及待调整分辨率,按照待调整分辨率调整渲染纹理,按照目标缩放比率调整动画场景的场景相机的相机视口的尺寸,并利用调整后的相机视口和调整后的渲染纹理对动画场景进行渲染,得到第一渲染图,对调整后的渲染纹理进行缩放采样渲染回颜色缓冲区,并利用动画场景的界面相机对颜色缓冲区进行渲染,得到第二渲染图,进而将 第二渲染图叠加至第一渲染图,生成符合待调整分辨率的目标渲染图,通过在渲染纹理上重新进行采样和渲染实现动态的分辨率的调整,无需生成新尺寸的渲染图,避免占用大量的渲染资源,达到节省资源的目的。
需要说明的是,本申请实施例提供的一种动态分辨率的渲染装置所涉及各功能单元的其他相应描述,可以参考图1和图2中的对应描述,在此不再赘述。
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的动态分辨率的渲染装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置的程序/指令(例如,计算机程序/指令和计算机程序产品)。这样的实现本发明的程序/指令可以存储在计算机可读介质上,或者可以一个或者多个信号的形式存在,这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。
图4示意性地示出了可以实现根据本发明的动态分辨率的渲染方法的计算机设备,该计算机设备包括处理器410和以存储器420形式的计算机可读介质。存储器420是计算机可读介质的一个示例,其具有用于存储计算机程序/指令431的存储空间430。当所述计算机程序/指令431由处理器410执行时,可实现上文所描述的动态分辨率的渲染方法中的各个步骤。
图5示意性地示出了实现根据本发明的方法的计算机程序产品的框图。所述计算机程序产品包括计算机程序/指令510,当所述计算机程序/指令510被诸如图4所示的处理器410之类的处理器执行时,可实现上文所描 述的动态分辨率的渲染方法中的各个步骤。
上文对本说明书特定实施例进行了描述,其与其它实施例一并涵盖于所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定遵循示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可行的或者有利的。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
应可理解,以上所述实施例仅为举例说明本发明之目的而并非对本发明进行限制。在不脱离本发明基本精神及特性的前提下,本领域技术人员还可以通过其他方式来实施本发明。本发明的范围当以后附的权利要求为准,凡在本说明书一个或多个实施例的精神和原则之内所做的任何修改、等同替换、改进等,皆应涵盖其中。

Claims (11)

  1. 一种动态分辨率的渲染方法,包括:
    响应于分辨率调整指令,根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨率;
    按照所述待调整分辨率调整渲染纹理,按照所述目标缩放比率调整所述动画场景的场景相机的相机视口的尺寸;
    利用调整后的所述相机视口和调整后的所述渲染纹理对所述动画场景进行渲染,得到第一渲染图;
    对调整后的所述渲染纹理进行缩放采样渲染回颜色缓冲区,并利用所述动画场景的界面相机对所述颜色缓冲区进行渲染,得到第二渲染图;以及
    将所述第二渲染图叠加至所述第一渲染图,生成符合所述待调整分辨率的目标渲染图。
  2. 根据权利要求1所述的方法,其特征在于,所述响应于分辨率调整指令,根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨之前,所述方法还包括:
    检测当前时间点,在所述当前时间点符合调整周期时,确定接收到所述分辨率调整指令;或,
    在检测到分辨率调整入口被触发时,确定接收到所述分辨率调整指令。
  3. 根据权利要求1所述的方法,其特征在于,所述根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨率,包括:
    读取所述动画场景的当前帧的当前帧耗时;
    查询所述历史帧的时间信息,对所述历史帧的时间信息进行平均值计算,得到所述历史帧的平均耗时;
    确定预设期望帧率,计算所述当前帧耗时与所述平均耗时的第一比值、所述第一比值与所述预设期望帧率的第二比值,将所述第二比值作为所述目标缩放比率;
    读取所述当前帧的当前分辨率,计算所述当前分辨率与所述目标缩放比率的第一乘积,将所述第一乘积作为所述待调整分辨率。
  4. 根据权利要求1所述的方法,其特征在于,所述按照所述目标缩放比率调整所述动画场景的场景相机的相机视口的尺寸,包括:
    确定所述动画场景中挂载的所述场景相机;
    获取所述渲染纹理的纹理尺寸,计算所述纹理尺寸与所述目标缩放比率的第二乘积;
    根据所述第二乘积对所述场景相机的相机视口的长宽进行调整。
  5. 根据权利要求1所述的方法,其特征在于,所述对调整后的所述渲染纹理进行缩放采样渲染回颜色缓冲区,并利用所述动画场景的界面相机对所述颜色缓冲区进行渲染,得到第二渲染图,包括:
    根据所述目标缩放比率对调整后的所述渲染纹理进行拉伸,得到待采样渲染纹理;
    对所述待采样渲染纹理进行采样,将采样得到的像素点添加至所述颜色缓冲区;
    利用所述界面相机,根据所述颜色缓冲区的数据进行界面渲染,得到所述第二渲染图。
  6. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    确定所述第一渲染图的第一轴线、所述第二渲染图的第二轴线,将所述第一轴线与所述第二轴线进行比对;
    当所述第一轴线与所述第二轴线之间存在偏差时,对所述第二渲染图进行缩放以及位置处理,控制所述第一轴线与所述第二轴线重合。
  7. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    若所述动画场景关联了高动态范围渲染效果,则在每帧为所述动画场景渲染的目标渲染图中将所述渲染纹理删除。
  8. 一种动态分辨率的渲染装置,包括:
    生成模块,用于响应于分辨率调整指令,根据动画场景当前帧以及历史帧的时间信息,生成目标缩放比率和待调整分辨率;
    调整模块,用于按照所述待调整分辨率调整渲染纹理,按照所述目标缩放比率调整所述动画场景的场景相机的相机视口的尺寸;
    第一渲染模块,用于利用调整后的所述相机视口和调整后的所述渲染 纹理对所述动画场景进行渲染,得到第一渲染图;
    第二渲染模块,用于对调整后的所述渲染纹理进行缩放采样渲染回颜色缓冲区,并利用所述动画场景的界面相机对所述颜色缓冲区进行渲染,得到第二渲染图;以及
    叠加模块,用于将所述第二渲染图叠加至所述第一渲染图,生成符合所述待调整分辨率的目标渲染图。
  9. 一种计算机设备,包括存储器、处理器及存储在存储器上的计算机程序/指令,所述处理器执行所述计算机程序/指令时实现根据权利要求1-7中任一项所述的动态分辨率的渲染方法的步骤。
  10. 一种计算机可读介质,其上存储有计算机程序/指令,所述计算机程序/指令被处理器执行时实现根据权利要求1-7中任一项所述的动态分辨率的渲染方法的步骤。
  11. 一种计算机程序产品,包括计算机程序/指令,所述计算机程序/指令被处理器执行时实现根据权利要求1-7中任一项所述的动态分辨率的渲染方法的步骤。
PCT/CN2021/132538 2021-06-30 2021-11-23 动态分辨率的渲染方法、装置、设备、程序和可读介质 WO2023273114A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110735362.5 2021-06-30
CN202110735362.5A CN113469883B (zh) 2021-06-30 2021-06-30 动态分辨率的渲染方法、装置、电子设备及可读存储介质

Publications (1)

Publication Number Publication Date
WO2023273114A1 true WO2023273114A1 (zh) 2023-01-05

Family

ID=77874410

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/132538 WO2023273114A1 (zh) 2021-06-30 2021-11-23 动态分辨率的渲染方法、装置、设备、程序和可读介质

Country Status (2)

Country Link
CN (2) CN114913067A (zh)
WO (1) WO2023273114A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114913067A (zh) * 2021-06-30 2022-08-16 完美世界(北京)软件科技发展有限公司 动态分辨率的渲染方法、装置、电子设备及可读存储介质
CN113963110B (zh) * 2021-10-11 2022-10-25 北京百度网讯科技有限公司 纹理图生成方法、装置、电子设备及存储介质

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108063938A (zh) * 2017-12-21 2018-05-22 深圳市得色科技有限公司 一种游戏引擎的裸眼3d成像显示方法及其系统
US20200134796A1 (en) * 2018-10-24 2020-04-30 Adobe Inc. Dynamic image resolution adjustment for rendering changes to graphical content
CN111309430A (zh) * 2020-03-16 2020-06-19 广东趣炫网络股份有限公司 一种自动缓存用户交互界面节点的方法和相关装置
US20200242807A1 (en) * 2019-01-30 2020-07-30 Trivver, Inc. Texture based pixel count determination
CN111918125A (zh) * 2019-05-09 2020-11-10 腾讯科技(深圳)有限公司 一种视频播放方法、装置及系统
CN112184877A (zh) * 2020-09-30 2021-01-05 杭州电魂网络科技股份有限公司 辉光效果的渲染优化的方法和系统
CN113041617A (zh) * 2021-03-18 2021-06-29 深圳市腾讯网域计算机网络有限公司 一种游戏画面渲染方法、装置、设备及存储介质
CN113469883A (zh) * 2021-06-30 2021-10-01 完美世界(北京)软件科技发展有限公司 动态分辨率的渲染方法、装置、电子设备及可读存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10311548B2 (en) * 2017-09-05 2019-06-04 Microsoft Technology Licensing, Llc Scaling render targets to a higher rendering resolution to display higher quality video frames
CN107742317B (zh) * 2017-09-27 2020-11-03 杭州群核信息技术有限公司 结合光感及卷积网络的渲染方法、装置、系统及存储介质
CN110393921B (zh) * 2019-08-08 2022-08-26 腾讯科技(深圳)有限公司 云游戏的处理方法、装置、终端、服务器及存储介质

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108063938A (zh) * 2017-12-21 2018-05-22 深圳市得色科技有限公司 一种游戏引擎的裸眼3d成像显示方法及其系统
US20200134796A1 (en) * 2018-10-24 2020-04-30 Adobe Inc. Dynamic image resolution adjustment for rendering changes to graphical content
US20200242807A1 (en) * 2019-01-30 2020-07-30 Trivver, Inc. Texture based pixel count determination
CN111918125A (zh) * 2019-05-09 2020-11-10 腾讯科技(深圳)有限公司 一种视频播放方法、装置及系统
CN111309430A (zh) * 2020-03-16 2020-06-19 广东趣炫网络股份有限公司 一种自动缓存用户交互界面节点的方法和相关装置
CN112184877A (zh) * 2020-09-30 2021-01-05 杭州电魂网络科技股份有限公司 辉光效果的渲染优化的方法和系统
CN113041617A (zh) * 2021-03-18 2021-06-29 深圳市腾讯网域计算机网络有限公司 一种游戏画面渲染方法、装置、设备及存储介质
CN113469883A (zh) * 2021-06-30 2021-10-01 完美世界(北京)软件科技发展有限公司 动态分辨率的渲染方法、装置、电子设备及可读存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CAO, XINYI: "Unity Engine Based Red-cyan Stereoscopic Image Implementation Scheme Research", ADVANCED MOTION PICTURE TECHNOLOGY, 11 January 2021 (2021-01-11), pages 12 - 16, XP093019087, [retrieved on 20230130] *

Also Published As

Publication number Publication date
CN114913067A (zh) 2022-08-16
CN113469883B (zh) 2022-05-06
CN113469883A (zh) 2021-10-01

Similar Documents

Publication Publication Date Title
US20230053462A1 (en) Image rendering method and apparatus, device, medium, and computer program product
US11783536B2 (en) Image occlusion processing method, device, apparatus and computer storage medium
WO2023273114A1 (zh) 动态分辨率的渲染方法、装置、设备、程序和可读介质
US9516214B2 (en) Information processing device and information processing method
CN108604391A (zh) 基于虚拟/增强现实系统中的深度信息的时间扭曲调整
US20160301868A1 (en) Automated generation of panning shots
US20190073747A1 (en) Scaling render targets to a higher rendering resolution to display higher quality video frames
US20140240311A1 (en) Method and device for performing transition between street view images
KR20150018828A (ko) 주석들에 대한 이미지 중심의 뷰 관리
US9530243B1 (en) Generating virtual shadows for displayable elements
TW201215124A (en) Imaging apparatus, image processing method, and recording medium for recording program thereon
CN110968962B (zh) 基于云渲染在移动端或大屏三维展示方法及系统
US20190318457A1 (en) Image processing methods and apparatuses, computer readable storage media and electronic devices
CN112652046B (zh) 游戏画面的生成方法、装置、设备及存储介质
JP2004213641A (ja) 画像処理装置、画像処理方法、情報処理装置、情報処理システム、半導体デバイス、コンピュータプログラム
KR20210044506A (ko) 증강 현실 객체를 표시하는 장치 및 그 동작 방법
CN112053370A (zh) 基于增强现实的显示方法、设备及存储介质
WO2023125362A1 (zh) 一种图像显示方法、装置和电子设备
CN114531553B (zh) 生成特效视频的方法、装置、电子设备及存储介质
JP7467780B2 (ja) 画像処理方法、装置、デバイス及び媒体
CN108765582B (zh) 一种全景图片显示方法及设备
WO2019052338A1 (zh) 图像处理方法和装置、存储介质及电子装置
JP2004178036A (ja) 遠隔者の映像を伴う仮想空間の提示装置
WO2023125132A1 (zh) 特效图像处理方法、装置、电子设备及存储介质
CN111818265A (zh) 基于增强现实模型的交互方法、装置、电子设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21948040

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE