User interface rendering method and device, computer equipment and readable storage medium
By calculating the actual display resolution of the rendering texture component and determining the target rendering texture component, the problem of RenderTexture occupies memory in the prior art is solved, and efficient UI rendering and diversified rendering effects are achieved.
Patent Information
- Application Number
- CN202311150544.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-07
- Publication Date
- 2025-01-10
AI Technical Summary
When the existing rendering pipeline is rendered in UI, the larger RenderTexture takes up a lot of memory, resulting in reduced application operation efficiency and difficulty in achieving diversified rendering.
By obtaining the screen resolution and preset texture size, calculate the actual display resolution of the rendered texture component, determine the target rendered texture component, and output the 3D model to the target rendered texture component for rendering, avoiding excessive memory consumption, and supporting multiple types of data at the same time Render mode for diversified rendering.
While ensuring clear image display, memory usage is avoided, application operation efficiency is improved, and diversified rendering effect is achieved.
Smart Images

Figure CN119295627A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the computer field, and in particular to a user interface rendering method, apparatus, computer equipment and readable storage medium. Background Art
[0002] The current mainstream rendering pipeline takes rendering efficiency into consideration when performing UI rendering. It outputs the 3D model from the virtual camera to the RenderTexture (also known as the render texture component), and then directly assigns the RenderTexture to the Texture (also known as the texture) on the user interface, and renders the model through the UI camera.
[0003] In order to make the UI display clearer, the existing RenderTexture application will apply for a larger RenderTexture, which will take up a lot of memory after being assigned to the Texture of the user interface, thus reducing the running efficiency of the application in the device. In addition, the larger RenderTexture makes the UI rendering mostly directly mixed with the background, making it difficult to achieve diversified rendering. Summary of the invention
[0004] In view of this, the present application provides a user interface rendering method, apparatus, computer device and readable storage medium, which avoids occupying memory while ensuring clear display.
[0005] In a first aspect, an embodiment of the present application provides a user interface rendering method, comprising: Get screen resolution, preset texture size, and game adaptation method; Calculate the actual display resolution of the rendering texture component according to the screen resolution, the preset texture size and the game adaptation method; A target rendering texture component is determined based on the actual display resolution, and the 3D model is output from the virtual camera to the target rendering texture component for user interface rendering.
[0006] According to the above method of the embodiment of the present application, the following additional technical features may also be provided: In the above technical solution, optionally, the method further includes: When the screen resolution is updated, recalculating the actual display resolution according to the updated screen resolution; The target rendering texture component is re-determined based on the recalculated actual display resolution, and the re-determined target rendering texture component is used to perform user interface rendering.
[0007] In any of the above technical solutions, optionally, the method further includes: Get the preset destruction time; Within the preset destruction time, the 3D model and the virtual camera are hidden, and the target rendering texture component is released.
[0008] In any of the above technical solutions, optionally, rendering the 3D model includes: Get rendering mode information; A target rendering mode is determined according to the rendering mode information, and user interface rendering is performed according to the target rendering mode, where the target rendering mode includes at least one of the following: a normal rendering mode, a background rendering mode, and a screenshot rendering mode.
[0009] In any of the above technical solutions, optionally, rendering the user interface according to the target rendering mode includes: If the target rendering mode is the normal rendering mode, the mixed mode in the game shader is used to render the user interface; If the target rendering mode is the background rendering mode, the picture selected by the user is used as the background picture, and the user interface rendering is performed based on the background picture; If the target rendering mode is the screenshot rendering mode, the user interface is rendered in layers, and a screenshot operation is performed after each layer is rendered to achieve screenshot rendering.
[0010] In any of the above technical solutions, optionally, using the picture selected by the user as a background picture and rendering the user interface based on the background picture includes: The display pixels and the image coordinates required for rendering are calculated according to the background image and the usage type of the background image, and the user interface rendering is performed according to the display pixels and the image coordinates.
[0011] In any of the above technical solutions, optionally, rendering the user interface in layers and taking a screenshot after each layer is rendered to achieve screenshot rendering includes: Count the layers using the screenshot rendering mode; The user interface is rendered in layers according to the layers, a screenshot operation is performed after each layer is rendered, a screenshot obtained by the screenshot operation is used as a background image, and the user interface rendering continues based on the background image.
[0012] In a second aspect, an embodiment of the present application provides a user interface rendering device, including: Information acquisition module, used to obtain screen resolution, preset texture size and game adaptation method; A processing module, used for calculating the actual display resolution of the rendering texture component according to the screen resolution, the preset texture size and the game adaptation mode; A rendering module is used to determine a target rendering texture component based on the actual display resolution, and output the 3D model from the virtual camera to the target rendering texture component to perform user interface rendering.
[0013] In a third aspect, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be executed on the processor, and when the programs or instructions are executed by the processor, the steps of the method of the first aspect are implemented.
[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.
[0015] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method of the first aspect.
[0016] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method of the first aspect.
[0017] In an embodiment of the present application, a preset texture size set by a user is obtained, and the screen resolution of the screen and the game adaptation method are obtained. According to the screen resolution, the preset texture size and the game adaptation method, the actual display resolution of the rendering texture component during rendering is calculated, and then the target rendering texture component of the corresponding size is applied according to the actual display resolution. Further, the 3D model is output to the target rendering texture component by the virtual camera, and then the target rendering texture component is assigned to the texture adding component, that is, the target rendering texture component is used as a texture and rendered through UICamera. In an embodiment of the present application, the actual display resolution of the rendering texture component can be calculated so that the rendering texture component is applied according to the actual display resolution, and the rendering texture component of the appropriate size is obtained. While ensuring that the image is displayed clearly, it avoids occupying memory, improves the running efficiency of the application in the device, and can achieve diversified rendering. In addition, the size of the rendering texture component actually displayed on the screen is calculated, which can ensure that the accuracy is not lost during the coordinate system conversion process, and further make the image display clearer.
[0018] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, 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 application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 One of the flowcharts of the user interface rendering method according to an embodiment of the present application is shown; Figure 2 A second flowchart of the user interface rendering method according to an embodiment of the present application is shown; Figure 3 A structural block diagram of a user interface rendering device according to an embodiment of the present application is shown; Figure 4 A structural block diagram of a computer device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0021] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0022] The user interface rendering method, apparatus, computer device, and readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0023] The present application embodiment provides a user interface rendering method, such as Figure 1 As shown, the method includes: Step 101, obtaining screen resolution, preset texture size and game adaptation method; Step 102, calculating the actual display resolution of the rendering texture component according to the screen resolution, the preset texture size and the game adaptation method; Step 103 , determining a target rendering texture component based on the actual display resolution, and outputting the 3D model from the virtual camera to the target rendering texture component for user interface rendering.
[0024] In this embodiment, the preset texture size (i.e., Texture Size) set by the user is obtained, as well as the screen resolution of the screen and the game adaptation method. The game interface will perform some game adaptation processing according to different running screen resolutions, such as determining the scaling type (ScalingStype) of UIRoot, and limiting the width and height of the game interface according to different aspect ratios, etc., wherein UIRoot is a script for managing and processing UI changes and scaling.
[0025] According to the screen resolution, preset texture size and game adaptation method, the actual display resolution of the rendering texture component (i.e. RenderTexture) during rendering is calculated, and then the target rendering texture component of the corresponding size is applied according to the actual display resolution. In one embodiment, the width and height of the game interface and the actual width and height of the screen (i.e. the screen resolution) are preset, and then the width and height of the UI displayed on the screen are determined proportionally based on the actual width and height of the screen and the aspect ratio of the game interface. Exemplarily, during the game production process, the preset texture size is H1, the actual width and height of the screen is H2, and the UI adaptation is adapted according to the height H3, then the actual display resolution of the rendering texture component is H=H1×(H2 / H3).
[0026] Furthermore, the 3D model is output from the virtual camera to the target rendering texture component, and then the target rendering texture component is assigned to the texture adding component (ie UITexture), that is, the target rendering texture component is used as a texture (ie Texture) and rendered through UICamera.
[0027] In the related art, in order to make the image display clearer, a larger rendering texture component is usually applied, resulting in a large amount of memory being occupied. The larger rendering texture component also causes the UI rendering to be directly mixed with the background, making it difficult to achieve diversified rendering. However, in the embodiment of the present application, the actual display resolution of the rendering texture component can be calculated, and the rendering texture component can be applied according to the actual display resolution to obtain a rendering texture component of the appropriate size. While ensuring that the image display is clear, it avoids occupying memory, improves the running efficiency of the application in the device, and can achieve diversified rendering. In addition, the actual display size of the rendering texture component on the screen is calculated, which can ensure that the accuracy is not lost during the coordinate system conversion process, further making the image display clearer.
[0028] In one embodiment of the present application, the method further includes: When the screen resolution is updated, recalculating the actual display resolution according to the updated screen resolution; The target rendering texture component is re-determined based on the recalculated actual display resolution, and the re-determined target rendering texture component is used to perform user interface rendering.
[0029] In this embodiment, when the screen resolution changes, the actual display resolution can be recalculated based on the updated screen resolution, and then the target rendering texture component can be re-determined, wherein the re-determination method includes releasing memory to change the target rendering texture component, or re-applying for the target rendering texture component.
[0030] It should be noted that whether to redetermine the target rendering texture component when the screen resolution changes can be selected by the user. That is, when the screen resolution changes, after receiving an instruction to redetermine the rendering texture component, the rendering texture component can be redetermined according to the updated screen resolution, so as to improve the flexibility of the method.
[0031] Through the above method, it is ensured that after the screen resolution is updated, the rendering texture component of appropriate size can still be used for rendering, thereby avoiding memory occupation and improving the running efficiency of the application in the device.
[0032] In one embodiment of the present application, the method further includes: Get the preset destruction time; Within the preset destruction time, the 3D model and the virtual camera are hidden, and the target rendering texture component is released.
[0033] In this embodiment, the preset destruction time set by the user, that is, the disabling time selected by the user, is obtained, and the 3D model and the virtual camera are hidden at the disabling time (OnDisable), the target rendering texture component is released, and the target rendering texture component is reapplied at the activation (OnEnable), and the 3D model and the virtual camera are displayed.
[0034] In the related art, the release of the rendering texture component is done by Unity itself, and it will not be released when the interface is hidden. In this case, the memory is still occupied, which will affect the running efficiency of the application in the device.
[0035] The embodiment of the present application can hide the 3D model and the virtual camera according to the destruction timing selected by the user, and release the target rendering texture component at the same time to avoid occupying memory.
[0036] In one embodiment of the present application, the rendering of the 3D model includes: Get rendering mode information; A target rendering mode is determined according to the rendering mode information, and user interface rendering is performed according to the target rendering mode, where the target rendering mode includes at least one of the following: a normal rendering mode, a background rendering mode, and a screenshot rendering mode.
[0037] In this embodiment, the rendering mode information is obtained, and the rendering mode information is determined by the usage format of the script UIRT, and the script UIRT is a script added during the rendering process for performing the rendering process. Figure 2 As shown, if the script UIRT usage format is "Normal", the corresponding target rendering mode is the normal rendering mode, if the script UIRT usage format is "Background", the corresponding target rendering mode is the background rendering mode, if the script UIRT usage format is "GrabPass", the corresponding target rendering mode is the screenshot rendering mode. After determining the target rendering mode, the user interface is rendered according to the target rendering mode.
[0038] The embodiment of the present application can provide multiple rendering modes, making the rendering modes flexible and diverse to meet user needs.
[0039] In one embodiment of the present application, rendering the user interface according to the target rendering mode includes: If the target rendering mode is the normal rendering mode, the mixed mode in the game shader is used to render the user interface; If the target rendering mode is the background rendering mode, the picture selected by the user is used as the background picture, and the user interface rendering is performed based on the background picture; If the target rendering mode is the screenshot rendering mode, the user interface is rendered in layers, and a screenshot operation is performed after each layer is rendered to achieve screenshot rendering.
[0040] In this embodiment, if Figure 2 As shown in the figure, the normal rendering mode means that the background image is not obtained, but the blending mode specified in the game shader is used for direct rendering. The blending method specified in the game shader is used for blending, and the background image will not be obtained, and no special processing can be done on the background.
[0041] Background rendering mode is when the user selects an image as the background image for user interface rendering. The background image can be either Texture or UISprite (i.e., sprite image). For example, the background frame of the UI interface, the game shader can use this background image to achieve some special effects such as background Gamma and Linear conversion, blur effect, distortion effect, glass effect, etc.
[0042] The screenshot rendering mode automatically captures the rendering image of the previous layer as the background image to achieve rendering.
[0043] The embodiments of the present application can provide a variety of UI rendering methods, making the rendering flexible and diverse to meet user needs.
[0044] It should be noted that in the related art, the UI camera is modified in consideration of efficiency in URP, and the overlay rendering effect is no longer supported through ClearFlags. However, the embodiment of the present application provides a GrabPass method for layered frame grabbing, which can ensure both efficiency and rendering effect.
[0045] In one embodiment of the present application, using the picture selected by the user as a background picture and rendering the user interface based on the background picture includes: The display pixels and the image coordinates required for rendering are calculated according to the background image and the usage type of the background image, and the user interface rendering is performed according to the display pixels and the image coordinates.
[0046] In this embodiment, if Figure 2 As shown, it will automatically pass the required parameters to the game shader to calculate the display pixels and image coordinates required for actual rendering based on the background image selected by the user and the usage type of the background image, and then perform some special processing on the background image based on the display pixels and image coordinates, such as background Gamma and Linear conversion, blur effect, distortion effect, glass effect, etc., to achieve better performance.
[0047] For example, if the background image is a UISprite, and the usage type of the UISprite is a nine-grid, the display pixels and image coordinates of the background image are obtained by performing an inverse operation according to the usage type. For example, the atlas of the nine-grid and the image size of each atlas, the coordinates of the lower left and upper right vertices of the image, and other required parameters are passed to the game shader, and then the image coordinates are calculated in the vertex function through the atlas, image size, and the coordinates of the lower left and upper right vertices of the image, and then the display pixels displayed by the fragment are calculated in the fragment function through the Padding information.
[0048] In the embodiment of the present application, special display effects can be processed in the background rendering mode, making the display effects more diversified.
[0049] In one embodiment of the present application, rendering the user interface in layers and taking a screenshot after each layer of rendering to achieve screenshot rendering includes: Count the layers using the screenshot rendering mode; The user interface is rendered in layers according to the layers, a screenshot operation is performed after each layer is rendered, a screenshot obtained by the screenshot operation is used as a background image, and the user interface rendering continues based on the background image.
[0050] In this embodiment, if Figure 2 As shown, the layers (Layer) that currently need to be rendered to the screen in the screenshot rendering mode are counted, and then the rendering pipeline performs layered UI rendering according to the layers in the screenshot rendering mode. A screenshot operation is inserted in the middle, that is, a full-screen screenshot. The screenshot obtained by the screenshot operation is passed to the game shader as the background image, and some special processing such as background Gamma and Linear conversion, blur effect, distortion effect, glass effect, etc. can be performed, thereby achieving the GrabPass effect in non-URP.
[0051] For example, for all layers selected by the UI camera, if a layer is detected to use the screenshot rendering mode, all selected layers before the layer will be rendered first, then the screenshot operation will be performed, and then the layer and all layers after the layer will be rendered.
[0052] It should be noted that the management tool manages all UIRTs, such as registering them when they are used, marking them when they are hidden, and deleting them when they are destroyed. The management tool counts the layers that need to be rendered to the screen when the UIRT is used and destroyed.
[0053] The embodiment of the present application can rely on layers for layered rendering to insert screenshot operations to achieve the original GrabPass effect, avoid efficiency problems caused by excessive use of screenshot operations, and achieve diversified rendering.
[0054] As a specific implementation of the above-mentioned user interface rendering method, the embodiment of the present application provides a user interface rendering device. Figure 3 As shown, the user interface rendering device 300 includes: an information acquisition module 301 , a processing module 302 and a rendering module 303 .
[0055] The information acquisition module 301 is used to obtain the screen resolution, preset texture size and game adaptation mode; A processing module 302 is used to calculate the actual display resolution of the rendering texture component according to the screen resolution, the preset texture size and the game adaptation method; The rendering module 303 is used to determine a target rendering texture component based on the actual display resolution, and output the 3D model from the virtual camera to the target rendering texture component to perform user interface rendering.
[0056] In this embodiment, the preset texture size set by the user is obtained, and the screen resolution of the screen and the game adaptation method are obtained. According to the screen resolution, the preset texture size and the game adaptation method, the actual display resolution of the rendering texture component during rendering is calculated, and then the target rendering texture component of the corresponding size is applied according to the actual display resolution. Further, the 3D model is output to the target rendering texture component by the virtual camera, and then the target rendering texture component is assigned to the texture adding component (that is, UITexture), that is, the target rendering texture component is used as a texture (that is, Texture) and rendered through UICamera. In the embodiment of the present application, the actual display resolution of the rendering texture component can be calculated so that the rendering texture component is applied according to the actual display resolution, and the rendering texture component of the appropriate size is obtained. While ensuring that the image is displayed clearly, it avoids occupying memory, improves the running efficiency of the application in the device, and can realize diversified rendering. In addition, the size of the rendering texture component actually displayed on the screen is calculated, which can ensure that the accuracy is not lost during the coordinate system conversion process, and further make the image display clearer.
[0057] Furthermore, the processing module 302 is further configured to recalculate the actual display resolution according to the updated screen resolution when the screen resolution is updated; The rendering module 303 is further configured to redetermine the target rendering texture component based on the recalculated actual display resolution, and use the redetermined target rendering texture component to perform user interface rendering.
[0058] Furthermore, the information acquisition module 301 is also used to obtain a preset destruction time; The processing module 302 is further configured to hide the 3D model and the virtual camera and release the target rendering texture component within the preset destruction time.
[0059] Furthermore, the rendering module 303 is specifically used for: Get rendering mode information; A target rendering mode is determined according to the rendering mode information, and user interface rendering is performed according to the target rendering mode, where the target rendering mode includes at least one of the following: a normal rendering mode, a background rendering mode, and a screenshot rendering mode.
[0060] Furthermore, the rendering module 303 is specifically used for: If the target rendering mode is the normal rendering mode, the mixed mode in the game shader is used to render the user interface; If the target rendering mode is the background rendering mode, the picture selected by the user is used as the background picture, and the user interface rendering is performed based on the background picture; If the target rendering mode is the screenshot rendering mode, the user interface is rendered in layers, and a screenshot operation is performed after each layer is rendered to achieve screenshot rendering.
[0061] Furthermore, the rendering module 303 is specifically configured to calculate display pixels and image coordinates required for rendering according to the background image and the usage type of the background image, and perform user interface rendering according to the display pixels and the image coordinates.
[0062] Furthermore, the rendering module 303 is specifically used for: Count the layers using the screenshot rendering mode; The user interface is rendered in layers according to the layers, a screenshot operation is performed after each layer is rendered, a screenshot obtained by the screenshot operation is used as a background image, and the user interface rendering continues based on the background image.
[0063] The user interface rendering device 300 in the embodiment of the present application can be a computer device, or a component in a computer device, such as an integrated circuit or a chip. The computer device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the computer device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted computer device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (Augmented Reality, AR) / virtual reality (Virtual Reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (Ultra-Mobile Personal Computer, UMPC), a netbook or a personal digital assistant (Personal Digital Assistant, PDA), etc. It can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (Personal Computer, PC), a television (Television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0064] The user interface rendering device 300 provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the user interface rendering method embodiment are not described here.
[0065] The present application also provides a computer device, such as Figure 4As shown, the computer device 400 includes a processor 401 and a memory 402. The memory 402 stores programs or instructions that can be executed on the processor 401. When the program or instructions are executed by the processor 401, the various steps of the above-mentioned user interface rendering method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0066] It should be noted that the computer device in the embodiment of the present application includes the above-mentioned mobile computer device and non-mobile computer device.
[0067] The memory 402 can be used to store software programs and various data. The memory 402 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 402 may include a volatile memory or a non-volatile memory, or the memory 402 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), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 402 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0068] The processor 401 may include one or more processing units; optionally, the processor 401 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 401.
[0069] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned user interface rendering method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0070] An embodiment of the present application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned user interface rendering method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0071] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0072] An embodiment of the present application also provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned user interface rendering method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0073] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0074] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A user interface rendering method, characterized in that: include: Get screen resolution, preset texture size, and game adaptation method; Calculate the actual display resolution of the rendering texture component according to the screen resolution, the preset texture size and the game adaptation method; A target rendering texture component is determined based on the actual display resolution, and the 3D model is output from the virtual camera to the target rendering texture component for user interface rendering.
2. The method according to claim 1, characterized in that The method further comprises: When the screen resolution is updated, recalculating the actual display resolution according to the updated screen resolution; The target rendering texture component is re-determined based on the recalculated actual display resolution, and the re-determined target rendering texture component is used to perform user interface rendering.
3. The method according to claim 1, characterized in that The method further comprises: Get the preset destruction time; Within the preset destruction time, the 3D model and the virtual camera are hidden, and the target rendering texture component is released.
4. The method according to any one of claims 1 to 3, characterized in that The rendering of the 3D model includes: Get rendering mode information; A target rendering mode is determined according to the rendering mode information, and user interface rendering is performed according to the target rendering mode, wherein the target rendering mode includes at least one of the following: a normal rendering mode, a background rendering mode, and a screenshot rendering mode.
5. The method according to claim 4, characterized in that The performing user interface rendering according to the target rendering mode includes: If the target rendering mode is the normal rendering mode, the mixed mode in the game shader is used to render the user interface; If the target rendering mode is the background rendering mode, the picture selected by the user is used as the background picture, and the user interface rendering is performed based on the background picture; If the target rendering mode is the screenshot rendering mode, the user interface is rendered in layers, and a screenshot operation is performed after each layer is rendered to achieve screenshot rendering.
6. The method according to claim 5, characterized in that The method of using the picture selected by the user as a background picture and performing user interface rendering based on the background picture includes: The display pixels and the image coordinates required for rendering are calculated according to the background image and the usage type of the background image, and the user interface rendering is performed according to the display pixels and the image coordinates.
7. The method according to claim 5, characterized in that The layered rendering of the user interface and the screenshot operation after each layer of rendering to achieve screenshot rendering include: Count the layers using the screenshot rendering mode; The user interface is rendered in layers according to the layers, a screenshot operation is performed after each layer is rendered, a screenshot obtained by the screenshot operation is used as a background image, and the user interface rendering continues based on the background image.
8. A user interface rendering device, characterized in that: include: Information acquisition module, used to obtain screen resolution, preset texture size and game adaptation method; A processing module, used for calculating the actual display resolution of the rendering texture component according to the screen resolution, the preset texture size and the game adaptation mode; A rendering module is used to determine a target rendering texture component based on the actual display resolution, and output the 3D model from the virtual camera to the target rendering texture component to perform user interface rendering.
9. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction running on the processor, and when the program or instruction is executed by the processor, the steps of the model rendering method according to any one of claims 1 to 7 are implemented.
10. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the steps of the model rendering method according to any one of claims 1 to 7 are implemented.