Interface image rendering method and device, storage medium, and terminal
By pre-mixing the rendering interface maps and using one interface rendering instruction for rendering, the problem of low rendering efficiency of the game UI interface is solved and efficient rendering effects are achieved.
Patent Information
- Application Number
- CN202111553737.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2041-12-17
AI Technical Summary
In the existing technology, the rendering efficiency of the game UI interface is low, mainly because the frequent calling of DrawCall instructions causes CPU overload and GPU idleness.
The interface map is obtained by pre-mixing and rendering at least one layer of map patches, and is rendered to the target frame based on an interface rendering instruction, reducing the number of DrawCall instructions. The rendering is performed using a mixed configuration method of transparency channel color values and three-channel color values.
It greatly improves the rendering efficiency of interface images, reduces system processing pressure, and ensures the invariance of rendering effects.
Smart Images

Figure CN114225403B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game technology, and in particular to a method and device for rendering an interface image, a storage medium, and a terminal. Background Art
[0002] With the rapid development of online games, the rendering effects of game UIs are attracting a large number of game users. Therefore, more and more game developers are focusing on the rendering of game UIs. DrawCall is the draw count of the cross-language, cross-platform application programming interface (API) used to render 2D and 3D vector graphics. Graphics drawing interfaces such as OpenGL (Open Graphics Library), D3D (Direct3D), and Vulkan can use DrawCall to represent the drawing interface and the draw count.
[0003] Currently, the rendering of each game UI interface is done by overlaying and mixing a large number of facets in multiple layers, and then rendering them layer by layer from the bottom up in sequence during each frame rendering. This requires calling a large number of DrawCall instructions, that is, a DrawCall instruction is called for each layer of facet overlay rendering. However, since the DrawCall instruction prepares the facet data to be rendered and notifies the GPU to execute the rendering instruction each time, when rendering a large number of facets, the CPU will submit a corresponding number of DrawCalls, which will cause the CPU to overload and cause the GPU to become idle, resulting in low rendering efficiency of the game UI interface. Summary of the Invention
[0004] In view of this, the present invention provides a method and device for rendering an interface image, a storage medium, and a terminal, the main purpose of which is to solve the problem of low efficiency in existing interface image rendering.
[0005] According to one aspect of the present invention, a method for rendering an interface image is provided, comprising:
[0006] Under the interface rendering operation condition of the target frame, obtaining an interface map matching the target frame, wherein the interface map is obtained by mixed rendering based on at least one layer of map patches;
[0007] Retrieve an interface rendering instruction corresponding to the interface map;
[0008] The interface map is rendered onto the target frame through the interface rendering instruction to obtain an interface image of the target frame.
[0009] Furthermore, before obtaining the interface map matching the target frame, the method further includes:
[0010] Obtain at least one layer of texture patches of the target frame to be rendered;
[0011] The transparency channel color value of the texture to be mixed and rendered is configured based on the transparency channel color value of each layer of texture patches;
[0012] The interface map is configured based on the transparency channel color value and the three-channel color value of each layer of map patch. Figure 3 Channel color value;
[0013] Based on the color value of the transparency channel of the map and the Figure 3 The channel color values are mixed and rendered onto the target canvas to obtain an interface map.
[0014] Furthermore, the step of configuring the texture transparency channel color value to be mixed and rendered based on the transparency channel color values of each layer of texture patches includes:
[0015] Determine a canvas transparency channel color value of a target canvas, and initialize and configure the canvas transparency channel color value and a first mixed rendering mode;
[0016] According to the first mixed rendering mode, the transparency channel color values of the map patches of each layer are subjected to mixed rendering calculation, and the result of the mixed rendering calculation is configured as the transparency channel color value of the map of the target canvas.
[0017] Furthermore, the interface map is configured by mixing the color value of the transparency channel and the three-channel color values of the map patches of each layer. Figure 3 Channel color values include:
[0018] Determine the target canvas Figure 3 Channel color value, and initialize the configuration of the sticker Figure 3 Channel color value, second mixed rendering mode;
[0019] According to the second mixed rendering mode, the transparency channel color value of each layer of the texture patch and the three-channel color value of each layer of the texture patch are mixed and rendered, and the result of the mixed rendering calculation is configured as the texture of the target canvas. Figure 3 Channel color value.
[0020] Furthermore, the color value of the transparency channel of the map and the Figure 3 The channel color values are mixed and rendered onto the target canvas to obtain an interface map including:
[0021] Retrieve at least one texture rendering instruction that matches the target canvas;
[0022] The texture rendering instruction is executed according to the color value of the texture transparency channel, the texture Figure 3 The channel color value performs a mixed rendering operation on the layers of map patches to obtain an interface map.
[0023] Furthermore, rendering the interface map onto the target frame through the interface rendering instruction to obtain the interface image of the target frame includes:
[0024] Determine the target frame three-channel color values of the target frame, and initialize and configure the target frame three-channel color values and a third mixed rendering mode;
[0025] The interface rendering instruction is used according to the third mixed rendering mixing mode, combining the texture transparency channel color value, texture Figure 3 The channel color values are mixed and rendered on the three-channel color values of the target frame to obtain a rendering interface.
[0026] Furthermore, obtaining at least one layer of texture patches of the target frame to be rendered includes:
[0027] When it is detected that at least one layer of texture patches of the target frame is updated, the updated at least one layer of texture patches of the target frame to be rendered is obtained to re-perform mixed rendering of the interface texture.
[0028] According to another aspect of the present invention, a device for rendering an interface image is provided, comprising:
[0029] An acquisition module is used to acquire an interface map that matches the target frame under the interface rendering operation condition of the target frame, wherein the interface map is obtained by mixed rendering based on at least one layer of map patches;
[0030] A calling module, used for calling an interface rendering instruction corresponding to the interface map;
[0031] A rendering module is used to render the interface map onto the target frame through the interface rendering instruction to obtain the interface image of the target frame.
[0032] Furthermore, the device further includes: a first configuration module, a second configuration module,
[0033] The acquisition module is further used to acquire at least one layer of map patches of the target frame to be rendered;
[0034] The first configuration module is used to mix and configure the transparency channel color value of the texture to be mixed and rendered based on the transparency channel color value of each layer of texture surface;
[0035] The second configuration module is used to mix and configure the interface map based on the transparency channel color value and the three-channel color values of each layer of map surface. Figure 3 Channel color value;
[0036] The rendering module is also used to generate a color image based on the transparency channel color value of the map and the color image of the map. Figure 3 The channel color values are mixed and rendered onto the target canvas to obtain an interface map.
[0037] Furthermore, the first configuration module includes:
[0038] A first determining unit, configured to determine a color value of a canvas transparency channel of a target canvas, and to initialize and configure the color value of the canvas transparency channel and a first mixed rendering mode;
[0039] The first configuration unit is configured to perform mixed rendering calculation on the transparency channel color values of the texture patches of each layer according to the first mixed rendering mode, and configure the result of the mixed rendering calculation as the texture transparency channel color value of the target canvas.
[0040] Furthermore, the second configuration module includes:
[0041] The second determining unit is used to determine the target canvas Figure 3 Channel color value, and initialize the configuration of the sticker Figure 3 Channel color value, second mixed rendering mode;
[0042] The second configuration unit is used to perform mixed rendering calculation on the transparency channel color value of each layer of the texture surface and the three-channel color value of each layer of the texture surface according to the second mixed rendering mode, and configure the result of the mixed rendering calculation as the texture of the target canvas. Figure 3 Channel color value.
[0043] Furthermore, the rendering module includes:
[0044] A calling unit, configured to call at least one texture rendering instruction matching a target canvas;
[0045] The first execution unit is used to execute the color value of the transparency channel of the texture, the texture rendering instruction, Figure 3 The channel color value performs a mixed rendering operation on the layers of map patches to obtain an interface map.
[0046] Furthermore, the rendering module further includes:
[0047] A third determining unit is configured to determine a target frame three-channel color value of the target frame, and initialize and configure the target frame three-channel color value and a third mixed rendering mode;
[0048] The second execution unit is used to combine the texture transparency channel color value, texture quality and texture quality of the interface texture according to the third mixed rendering mixing mode through the interface rendering instruction. Figure 3 The channel color values are mixed and rendered on the three-channel color values of the target frame to obtain a rendering interface.
[0049] Furthermore, the acquisition module is specifically configured to acquire at least one layer of updated texture patches of the target frame to be rendered when detecting that at least one layer of texture patches of the target frame is updated, so as to re-perform mixed rendering of the interface texture.
[0050] According to another aspect of the present invention, a storage medium is provided, in which at least one executable instruction is stored. The executable instruction enables a processor to execute operations corresponding to the above-mentioned method for rendering an interface image.
[0051] According to another aspect of the present invention, there is provided a terminal, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;
[0052] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned interface image rendering method.
[0053] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:
[0054] The present invention provides a method and device for rendering an interface image, a storage medium, and a terminal. An embodiment of the present invention obtains an interface map that matches a target frame under the interface rendering operation condition of a target frame, wherein the interface map is obtained by mixed rendering based on at least one layer of map patches; calls an interface rendering instruction corresponding to the interface map; and renders the interface map onto the target frame through the interface rendering instruction to obtain an interface image of the target frame, thereby greatly reducing the number of times the interface rendering instruction is called and reducing the processing pressure of the system. At the same time, it ensures the invariance of the interface image rendering effect, thereby greatly improving the rendering efficiency of the interface image.
[0055] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:
[0057] Figure 1 A flow chart of a method for rendering an interface image provided by an embodiment of the present invention is shown;
[0058] Figure 2 A flow chart of another method for rendering an interface image provided by an embodiment of the present invention is shown;
[0059] Figure 3 A flow chart of another method for rendering an interface image provided by an embodiment of the present invention is shown;
[0060] Figure 4 A block diagram showing the composition of an interface image rendering device provided by an embodiment of the present invention is shown;
[0061] Figure 5 A schematic structural diagram of a terminal provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0062] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0063] The rendering of each game UI interface is done by mixing a large number of facets in multiple layers, and rendering them layer by layer from the bottom up in order when rendering each frame. A large number of DrawCall instructions need to be called, that is, a DrawCall instruction will be called every time a layer of facets is superimposed and rendered. However, since the DrawCall instruction prepares the facet data to be rendered for the CPU each time and notifies the GPU to execute the rendering instruction, when rendering a large number of layers of facets, the Cpu will submit a corresponding number of DrawCalls, which will cause the Cpu to overload and cause the GPU to be idle, resulting in low rendering efficiency of the game UI interface. An embodiment of the present invention provides a method for rendering an interface image, such as Figure 1 As shown, the method includes:
[0064] 101. Under an interface rendering operation condition for a target frame, obtain an interface map matching the target frame.
[0065] In an embodiment of the present invention, when rendering the game UI interface, the content of each frame is different and changes occur. Therefore, when the interface rendering operation of the target frame is triggered, the current execution subject obtains the interface map that matches the target frame. The current execution subject can be a drawing application system suitable for different types of games or animations, such as a game engine including but not limited to role-playing games, role-playing games, task games, etc., or an animation video production system, etc., so that when the interface display function is started, the UI interface is rendered for display. At this time, the user triggers the interface rendering operation of the target frame in different scenes by clicking. Among them, the interface map is obtained by mixed rendering based on at least one layer of map patches, that is, mixed rendering is performed in advance based on at least one layer of map patches to obtain an interface map RT, that is, as a rendering target, under the interface rendering operation condition of the target frame, an interface map RT that has completed mixed rendering is directly obtained, so that the interface rendering is performed with this interface map RT.
[0066] It should be noted that since the interface map is pre-generated based on mixed rendering of at least one layer of map faces, at this time, at least one layer of map faces is all the faces required for the expected mixed rendering to obtain the interface, such as including vertex faces containing all models in the interface, etc., and the embodiments of the present invention do not specifically limit this. In addition, when mixed rendering, the interface map can be mixed and rendered layer by layer according to each layer of map faces, or all faces can be rendered at once on a single interface map, and the embodiments of the present invention do not specifically limit this.
[0067] 102. Retrieve an interface rendering instruction corresponding to the interface map.
[0068] In an embodiment of the present invention, since the interface map is a map obtained by pre-mixing and rendering based on at least one layer of map patches, when the interface rendering instruction corresponding to this interface map is called, an interface rendering instruction is called, and the interface rendering instruction is the DrawCall instruction, so as to perform a mixed rendering operation of rendering the interface map on the target frame based on DrawCall.
[0069] 103. Render the interface map onto the target frame using the interface rendering instruction to obtain an interface image of the target frame.
[0070] In an embodiment of the present invention, since the interface rendering instruction DrawCall instruction is an instruction for the CPU to prepare the patch data to be rendered and notify the GPU to perform rendering, after obtaining an interface map that has completed mixed rendering, the interface map is rendered to the target frame based on an interface rendering instruction to obtain an interface image, which greatly reduces the number of DrawCall calls. Moreover, since the DrawCall instruction is cached in the CPU, when a DrawCall instruction is called for the target frame based on the interface map that has completed mixed rendering, the system processing pressure is greatly reduced, thereby improving the system processing efficiency.
[0071] In one embodiment of the present invention, for further explanation and limitation, as Figure 2 As shown, before step 101 of acquiring the interface map matching the target frame, the method further includes:
[0072] 201. Obtain at least one layer of texture patches of a target frame to be rendered;
[0073] 202. Mixing and configuring the transparency channel color value of the texture to be mixed and rendered based on the transparency channel color values of the texture patches of each layer;
[0074] 203. The interface texture is configured based on the transparency channel color value and the three-channel color values of each layer of texture patch. Figure 3 Channel color value;
[0075] 204, based on the color value of the transparency channel of the map and the Figure 3 The channel color values are mixed and rendered onto the target canvas to obtain an interface map.
[0076] In an embodiment of the present invention, in order to directly obtain a pre-generated interface map when triggering an interface rendering operation on a target frame, so as to complete the rendering operation based on a single interface rendering instruction and ensure the invariance of the interface image rendering effect, all map faces of the target frame to be rendered are obtained so as to perform mixed rendering based on the transparency channel color value and the three-channel color value of each layer of map faces to obtain a final interface map. Among them, the map faces are all faces expected to be rendered on the interface image corresponding to the target frame, including but not limited to faces corresponding to different model vertices, and faces of different scenes, etc., and because the map faces are rendered in a bottom-up order for each frame when overlapping and mixing, when obtaining at least one layer of map faces, they can be obtained in the order of mixed rendering. For example, layers a to f are rendered layer by layer in the order of a to f onto the target frame. The embodiment of the present invention does not make specific limitations.
[0077] It should be noted that, since the interface image is obtained by mixing patches of translucent materials, therefore, when performing mixed rendering based on each layer of map patches, that is, performing mixed rendering on each map patch, the color of the last layer of interface map displayed on the screen can be calculated by disassembling the transparency channel color value of each layer of map patches and the three-channel color value of the target canvas. Among them, the transparency channel color value is the alpha channel color value called by the OpenCV application program interface, that is, the a channel color value, and the three-channel color value is the RGB color channel, including the red channel, the green channel, and the blue channel. The target canvas is the canvas of the interface map obtained by the expected mixed rendering. At this time, the color display of the target canvas can be the three-channel color value displayed on the current screen, or it can be the pre-configured background color of the interface map, etc. The embodiment of the present invention does not make specific limitations. The calculation method for the three-channel color value finally obtained after mixed rendering can be: Final.rgb = Src.rgb*Src.a+Dest.rgb*(1.0-Src.a) (Formula 1), Src.rgb is the three-channel color value to be mixed and rendered, that is, the color of the current drawing patch, Src.a is the a-channel color value to be mixed and rendered, that is, the color value of the alpha channel of the current drawing patch, and Dest.rgb is the three-channel color value displayed by the current screen Frambuffer (frame buffer). In an embodiment of the present invention, in a scenario where an interface image is rendered by mixing layer A and layer B to obtain an interface map, the interface map on the current screen is rendered by mixing layer A and layer B. In combination with Formula 1, the calculation method for first mixing the three-channel color values of layer A can be: FinalA.rgb = (A.rgb*Aa) + Screen.rgb*(1.0-Aa) (Formula 2), where A.rgb is the three-channel color value of layer A, and Aa is the a-channel color value of layer A, i.e., the color value of the transparency alpha channel. Screen.rgb is the three-channel color value displayed by the interface image of the current screen, and 1.0 is a preset mixing parameter; then, on this basis, layer B is mixed, and combined with formula 1, the calculation method for the three-channel color value of the mixed layer B can be: FinalB.rgb=(B.rgb*Ba)+FinalA.rgb*(1.0-Ba) (Formula 3), B.rgb is the three-channel color value of layer B, Ba is the a-channel color value of layer B, and FinalA.rgb is the three-channel color value displayed after the interface image of the current screen is mixed with the A-layer film. From this, it can be concluded that the method for the three-channel color value displayed after the interface image of the current screen is mixed with the B-layer film is: FinalB.rgb=(B.rgb*Ba)+((A.rgb*Aa)+Screen.rgb*(1.0-Aa))*(1.0-Ba) (Formula 4).
[0078] In the embodiment of the present invention, in order to realize one-time rendering of all mixed images onto the interface map, thereby improving rendering efficiency, specifically, formula 4 is sorted out, and the method for obtaining the three-channel color values displayed after the interface image of the current screen is mixed with the B layer patch is: FinalB.rgb=A.rgb*Aa*(1.0-Ba)+B.rgb*B.a+Screen.rgb*(1.0-Aa)*(1.0-Ba) (Formula 5), in order to directly render the A and B layer map patches onto the interface map , then configure the a channel color value of the interface map as: RT.a=(1.0-Aa)*(1.0-Ba), that is, based on the transparency channel color value of each layer of map patch, such as Aa, configure the transparency channel color value of the map to be mixed and rendered, and configure the three channel color value of the interface map as: RT.rgb=A.rgb*Aa*(1.0-Ba)+B.rgb*Ba, that is, based on the transparency channel color value of each layer of map patch, such as (1.0-Ba), and the three channel color value mixing configuration interface map Figure 3 Channel color value, so that the final color value is based on the transparency channel of the map and the Figure 3 The channel color values are mixed and rendered to get the interface map.
[0079] In one embodiment of the present invention, for further explanation and limitation, step 202 configures the texture transparency channel color value to be mixed and rendered based on the transparency channel color value of each layer of texture patches, including: determining the canvas transparency channel color value of the target canvas, and initializing the configuration of the canvas transparency channel color value and a first mixed rendering mode; performing mixed rendering calculation on the transparency channel color values of each layer of texture patches according to the first mixed rendering mode, and configuring the result of the mixed rendering calculation as the texture transparency channel color value of the target canvas.
[0080] In an embodiment of the present invention, in order to achieve one-time rendering of the interface map, the canvas transparency channel color value of the target canvas is determined, and the canvas transparency channel color value and the first mixed rendering mode are initialized. The target canvas is the initial canvas for rendering the interface map. At this time, in order to better perform mixed rendering of each layer of map patches, the canvas transparency channel color value and the first mixed rendering mode are first initialized. The canvas transparency channel color value is initialized to 1, and the first mixed rendering mode is a mixing mode between each layer of map patches, including but not limited to addition, subtraction, taking the smaller value of the two, taking the larger value of the two, etc., preferably adding. In an embodiment of the present invention, the a channel color value of the interface map is configured as: RT.a = (1.0-Aa) * (1.0-Ba), that is, based on the transparency channel color value of each layer of map patches, according to the add of the first mixed rendering mode, the transparency channel color value of each layer of map patches is mixed and calculated according to (1.0-Aa) * (1.0-Ba) to obtain the map transparency channel color value.
[0081] In addition, in a scene where a brush mixes colors on a canvas, you can also configure the parameters in the target canvas that are used to multiply the canvas transparency channel color value. For example, the upper brush transparency SrcBlendAlpha is configured to 0, and the lower canvas transparency DstBlendAlpha is set to (1.0-Src.a). The transparency channel color value on the actual mixed target canvas is expressed as: Dest.a = (Src.a*0.0) + (Dest.a*(1.0-Src.a)). Dest.a is the canvas transparency channel color value α on the current target canvas, and Src.a is the brush transparency channel color value α as the mapping patch. When Dest.a is mixed with the brush α, RT.a is obtained.
[0082] In one embodiment of the present invention, for further explanation and limitation, step 203 configures the interface map based on the transparency channel color value and the three-channel color values of each layer of map patch. Figure 3 Channel color values include: Determine the target canvas Figure 3 Channel color value, and initialize the configuration of the sticker Figure 3 According to the second mixed rendering mode, the transparency channel color value of each layer of the texture surface and the three-channel color value of each layer of the texture surface are mixed and rendered, and the result of the mixed rendering calculation is configured as the texture of the target canvas. Figure 3 Channel color value.
[0083] In the embodiment of the present invention, in order to realize the one-time rendering of the interface map, the map of the target canvas is determined. Figure 3Channel color value and initialize the configuration patch Figure 3 Channel color value, second mixed rendering mode, where the target canvas is the initial canvas for rendering the interface texture. At this time, in order to better render the various layers of texture patches, first initialize the configuration texture. Figure 3 Channel color value, first mixed rendering mode, where Figure 3 The channel color value is initialized to 0, and the second mixed rendering method is the mixing method between each layer of map patches, including but not limited to addition add, subtraction sub, taking the smaller value of the two max, taking the larger value of the two min, etc., preferably add. In the embodiment of the present invention, the interface map is Figure 3 The channel color value is configured as follows: RT.rgb=A.rgb*Aa*(1.0-Ba)+B.rgb*Ba, that is, the color value of each layer is based on the texture of the patch. Figure 3 Channel color values are mixed, and the textures of each layer are added according to the second mixed rendering method. Figure 3 The channel color value is calculated by mixing A.rgb*Aa*(1.0-Ba)+B.rgb*Ba to get the Figure 3 Channel color value.
[0084] In addition, in a scene where a brush is blending colors on the canvas, you can also configure the parameters in the target canvas that are used to multiply the color value of the texture transparency channel, such as the upper brush color value SrcBlend is Src.a, and the lower texture color value is Src. Figure 3 The channel color value DstBlend is set to (1.0-Src.a), so that the actual transparency channel color value on the mixed target canvas is expressed as: Dest.rgb = (Src.rgb*Src.a)+(Dest.rgb*(1.0-Src.a)), Dest.rgb is the three-channel color value of the canvas on the current target canvas, Src.rgb is the three-channel color value of the brush as the mapping surface, Src.a is the transparency channel color value of the brush as the mapping surface, and RT.rgb is obtained after mixing calculation.
[0085] In one embodiment of the present invention, for further explanation and limitation, step 204 is based on the color value of the transparency channel of the texture and the color value of the texture. Figure 3 The channel color values are mixed and rendered onto the target canvas to obtain the interface texture, which includes: calling at least one texture rendering instruction that matches the target canvas; executing the texture rendering instruction according to the texture transparency channel color value, ... Figure 3 The channel color value performs a mixed rendering operation on the layers of map patches to obtain an interface map.
[0086] Since the texture transparency channel color value and texture Figure 3 Channel color value, then call at least one texture rendering instruction to perform mixed rendering to obtain an interface texture. Specifically, after executing the texture rendering instruction according to the texture transparency channel color value, texture Figure 3 The channel color value is mixed and rendered by each layer of texture patches to obtain an interface texture, that is, according to the drawing rendering steps of the image drawing interface: set the color, drawing mode, vertex coordinates, draw the color value based on the transparency channel of the texture, and Figure 3 The channel color value mixes the map patches of each layer and renders them on the target canvas to obtain an interface map.
[0087] The image drawing interface in the embodiment of the present invention includes but is not limited to any rendering API such as OpenGL, D3D, Vulkan, etc. At the same time, since the drawing rendering steps for completing a rendering interface call need to include: setting color, drawing mode, vertex coordinates, drawing, and completing the call execution of a draw call instruction, therefore, when any of the configuration color, drawing mode, vertex coordinates, and drawing appears multiple times, multiple draw call instructions are generated to call and execute the rendering operation. For example, vertex coordinates are used to represent vertices of different models. Therefore, if there are multiple models in each layer of map patches, multiple draw call instructions need to be called to draw according to the same color and drawing mode. When determining the color value of the map transparency channel and the map layer, the same color and drawing mode are used. Figure 3 After the channel color value is obtained, it is still necessary to call multiple draw call instructions that may exist to render the interface map. Of course, as each layer of map surface can also be mixed and rendered according to the same model to complete the production of an interface map, the embodiment of the present invention does not make specific limitations. However, since the draw call instructions are stored in the CPU and are generated by a fixed target frame for the interface image, after an interface map is generated based on multiple draw call instructions, when the interface rendering operation is triggered, only one draw call instruction needs to be executed to complete the rendering of the interface image, avoiding the need to execute all the draw call instructions each time the interface image is rendered, greatly reducing the system processing pressure, and improving the rendering efficiency of the interface image in the system.
[0088] In one embodiment of the present invention, for further explanation and limitation, as Figure 3 As shown, step 103 renders the interface map onto the target frame through the interface rendering instruction to obtain the interface image of the target frame, including:
[0089] 1031. Determine the target frame three-channel color values of the target frame, and initialize and configure the target frame three-channel color values and a third mixed rendering mode;
[0090] 1032. Using the interface rendering instruction and the third mixed rendering mixing mode, combining the transparency channel color value of the interface map, the Figure 3 The channel color values are mixed and rendered on the three-channel color values of the target frame to obtain a rendering interface.
[0091] In order to obtain the interface image for each rendering of the target frame, the interface rendering instruction drawcall is called only once, thereby reducing the resource pressure of the system. When rendering the interface image, mixed rendering is performed based on the generated interface map and the target frame. Specifically, first determine the target frame three-channel color value Screen.rgb of the target frame, initialize and configure the target frame three-channel color value. At this time, for the initialized target frame three-channel color value, it can be configured according to the needs of different interface images, so as to achieve different interface display effects. The third mixed rendering method is a mixing method between each layer of map patches, including but not limited to addition add, subtraction sub, taking the smaller value max of the two, taking the larger value min of the two, etc., preferably add. In the embodiment of the present invention, the three-channel color value of the interface image is based on the map transparency channel color value, ... Figure 3 The channel color value is configured as: Final.rgb=RT.rgb*1.0+Screen.rgb*RT.a, that is, the channel color value of the texture transparency based on the interface texture, Figure 3 The channel color value is mixed according to the add of the second mixed rendering mode and RT.rgb*1.0+Screen.rgb*RT.a to obtain the three-channel color value of the interface image, thereby obtaining the interface image, where Final.rgb is the three-channel color value of the interface image, and Screen.rgb is the three-channel color value of the current screen.
[0092] In addition, in a scene where a brush mixes colors on a canvas, you can also configure parameters for multiplying the three-channel color values of the target frame and the three-channel color values of the brush. For example, if the three-channel color value SrcBlend of the upper brush is 1.0, and the three-channel color value DstBlend of the lower target frame is set to Src.a, the three-channel color value on the actual mixed target frame is expressed as: Dest.rgb = (Src.rgb*1.0) + (Dest.rgb*Src.a), where Dest.rgb is the three-channel color value of the current target frame, Src.rgb is the three-channel color value of the brush as the map patch, and Src.a is the transparency channel color value of the brush as the interface map. Final.rgb is obtained after the mixing calculation.
[0093] In one embodiment of the present invention, for further explanation and limitation, step 101 of obtaining at least one layer of texture patches of the target frame to be rendered includes: when it is detected that at least one layer of texture patches of the target frame is updated, obtaining at least one layer of texture patches of the updated target frame to be rendered to re-perform mixed rendering of the interface texture.
[0094] Since the interface map in the embodiment of the present invention is pre-generated for each target frame without change, when rendering the interface image of the target frame, mixed rendering is performed based on a draw call instruction to ensure that the rendering effect of the interface image is the same as executing multiple draw call instructions each time. When obtaining at least one layer of map patches, all map patches of the target frame are detected to determine whether any map patch is updated. If an update of the map patch is detected, the updated map patch is obtained to re-perform mixed rendering to obtain a new interface map.
[0095] In addition, in the embodiment of the present invention, for the mixed calculation formula FinalB.rgb=(B.rgb*Ba)+((A.rgb*Aa)+Screen.rgb*(1.0-Aa))*(1.0-Ba) (Formula 4), the mixed rendering three-channel color value of the mixed two-layer map surface is obtained, that is, RT.a=(1.0-Aa)*(1.0-Ba), RT.rgb=A.rgb*Aa*(1.0-Ba)+B.rgb*Ba; if the three-layer map surface is used for mixed rendering, RT.rgb=(N1.rgb*N1.a*(1.0-N2.a)+N2.rgb*N2.a)*(1.0 -N3.a)+N3.rgb*N3.a, RT.a=(1.0-N1.a)*(1.0-N2.a)*(1.0-N3.a), wherein N1.a is the transparency channel color value of the first layer of mapping surface, N2.a is the transparency channel color value of the second layer of mapping surface, N3.a is the transparency channel color value of the third layer of mapping surface, N1.rgb is the three-channel color value of the first layer of mapping surface, N2.rgb is the three-channel color value of the second layer of mapping surface, N3.rgb is the three-channel color value of the third layer of mapping surface. Similarly, the calculation of RT.rgb and RT.a of the fourth, fifth, and other layers of mapping surfaces is applicable, and the present invention will not repeat them here.
[0096] An embodiment of the present invention provides a method for rendering an interface image. The embodiment of the present invention obtains an interface map that matches the target frame under the interface rendering operation condition of the target frame, and the interface map is obtained by mixed rendering based on at least one layer of map faces; calls an interface rendering instruction corresponding to the interface map; renders the interface map to the target frame through the interface rendering instruction to obtain the interface image of the target frame, which greatly reduces the number of times the interface rendering instruction is called and reduces the processing pressure of the system. At the same time, it ensures the invariance of the interface image rendering effect, thereby greatly improving the rendering efficiency of the interface image.
[0097] Furthermore, as a response to the above Figure 1 The embodiment of the present invention provides a device for rendering an interface image, such as Figure 4 As shown, the device includes:
[0098] An acquisition module 31 is configured to acquire an interface map matching a target frame under an interface rendering operation condition for the target frame, wherein the interface map is obtained by mixed rendering based on at least one layer of map patches;
[0099] A calling module 32 is used to call an interface rendering instruction corresponding to the interface map;
[0100] The rendering module 33 is used to render the interface map onto the target frame through the interface rendering instruction to obtain the interface image of the target frame.
[0101] Furthermore, the device further includes: a first configuration module, a second configuration module,
[0102] The acquisition module is further used to acquire at least one layer of map patches of the target frame to be rendered;
[0103] The first configuration module is used to mix and configure the transparency channel color value of the texture to be mixed and rendered based on the transparency channel color value of each layer of texture surface;
[0104] The second configuration module is used to mix and configure the interface map based on the transparency channel color value and the three-channel color values of each layer of map surface. Figure 3 Channel color value;
[0105] The rendering module is also used to generate a color image based on the transparency channel color value of the map and the color image of the map. Figure 3 The channel color values are mixed and rendered onto the target canvas to obtain an interface map.
[0106] Furthermore, the first configuration module includes:
[0107] A first determining unit, configured to determine a color value of a canvas transparency channel of a target canvas, and to initialize and configure the color value of the canvas transparency channel and a first mixed rendering mode;
[0108] The first configuration unit is configured to perform mixed rendering calculation on the transparency channel color values of the texture patches of each layer according to the first mixed rendering mode, and configure the result of the mixed rendering calculation as the texture transparency channel color value of the target canvas.
[0109] Furthermore, the second configuration module includes:
[0110] The second determining unit is used to determine the target canvas Figure 3 Channel color value, and initialize the configuration of the sticker Figure 3 Channel color value, second mixed rendering mode;
[0111] The second configuration unit is used to perform mixed rendering calculation on the transparency channel color value of each layer of the texture surface and the three-channel color value of each layer of the texture surface according to the second mixed rendering mode, and configure the result of the mixed rendering calculation as the texture of the target canvas. Figure 3 Channel color value.
[0112] Furthermore, the rendering module includes:
[0113] A calling unit, configured to call at least one texture rendering instruction matching a target canvas;
[0114] The first execution unit is used to execute the color value of the transparency channel of the texture, the texture rendering instruction, Figure 3 The channel color value performs a mixed rendering operation on the layers of map patches to obtain an interface map.
[0115] Furthermore, the rendering module further includes:
[0116] A third determining unit is configured to determine a target frame three-channel color value of the target frame, and initialize and configure the target frame three-channel color value and a third mixed rendering mode;
[0117] The second execution unit is used to combine the texture transparency channel color value, texture quality and texture quality of the interface texture according to the third mixed rendering mixing mode through the interface rendering instruction. Figure 3 The channel color values are mixed and rendered on the three-channel color values of the target frame to obtain a rendering interface.
[0118] Furthermore, the acquisition module is specifically configured to acquire at least one layer of updated texture patches of the target frame to be rendered when detecting that at least one layer of texture patches of the target frame is updated, so as to re-perform mixed rendering of the interface texture.
[0119] An embodiment of the present invention provides a rendering device for an interface image. The embodiment of the present invention obtains an interface map that matches the target frame under the interface rendering operation condition of the target frame, and the interface map is obtained by mixed rendering based on at least one layer of map patches; calls an interface rendering instruction corresponding to the interface map; renders the interface map to the target frame through the interface rendering instruction to obtain the interface image of the target frame, which greatly reduces the number of times the interface rendering instruction is called and reduces the processing pressure of the system. At the same time, it ensures the invariance of the interface image rendering effect, thereby greatly improving the rendering efficiency of the interface image.
[0120] According to one embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the interface image rendering method in any of the above method embodiments.
[0121] Figure 5 A schematic structural diagram of a terminal provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the terminal.
[0122] like Figure 5 As shown, the terminal may include: a processor (processor) 402 , a communications interface (Communications Interface) 404 , a memory (memory) 406 , and a communication bus 408 .
[0123] The processor 402 , the communication interface 404 , and the memory 406 communicate with each other via a communication bus 408 .
[0124] The communication interface 404 is used to communicate with other devices such as clients or other servers.
[0125] The processor 402 is used to execute the program 410, and specifically can execute the relevant steps in the embodiment of the above-mentioned interface image rendering method.
[0126] Specifically, the program 410 may include program codes, which include computer operation instructions.
[0127] Processor 402 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included in the terminal may be processors of the same type, such as one or more CPUs, or processors of different types, such as one or more CPUs and one or more ASICs.
[0128] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0129] The program 410 may be specifically configured to cause the processor 402 to perform the following operations:
[0130] Under the interface rendering operation condition of the target frame, obtaining an interface map matching the target frame, wherein the interface map is obtained by mixed rendering based on at least one layer of map patches;
[0131] Retrieve an interface rendering instruction corresponding to the interface map;
[0132] The interface map is rendered onto the target frame through the interface rendering instruction to obtain an interface image of the target frame.
[0133] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, centralized on a single computing device, or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, which can then be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0134] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.
Claims
1. A method for rendering an interface image, characterized in that: include: Under the interface rendering operation condition of the target frame, obtaining an interface map matching the target frame, wherein the interface map is obtained by mixed rendering based on at least one layer of map patches; Retrieve an interface rendering instruction corresponding to the interface map; Rendering the interface map onto the target frame through the interface rendering instruction to obtain an interface image of the target frame; Before acquiring the interface map matching the target frame, the method further includes: Obtain at least one layer of texture patches of the target frame to be rendered; The transparency channel color value of the texture to be mixed and rendered is configured based on the transparency channel color value of each layer of texture patches; Mixing and configuring the three-channel color value of the interface map based on the transparency channel color value and the three-channel color values of the map patches of each layer; The interface map is obtained by mixing and rendering the color value of the transparency channel of the map and the color value of the three channels of the map onto the target canvas.
2. The method according to claim 1, characterized in that The configuration of the color value of the transparency channel of the texture to be mixed and rendered based on the transparency channel color value of each layer of texture patches includes: Determine a canvas transparency channel color value of a target canvas, and initialize and configure the canvas transparency channel color value and a first mixed rendering mode; According to the first mixed rendering mode, the transparency channel color values of the map patches of each layer are subjected to mixed rendering calculation, and the result of the mixed rendering calculation is configured as the transparency channel color value of the map of the target canvas.
3. The method according to claim 1, characterized in that The mixing and configuring the three-channel color value of the interface map based on the transparency channel color value and the three-channel color values of the map patches of each layer includes: Determine the three-channel color values of the texture of the target canvas, and initialize and configure the three-channel color values of the texture and the second mixed rendering mode; According to the second mixed rendering mode, the transparency channel color values of the map patches of each layer and the three-channel color values of the map patches of each layer are mixed rendering calculated, and the results of the mixed rendering calculation are configured as the three-channel color values of the map of the target canvas.
4. The method according to claim 1, wherein The mixing and rendering of the color value of the transparency channel of the texture and the color value of the three channels of the texture onto the target canvas to obtain the interface texture includes: Retrieve at least one texture rendering instruction that matches the target canvas; The texture rendering instruction is used to perform a mixed rendering operation on the texture patches of each layer according to the color value of the texture transparency channel and the color value of the three channels of the texture, so as to obtain an interface texture.
5. The method according to claim 1, wherein Rendering the interface map onto the target frame using the interface rendering instruction to obtain the interface image of the target frame includes: Determine the target frame three-channel color values of the target frame, and initialize and configure the target frame three-channel color values and a third mixed rendering mode; The interface rendering instruction is used to perform mixed rendering on the three-channel color value of the target frame in accordance with the third mixed rendering mixing method, combined with the texture transparency channel color value and the texture three-channel color value of the interface texture, to obtain a rendering interface.
6. The method according to any one of claims 1 to 5, characterized in that The step of obtaining at least one layer of texture patches of a target frame to be rendered comprises: When it is detected that at least one layer of texture patches of the target frame is updated, the updated at least one layer of texture patches of the target frame to be rendered is obtained to re-perform mixed rendering of the interface texture.
7. A device for rendering an interface image, characterized in that: include: An acquisition module is used to acquire an interface map that matches the target frame under the interface rendering operation condition of the target frame, wherein the interface map is obtained by mixed rendering based on at least one layer of map patches; A calling module, used for calling an interface rendering instruction corresponding to the interface map; A rendering module, configured to render the interface map onto the target frame using the interface rendering instruction to obtain an interface image of the target frame; The device further includes: a first configuration module, a second configuration module, The acquisition module is further used to acquire at least one layer of map patches of the target frame to be rendered; The first configuration module is used to mix and configure the transparency channel color value of the texture to be mixed and rendered based on the transparency channel color value of each layer of texture surface; The second configuration module is used to mix and configure the three-channel color value of the interface map based on the transparency channel color value and the three-channel color values of the map patches of each layer; The rendering module is further configured to render the mixed image onto a target canvas based on the color value of the transparency channel of the texture and the color values of the three channels of the texture, so as to obtain an interface texture.
8. A storage medium storing at least one executable instruction, wherein the executable instruction enables a processor to execute an operation corresponding to the method for rendering an interface image according to any one of claims 1 to 6.
9. A terminal comprising: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute an operation corresponding to the interface image rendering method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Model rendering method and device
CN112070873A
Mapping resource rendering method and device, electronic equipment and storage medium
CN112604294A