Rendering method and electronic equipment
By obtaining and judging the patch information in the real frame, the position prediction is only performed on the two-dimensional patch with unchanged shape and unchanged relative position of the vertices in the predicted frame, which solves the problem of patch jitter in the existing technology and improves the efficiency of the prediction frame. Predict frame clarity and user experience.
Patent Information
- Application Number
- CN202310203005.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-21
- Publication Date
- 2024-08-23
AI Technical Summary
In the field of electronic games and other fields, existing technology interpolates or moves pixels between real frames and predicted frames, causing the two-dimensional patch with unchanged shape and unchanged relative position of the vertices to be blurred in the predicted frame, causing jitter and reducing the user experience. .
By obtaining the rendering parameter information and absolute coordinates of the patches in the real frame, determine and determine the absolute coordinates of the target patches, and only predict the positions of these patches in the prediction frame without interpolating or moving their contents to ensure prediction The displayed content in the frame is consistent with the real frame.
It effectively reduces the jitter of two-dimensional patches in the prediction frame, improves the user experience, and ensures that patches with unchanged shape and relative vertex positions are equally clear in the prediction frame.
Smart Images

Figure CN118537467A
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a rendering method and an electronic device. Background Art
[0002] With the rapid development of electronic games, the rendering process of game engines is becoming more and more complicated, and the resource consumption is also increasing. The current mainstream method is to insert a predicted frame between or after two adjacent real frames after rendering to reduce the rendering overhead. In the prior art, the predicted frame is obtained by interpolating or moving two real frames according to pixels.
[0003] For a two-dimensional patch whose shape in the image remains unchanged and whose relative coordinates of vertices remain unchanged (i.e., the displayed content remains unchanged), for example Figure 1 If the text (XXX), icons (smiley face icons), health bars, etc. on the heads of the game characters in the electronic game shown are also interpolated or moved according to pixels, these faces will be blurred in the predicted frame but clear in the real frame (i.e., jitter will occur). Users can clearly perceive the difference between the predicted frame and the real frame, which greatly reduces the user experience. Summary of the invention
[0004] The embodiments of the present application provide a rendering method and an electronic device for reducing the jitter of two-dimensional surface display content in a predicted frame.
[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, a rendering method is provided, comprising: obtaining rendering parameter information of a first facet in a first real frame, the absolute coordinates of the first facet, rendering parameter information of a second facet in a second real frame, and the absolute coordinates of the second facet, wherein the first real frame and the second real frame are adjacent real frames; the first facet and the second facet refer to two-dimensional faces whose shapes remain unchanged and whose relative positions of vertices remain unchanged; if the rendering parameter information of the first facet and the rendering parameter information of the second facet are the same, and the absolute coordinates of the first facet and the absolute coordinates of the second facet are within a certain range, then determining the absolute coordinates of a target facet according to the absolute coordinates of the first facet and the absolute coordinates of the second facet, the target facet being located in a predicted frame obtained based on the first real frame and the second real frame; and rendering the target facet according to the absolute coordinates of the target facet and the rendering parameter information.
[0007] The rendering method provided in the embodiment of the present application, for two-dimensional patches whose shapes and relative positions of vertices remain unchanged (in essence, the displayed content remains unchanged), in the process of obtaining a predicted frame based on two real frames, only the moving position of such patches is predicted in the predicted frame, and the display content of such patches is not interpolated or moved according to pixels. The display content of such patches in the predicted frame still uses the display content in the real frame, which can ensure that such patches are also very clear in the predicted frame, reducing the jitter of the display content of the two-dimensional patches in the predicted frame.
[0008] In a possible implementation, the rendering parameter information of the first patch or the rendering parameter information of the second patch includes at least one of the following information: texture coordinates mapped to each vertex of the patch, an identifier of the program to which the patch belongs, and the number of vertices of the patch. The two patches are the same, which means that these parameters of the two patches are the same.
[0009] In a possible implementation, the vertex shader source code includes attribute information of the patch, and the attribute information is used to indicate that the patch is a two-dimensional patch with a constant shape and constant relative positions of vertices. One way is to determine whether the patch is a two-dimensional patch with a constant shape and constant relative positions of vertices through the attribute information of the patch.
[0010] In a possible implementation, determining the absolute coordinates of the target facet according to the absolute coordinates of the first facet and the absolute coordinates of the second facet includes: smoothing the absolute coordinates of the first facet and the absolute coordinates of the second facet to obtain the absolute coordinates of the target facet, so that the movement of the two-dimensional facet whose shape remains unchanged and the relative positions of the vertices remain unchanged in the predicted frame and the real frame is relatively smooth.
[0011] In a possible implementation, when the predicted frame is between the first real frame and the second real frame, the absolute coordinates P of the target patch are obtained by the following formula: P = (P1*W1+P2*W2) / (W1+W2), where P1 is the absolute coordinates of the first patch, P2 is the absolute coordinates of the second patch, and W1 and W2 are weight coefficients. This implementation is applicable to interpolated frames.
[0012] In a possible implementation, w1 and w2 are equal, and the target patch is located between the first patch and the second patch.
[0013] In a possible implementation, when the predicted frame is located after the first real frame and the second real frame, the absolute coordinates P of the target patch are obtained by the following formula: P=P2+(P2-P1)*W, where P1 is the absolute coordinates of the first patch, P2 is the absolute coordinates of the second patch, and W is the weight coefficient. This implementation is applicable to the extrapolated frame.
[0014] In a second aspect, an electronic device is provided, comprising a processor and a memory, wherein instructions are stored in the memory, and when the processor executes the instructions, the method described in the first aspect and any embodiment thereof is executed.
[0015] According to a third aspect, a computer-readable storage medium is provided, comprising instructions, which, when executed on an electronic device, enable the electronic device to execute the method according to the first aspect and any embodiment thereof.
[0016] In a fourth aspect, a computer program product comprising instructions is provided. When the instructions are executed on the electronic device, the electronic device executes the method as described in the first aspect and any embodiment thereof.
[0017] In a fifth aspect, a chip system is provided, the chip system including a processor for supporting an electronic device to implement the functions involved in the first aspect. In one possible design, the device also includes an interface circuit, which can be used to receive signals from other devices (such as a memory) or send signals to other devices (such as a communication interface). The chip system may include a chip and may also include other discrete devices.
[0018] The technical effects of the second to fifth aspects refer to the technical effects of the first aspect and any of its embodiments, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A schematic diagram of a two-dimensional facet with unchanged shape and unchanged relative coordinates of vertices provided in an embodiment of the present application;
[0020] Figure 2 A schematic diagram of three-dimensional modeling by splicing multiple facets provided in an embodiment of the present application;
[0021] Figure 3 A schematic diagram of a texture mapping provided in an embodiment of the present application;
[0022] Figure 4 A schematic diagram of an interpolated frame and an extrapolated frame provided in an embodiment of the present application;
[0023] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0024] Figure 6 A schematic diagram of a software architecture for running an electronic device provided in an embodiment of the present application;
[0025] Figure 7 A flowchart of a rendering method provided in an embodiment of the present application;
[0026] Figure 8A schematic diagram of a facet provided in an embodiment of the present application in which the shape, relative position of vertices and viewing angle do not change;
[0027] Fig. 9 A schematic diagram of the absolute coordinate relationship between a target face, a first face, and a second face when an interpolation frame is provided in an embodiment of the present application;
[0028] Fig.10 A schematic diagram of the absolute coordinate relationship between a target face, a first face, and a second face when an extrapolation frame is provided in an embodiment of the present application;
[0029] Fig.11 A flowchart of another rendering method provided in an embodiment of the present application;
[0030] Fig.12 A flowchart of another rendering method provided in an embodiment of the present application;
[0031] Fig.13 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] First, some concepts involved in this application are described.
[0033] The terms "first", "second", etc. involved in the embodiments of the present application are only used to distinguish features of the same type and cannot be understood as indicating relative importance, quantity, order, etc.
[0034] The terms "exemplary" or "for example" and the like in the embodiments of the present application are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the terms "exemplary" or "for example" is intended to present the related concepts in a specific way.
[0035] The terms "coupling" and "connection" involved in the embodiments of the present application should be understood in a broad sense. For example, they may refer to a direct physical connection, or an indirect connection achieved through electronic devices, such as a connection achieved through resistors, inductors, capacitors or other electronic devices.
[0036] Graphics rendering engine: Graphics rendering engine is used to model the objects in the image, then render the model, such as adding color, lighting, shadows, etc., and finally display it on the screen. Currently, several mainstream graphics rendering engines include open graphics library (OpenGL), Metal, Vulkan, DirectX, etc. This application uses OpenGL as an example for explanation, but is not intended to be limited to this.
[0037] Open Graphics Library (OpenGL) is a cross-language, cross-platform application programming interface (API) for rendering two-dimensional (2D) or three-dimensional (3D) vector graphics. OpenGL is commonly used in computer-aided design (CAD), virtual reality (VR), augmented reality (AR), scientific visualization programs, and video game development. The present application embodiment takes mobile games as an example, but is not intended to be limited to this.
[0038] A shader is an editable program used to implement image rendering. Unless otherwise specified, the shaders involved in this application are all described using OpenGL shaders as examples. OpenGL shaders include vertex shaders and fragment shaders. Vertex shaders are mainly responsible for the geometric relationship calculation of vertices, and fragment shaders are mainly responsible for the calculation of the color of patches (for patches, see the following description). Since shaders are editable, a variety of image effects can be achieved without being restricted by the fixed rendering pipeline of the graphics card.
[0039] The vertex shader is essentially a program code that is called at each vertex to process the data of each vertex (such as vertex coordinates, normals, colors, and texture coordinates), such as vertex coordinate transformation, texture coordinate generation and transformation, lighting, color material application, etc. In other words, each vertex must execute the program in the main function of the vertex shader.
[0040] Absolute coordinates of vertices: In OpenGL, all objects are located in 3D space, but the screen is 2D pixels, so OpenGL will transform the 3D coordinates of the vertex into 2D coordinates that adapt to the screen through various transformations, and finally project them onto the screen. The coordinates of the vertex in the screen space are the absolute coordinates of the vertex. The OpenGL shader language provides the following predefined variables for the vertex shader: Graphics library position variable (gl_Position), which is used to represent the absolute coordinates of the vertex in the screen space.
[0041] Absolute coordinates of a patch: Since a patch includes multiple vertices, the coordinates of each vertex in the patch are maintained in the form of an array. Therefore, for the convenience of description, this application exemplarily uses the coordinates of the first vertex in the array in the patch as the absolute coordinates of the patch.
[0042] like Figure 2 As shown in the figure, the surface of an object can be modeled in three dimensions by stitching together multiple basic shapes (such as triangles). Each basic shape is called a patch. The more patches there are, the more detailed the modeling is. The fragment shader is the code that runs at each pixel on each patch. It is used to calculate and fill the color of a single pixel. It can also perform operations such as interpolation, texture mapping, texture application, and color summation on the pixels.
[0043] Texture, texture coordinates and texture mapping: To make the rendered objects more realistic, on the one hand, a larger number of patches can be used to model the surface of the object, and on the other hand, Figure 3 As shown in the figure, the coordinates of the vertices of the patch on the surface of the object can be mapped to the coordinates of the modeled object surface (texture coordinates), so that the corresponding texture is displayed on the patch. This process is texture mapping, and the texture coordinates are represented by the UV coordinate system. This not only makes the rendered model surface more detailed, but also is more convenient and efficient.
[0044] OpenGL shaders are written in OpenGL shading language (GLSL). Since shaders are independent programs, the shader source code can be stored as a separate script for application calls, or it can be called directly in memory as a string. The shader source code is compiled to obtain a shader object, and then multiple shader objects are linked together to form a shader program. The sender's shader declares an output type variable A, and the receiver's shader declares an input type variable A. When compiling and linking, the two shaders with the same name A will be linked together.
[0045] A uniform variable is a special variable in a shader program that can be accessed and remains consistent throughout the execution of the shader program.
[0046] The viewport is a rectangular area in the window used to display graphics.
[0047] Insertion: Figure 4 As shown, in the prior art, after rendering two adjacent real frames, a Figure 4 The interpolated frame shown in A) or after these two real frames ( Figure 4The predicted frame is obtained by interpolating or moving the two real frames according to the pixels. In this process, the type of facets is not distinguished. For two-dimensional faces whose shapes and relative positions of vertices in the image remain unchanged, if they are also interpolated or moved according to the pixels, these faces will be blurred in the predicted frame but clear in the real frame (i.e., jitter). Users can clearly perceive the difference between the predicted frame and the real frame, which greatly reduces the gaming experience.
[0048] The rendering method and electronic device provided in the embodiment of the present application, for two-dimensional facets whose shapes remain unchanged and whose relative positions of vertices remain unchanged (in essence, the displayed content remains unchanged), only predicts the position of the movement of such facets in the predicted frame, and does not interpolate or move the displayed content of such facets according to the pixels. The displayed content in the predicted frame still uses the displayed content in the real frame, so that these facets can be ensured to be clear in the predicted frame, and the jitter of the displayed content of the two-dimensional facets in the predicted frame is reduced. It can be applied not only to electronic games (such as mobile games) but also to CAD, VR, AR, scientific visualization programs, etc.
[0049] like Figure 5 As shown, the electronic device 101 provided in the embodiment of the present application can be a device with a display function, and the electronic device 101 can be mobile or fixed. The electronic device 101 can be deployed on land (for example, indoors or outdoors, handheld or vehicle-mounted, etc.), can be deployed on the water surface (for example, a ship, etc.), and can also be deployed in the air (for example, an airplane, etc.). The electronic device 101 can be called user equipment (UE), an access terminal, a terminal unit, a subscriber unit, a terminal station, a mobile station (MS), a mobile station, a terminal agent or a terminal device, etc. For example, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a virtual reality device, an augmented reality device, etc. The embodiment of the present application does not limit the specific type and structure of the electronic device. A possible structure of the electronic device is described below.
[0050] Taking the electronic device as a mobile phone as an example, the electronic device 101 may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a power management module 240, a battery 241, a wireless charging coil 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294 and a subscriber identification module (SIM) card interface 295, etc.
[0051] Among them, the sensor module 280 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.
[0052] It is understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 101. In other embodiments of the present application, the electronic device 101 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0053] The processor 210 may include one or more processing units, for example, the processor 210 may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processing unit (CPU), an application processor (AP), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a baseband processor, and a neural network processor (NPU). Among them, different processing units may be independent devices or integrated into one or more processors. For example, the processor 210 may be an application processor AP. Alternatively, the processor 210 may be integrated into a system on chip (SoC). Alternatively, the processor 210 may be integrated into an integrated circuit (IC) chip. The processor 210 may include an analog front end (AFE) and a micro-controller unit (MCU) in an IC chip. The processor 210 may be the nerve center and command center of the electronic device 101. The processor 210 may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0054] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.
[0055] In some embodiments, the processor 210 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a USB interface, etc.
[0056] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 101. In other embodiments of the present application, the electronic device 101 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0057] The power management module 240 is used to receive charging input from a charger. The charger may be a wireless charger (such as a wireless charging base of the electronic device 101 or other device that can wirelessly charge the electronic device 101), or a wired charger. For example, the power management module 240 may receive charging input from a wired charger through the USB interface 230. The power management module 240 may receive wireless charging input through the wireless charging coil 242 of the electronic device.
[0058] The power management module 240 can charge the battery 241 and also power the electronic device. The power management module 240 receives input from the battery 241 and powers the processor 210, the internal memory 221, the external memory interface 220, the display screen 294, the camera 293, and the wireless communication module 260. The power management module 240 can also be used to monitor parameters such as the battery capacity, the number of battery cycles, and the battery health status (leakage, impedance) of the battery 241. In some other embodiments, the power management module 240 can also be set in the processor 210.
[0059] The wireless communication function of the electronic device 101 can be implemented through the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, the modem processor, the baseband processor, etc.
[0060] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 101 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0061] The mobile communication module 250 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 101. The wireless communication module 260 can provide solutions for wireless communications including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc., applied to the electronic device 101. In some embodiments, the antenna 1 of the electronic device 101 is coupled to the mobile communication module 250, and the antenna 2 is coupled to the wireless communication module 260, so that the electronic device 101 can communicate with the network and other devices through wireless communication technology.
[0062] The electronic device 101 implements the display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations and is used for GPU rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or change display information.
[0063] The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. In some embodiments, the electronic device 101 may include 1 or N display screens 294, where N is a positive integer greater than 1.
[0064] The electronic device 101 can realize the shooting function through an ISP, a camera 293, a video codec, a GPU, a display screen 294, and an application processor. The ISP is used to process the data fed back by the camera 293. In some embodiments, the ISP can be set in the camera 293. The camera 293 is used to capture a static image or a video. In some embodiments, the electronic device 101 may include 1 or N cameras 293, where N is a positive integer greater than 1. Exemplarily, the camera of the embodiment of the present application includes a wide-angle camera and a main camera.
[0065] The external memory interface 220 can be used to connect an external memory card, such as a micro SanDisk (Micro SD) card, to expand the storage capacity of the electronic device 101. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0066] The internal memory 221 may be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the electronic device 101 by running the instructions stored in the internal memory 221. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0067] The memory involved in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0068] The electronic device 101 can implement audio functions such as music playing and recording through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the headphone interface 270D and the application processor.
[0069] The audio module 270 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. In some embodiments, the audio module 270 can be arranged in the processor 210, or some functional modules of the audio module 270 can be arranged in the processor 210. The speaker 270A, also known as the "speaker", is used to convert the audio electrical signal into a sound signal. The receiver 270B, also known as the "earpiece", is used to convert the audio electrical signal into a sound signal. The microphone 270C, also known as the "microphone", is used to convert the sound signal into an electrical signal. The electronic device 101 can be provided with at least one microphone 270C. The headphone interface 270D is used to connect a wired headset. The headphone interface 270D can be a USB interface 230, or it can be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0070] The button 290 includes a power button, a volume button, etc. The button 290 may be a mechanical button. It may also be a touch button. The electronic device 101 may receive a button input and generate a key signal input related to the user settings and function control of the electronic device 101. The motor 291 may generate a vibration prompt. The motor 291 may be used for an incoming call vibration prompt or for touch vibration feedback. The indicator 292 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 295 is used to connect a SIM card. The SIM card may be inserted into or removed from the SIM card interface 295 to achieve contact and separation with the electronic device 101. The electronic device 101 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 295 may support a Nano SIM card, a Micro SIM card, a SIM card, etc. In some embodiments, the electronic device 101 uses an embedded SIM (eSIM) card. The eSIM card can be embedded in the electronic device 101 and cannot be separated from the electronic device 101.
[0071] The processor 210 or GPU executes the rendering method provided in the embodiment of the present application by executing the program and instructions stored in the internal memory 221. The program run by the processor 210 can be based on an operating system, such as Android. Apple (iOS) Windows operating system, etc.
[0072] like Figure 6 As shown, the program running on the processor 210 is based on Android For example, the programs run by the processor 210 are layered according to their functions, and may include an application layer, a framework layer, a local layer, a kernel layer, and a driver layer.
[0073] The application layer can include various applications that require GPU rendering, such as CAD, video games, AR / VR applications, scientific visualization programs, etc.
[0074] The framework layer is used to provide application programming interfaces (APIs) and system resource services to applications in the application layer, such as a GPU rendering API. The rendering method involved in the present application can be implemented in the framework layer on the CPU side or in the GPU. For example, the implementation in the framework layer on the CPU side is used as an example for explanation, but it is not intended to be limited to this.
[0075] The local layer can provide a static link library or a dynamic link library for the API call of the framework layer, for example, providing a static link library or a dynamic link library to the GPU rendering API in the framework layer.
[0076] The kernel layer includes the operating system (OS) kernel, which is used to manage the system's processes, memory, drivers, file systems, and network systems.
[0077] The driver layer is used to drive the hardware resources of the hardware layer. The driver layer may include a GPU driver.
[0078] like Figure 7 As shown, for a two-dimensional face with unchanged shape and unchanged relative positions of vertices (in essence, unchanged display content), the rendering method provided in the embodiment of the present application includes:
[0079] S101 , obtaining rendering parameter information of a first facet in a first real frame, absolute coordinates of the first facet, and rendering parameter information of a second facet in a second real frame, and absolute coordinates of the second facet.
[0080] The first real frame and the second real frame are adjacent real frames; the first patch and the second patch both refer to two-dimensional patches with unchanged shapes and unchanged relative positions of vertices. In the following text, this type of patch is simply referred to as a stable patch. Among them, the relative position of vertices refers to the relative positions among the vertices in the same patch. For example, for Figure 8 the patches such as the text (XXX), icon (smiley icon), and health bar on the head of the game character in the shown video game, regardless of whether the displayed game character performs near and far zooming (A), turning (B), moving (C), or changing posture (D), the shapes, relative positions of vertices, and perspectives of these patches will not change, that is, the displayed content remains unchanged.
[0081] Regarding the absolute coordinates of the patch, see the previous description and will not be elaborated here. The rendering parameter information of the patch includes at least one of the following information: the texture coordinates mapped by each vertex of the patch, the identifier of the program to which the patch belongs, and the number of vertices of the patch.
[0082] Step S101 can be executed during the process of rendering the real frame.
[0083] S102. If the rendering parameter information of the first patch is the same as that of the second patch, and the absolute coordinates of the first patch and the second patch are within a certain range, then determine the absolute coordinates of the target patch according to the absolute coordinates of the first patch and the second patch.
[0084] The target patch is located in the predicted frame obtained based on the first real frame and the second real frame, and describes the same content as the first patch and the second patch (such as the same text, the same icon, the same health bar, etc.).
[0085] First, determine the same content described by the first patch and the second patch in two adjacent real frames. If the texture coordinates mapped by each vertex in the first patch are the same as those mapped by each vertex in the second patch, the identifier of the program to which the first patch belongs is the same as that of the program to which the second patch belongs, and the number of vertices of the first patch is the same as that of the second patch. On this basis, if the difference between the absolute coordinate P1 of the first patch and the absolute coordinate P2 of the second patch is less than the distance threshold (i.e., |P1 - P2| < Th), then it can be determined that the first patch and the second patch describe the same content in two adjacent real frames.
[0086] Second, the difference between the absolute coordinate P1 (i.e., gl_Position) of the first patch and the absolute coordinate P2 of the second patch is the movement amount of the second patch relative to the first patch. Therefore, the absolute coordinates of the first patch and the second patch can be smoothed to obtain the absolute coordinates of the target patch in the predicted frame. This makes the movement of the two-dimensional patch with unchanged shape and unchanged relative position of vertices smoother in the predicted frame and the real frame.
[0087] For an interpolated frame (i.e., a predicted frame is located between the first real frame and the second real frame), Fig. 9 As shown, the absolute coordinates P of the target patch can be obtained by the following formula: P = (P1*W1+P2*W2) / (W1+W2), where P1 is the absolute coordinates of the first patch, P2 is the absolute coordinates of the second patch, and W1 and W2 are weight coefficients. In particular, W1 and W2 can be equal, in which case the target patch is located between the first patch and the second patch.
[0088] For the extrapolated frame (i.e., the predicted frame is located after the first real frame and the second real frame), Fig.10 As shown, the absolute coordinates P of the target face can be obtained by the following formula: P=P2+(P2-P1)*W, where P1 is the absolute coordinates of the first face, P2 is the absolute coordinates of the second face, and W is the weight coefficient.
[0089] Step S102 may be performed during the process of rendering a real frame or may be performed during the process of rendering a predicted frame.
[0090] S103: Render the target face patch according to the absolute coordinates of the target face patch and the rendering parameter information.
[0091] Among them, since the rendering parameter information of the first patch is the same as the rendering parameter information of the second patch, the rendering parameter information of the target patch also uses the same rendering parameter information. When rendering the target patch, the target patch is rendered according to the absolute coordinates of the target patch and the rendering parameter information, and is drawn to the main scene of the prediction frame. That is, at the absolute coordinates of the target patch, rendering is performed according to the texture coordinates mapped to each vertex of the patch.
[0092] Step S103 may be performed during the process of rendering a real frame or may be performed during the process of rendering a predicted frame.
[0093] The rendering method provided in the embodiment of the present application, for two-dimensional patches whose shapes and relative positions of vertices remain unchanged (in essence, the displayed content remains unchanged), in the process of obtaining a predicted frame based on two real frames, only the moving position of such patches is predicted in the predicted frame, and the display content of such patches is not interpolated or moved according to pixels. The display content of such patches in the predicted frame still uses the display content in the real frame, which can ensure that such patches are also very clear in the predicted frame, reducing the jitter of the display content of the two-dimensional patches in the predicted frame.
[0094] The following is an explanation of the above rendering method in combination with the complete rendering process of the real frame and the predicted frame. Fig.11 As shown, the rendering method includes:
[0095] S201, obtaining image rendering source code.
[0096] like Fig.12 As shown in S301, for the rendering workflow, the GPU rendering API of the framework layer loads the image rendering source code (including the vertex shader source code and the fragment shader source code) through the shader source code acquisition function (glShaderSource), and obtains and saves the real frame information therefrom. The real frame information includes but is not limited to the attribute information, absolute coordinates (i.e., gl_Position) and rendering parameter information of each face in the real frame. For the absolute coordinates (i.e., gl_Position) and rendering parameter information of the face, refer to the previous description and will not be repeated here.
[0097] The vertex shader source code includes the attribute information of the patch, which is used to indicate whether the patch is a two-dimensional patch without depth information (i.e., it will not change with the viewing angle), with an unchanged shape and unchanged relative positions of vertices (i.e., the displayed content), i.e., the stable patch mentioned above. Then, when interpolating two adjacent real frames to obtain a predicted frame, for such a stable patch, it is not necessary to use the existing method of interpolating or moving pixels to obtain the patch in the predicted frame.
[0098] In one embodiment, in the image rendering source code, the attribute information of the face patch can be set to word to indicate that the face patch is drawn with text, the attribute information of the face patch can be set to icon to indicate that the face patch is drawn with an icon, the attribute information of the face patch can be set to blood to indicate that the face patch is drawn with a health bar, and so on, thereby indicating that the face patch is a stable face patch.
[0099] In another embodiment, the stable patch is usually drawn after the main scene of the real frame or the predicted frame is drawn. Therefore, the patch indicated to be drawn after the main scene drawing is completed in the image rendering source code is the stable patch.
[0100] S202. Replace the source code of the vertex shader of the stable patch and compile it.
[0101] like Fig.12 As shown in S302 , for the prediction workflow, first determine whether each patch is a stable patch based on the patch's attribute information. For stable patches, replace the source code of its vertex shader and compile; for other patches, compile directly.
[0102] It should be noted that the source code of the vertex shader of other facets in the image rendering source code except for the stable facets is not modified, and is still compiled according to the original logic before rendering. For example, the real frame is rendered according to the rendering method in the prior art, and the two adjacent real frames are interpolated according to the interpolation method in the prior art to obtain the predicted frame and render it, which will not be repeated in this application.
[0103] like Fig.12 As shown in S303, after the application in the CPU (such as the engine of an electronic game) is started, it passes a rendering command to the framework layer in the CPU, and then the CPU transmits a drawing initiation (DrawCall) command to the GPU to instruct the GPU to render (including real frames and predicted frames).
[0104] S203: If the real frame is rendered, all the faces in the real frame are rendered and then drawn onto the main scene of the real frame, so as to obtain the real frame.
[0105] The real frame and the predicted frame are cached in different frame buffers. For example, the real frame is cached in the first frame buffer, and the predicted frame is cached in the second frame buffer. Alternatively, the real frame and the predicted frame are cached in two different areas of the same frame buffer. For example, if the size of a single frame is A*B (A is the width and B is the height), the real frame can be cached in the left half of the 2A*B frame buffer, and the predicted frame can be cached in the right half of the frame buffer. The rendering parameter information and absolute coordinates of each facet are stored in a data list. The data list can be located in the shader storage buffer object (SSBO) of the GPU, and the real frame and the predicted frame are bound to different SSBOs respectively; alternatively, the data list can also be located in the CPU, which is not limited in this application.
[0106] like Fig.12 As shown in S304, for a real frame, the prediction workflow sets the rendering flag of the frame through a uniform variable to indicate that the frame is a real frame, so that the rendering workflow can distinguish whether to render a real frame or a predicted frame when rendering.
[0107] like Fig.12 As shown in S305, for the rendering workflow, the GPU rendering API renders each patch (including the stable patch) in the real frame through the patch drawing function (glDrawElements). Optionally, when the real frame and the predicted frame are cached in two different areas of the same frame cache, the viewport can also be set to indicate in which area (for example, the left half area) the real frame is rendered.
[0108] In the real frame, the rendering and drawing of the stable face, as well as the rendering and drawing of other face, can still be done in the original source code without modification. Fig.12 As shown in S307, after all stable patches in the real frame are rendered, they are drawn onto the main scene of the real frame, thus obtaining the real frame.
[0109] In addition, the predicted frame needs to be predicted. For other patches in the real frame except the stable patch, the preset frame can still be obtained by interpolating or moving pixels in the prior art.
[0110] S204: Obtain and store rendering parameter information and absolute coordinates of the stable patch in the real frame.
[0111] For each real frame, the rendering parameter information and absolute coordinates of the stable patch in the real frame are stored. Exemplarily, the rendering parameter information and absolute coordinates of the stable patch in the real frame can be stored in the data list of the real frame.
[0112] Since the target patch in the predicted frame is to be rendered later, if the predicted frame is to be rendered, it is necessary to first obtain stable patches describing the same content in two adjacent real frames. It is assumed that the two adjacent real frames are the first real frame and the second real frame, and the first patch in the first real frame and the second patch in the second real frame are both stable patches.
[0113] In the process of drawing the first real frame, after the vertex shader of the first face is run, the original source code is run to calculate each vertex of the first face, and the rendering parameter information of the first face in the first real frame and the absolute coordinates of the first face are obtained and saved.
[0114] In the process of drawing the second real frame, after the vertex shader of the second face is run, the original source code is run to calculate each vertex of the second face, and the rendering parameter information of the second face in the second real frame and the absolute coordinates of the second face are obtained and saved.
[0115] This step can obtain the rendering parameter information and absolute coordinates of the first face in the first real frame, and the rendering parameter information and absolute coordinates of the second face in the second real frame, which corresponds to the aforementioned step S101.
[0116] S205: Predict the absolute coordinates of the stable patch in the prediction frame.
[0117] In the process of drawing the second real frame, the data list of the previous real frame is traversed to find the first face that matches the second face, so as to determine that the first face and the second face describe the same content (such as the same text, the same icon, the same health bar, etc.) in two adjacent real frames, which corresponds to the target face in the predicted frame. Specifically, if the rendering parameter information of the first face is the same as the rendering parameter information of the second face, and the absolute coordinates of the first face and the absolute coordinates of the second face are within a certain range, it can be determined that the first face and the second face describe the same content in two adjacent real frames, and the absolute coordinates of the target face can be determined in the predicted frame. For how to determine the absolute coordinates of the target face, refer to the description of step S102, which will not be repeated here.
[0118] This step corresponds to step S102 described above.
[0119] S206: Render the stable patches in the predicted frame.
[0120] Specifically, the target surface is rendered according to the absolute coordinates of the target surface and the rendering parameter information.
[0121] like Fig.12 As shown in S306, for the predicted frame, the prediction workflow sets the rendering flag of the frame through a uniform variable (Uniform) to indicate that the frame is a predicted frame. Optionally, when the real frame and the predicted frame are cached in two different areas of the same frame cache, the viewport (Viewport) can also be set to indicate in which area (for example, the right half area) the predicted frame is rendered. And the above-mentioned stable patch in the predicted frame is rendered through the patch drawing function (glDrawElements). This allows the rendering workflow to distinguish whether it is rendering a real frame or a predicted frame when rendering.
[0122] This step corresponds to step S103 described above.
[0123] S207: If the prediction frame is rendered, the rendered stable surface is drawn onto the main scene of the prediction frame, so as to obtain the prediction frame.
[0124] Since the rendering of the target face has been completed in the previous text, when rendering the predicted frame, the faces other than the stable face are still rendered in the original way and drawn to the main scene of the predicted frame. Then the rendered target face is overlaid and drawn on the main scene of the predicted frame to obtain a complete predicted frame.
[0125] like Fig.12 As shown in S308 , after completing the rendering of the main scene of the prediction frame, the prediction workflow will draw the rendered stable surface onto the main scene of the prediction frame.
[0126] like Fig.13 As shown, the embodiment of the present application also provides a chip system. The chip system 60 includes at least one processor 601 and at least one interface circuit 602. The at least one processor 601 and the at least one interface circuit 602 can be interconnected through a line. The processor 601 is used to support the electronic device to implement each step in the above method embodiment, such as Figure 7 , Fig.11 , Fig.12 In the method shown, at least one interface circuit 602 may be used to receive signals from other devices (eg, memory) or to send signals to other devices (eg, communication interface). The chip system may include a chip and may also include other discrete devices.
[0127] The present application also provides a computer-readable storage medium, which includes instructions. When the instructions are executed on the electronic device, the electronic device executes each step in the method embodiment, such as executing Figure 7 , Fig.11 , Fig.12 The method shown.
[0128] The present application also provides a computer program product including instructions. When the instructions are executed on the electronic device, the electronic device executes each step in the method embodiment, such as executing Figure 7 , Fig.11 , Fig.12 The method shown.
[0129] Regarding the technical effects of the chip system, computer-readable storage medium, and computer program product, refer to the technical effects of the previous method embodiments.
[0130] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0131] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0132] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0133] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0134] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one device or distributed on multiple devices. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0135] In addition, each functional module in each embodiment of the present application may be integrated into one device, or each module may exist physically separately, or two or more modules may be integrated into one device.
[0136] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or may include one or more servers, data centers and other data storage devices that can be integrated with the medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).
[0137] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A rendering method, It is characterized in that include: Obtaining rendering parameter information of a first facet in a first real frame, the absolute coordinates of the first facet, and rendering parameter information of a second facet in a second real frame, and the absolute coordinates of the second facet, wherein the first real frame and the second real frame are adjacent real frames; The first face patch and the second face patch are two-dimensional face patches with unchanged shapes and unchanged relative positions of vertices; If the rendering parameter information of the first patch is the same as the rendering parameter information of the second patch, and the absolute coordinates of the first patch and the absolute coordinates of the second patch are within a certain range, determining the absolute coordinates of a target patch according to the absolute coordinates of the first patch and the absolute coordinates of the second patch, and the target patch is located in a predicted frame obtained based on the first real frame and the second real frame; The target surface is rendered according to the absolute coordinates of the target surface and the rendering parameter information.
2. The method according to claim 1, It is characterized in that The rendering parameter information of the first patch or the rendering parameter information of the second patch includes at least one of the following information: texture coordinates mapped to each vertex of the patch, an identifier of a program to which the patch belongs, and the number of vertices of the patch.
3. The method according to claim 1 or 2, It is characterized in that The vertex shader source code includes attribute information of the patch, and the attribute information is used to indicate that the patch is a two-dimensional patch with a constant shape and constant relative positions of vertices.
4. The method according to any one of claims 1 to 3, It is characterized in that The determining the absolute coordinates of the target surface patch according to the absolute coordinates of the first surface patch and the absolute coordinates of the second surface patch comprises: The absolute coordinates of the first face patch and the absolute coordinates of the second face patch are smoothed to obtain the absolute coordinates of the target face patch.
5. The method according to claim 4, It is characterized in that When the predicted frame is located between the first real frame and the second real frame, the absolute coordinate P of the target patch is obtained by the following formula: P = (P1*W1+P2*W2) / (W1+W2), where P1 is the absolute coordinate of the first patch, P2 is the absolute coordinate of the second patch, and W1 and W2 are weight coefficients.
6. The method according to claim 5, It is characterized in that w1 and w2 are equal.
7. The method according to claim 4, It is characterized in that When the predicted frame is located after the first real frame and the second real frame, the absolute coordinate P of the target patch is obtained by the following formula: P=P2+(P2-P1)*W, where P1 is the absolute coordinate of the first patch, P2 is the absolute coordinate of the second patch, and W is the weight coefficient.
8. An electronic device, It is characterized in that The method comprises a processor and a memory, wherein the memory stores instructions, and when the processor executes the instructions, the method according to any one of claims 1 to 7 is executed.
9. A computer-readable storage medium, It is characterized in that The method comprises instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Image processing method and device, medium and product
CN121582424A
Rendering method and electronic device
EP4528656A1
Rendering method and electronic device
EP4528656B1
Rendering method and electronic device
WO2024174655A1
