CN-122018664-A - Rendering method, storage medium, electronic device, and program product
Abstract
The application provides a rendering method applied to electronic equipment, wherein the electronic equipment comprises a touch screen. The rendering method comprises the steps of obtaining the interaction state and the electric quantity of the electronic equipment, and determining a rendering mode corresponding to an object to be rendered according to the interaction state and the electric quantity. The method comprises the steps of enabling an object to be rendered through a high frame rate mode when the interaction state is that a sliding operation is carried out on a touch screen, and/or enabling electric quantity to exceed a first electric quantity threshold value, enabling the object to be rendered through a low frame rate mode when the static time of a display picture of the touch screen exceeds the first time threshold value, and/or enabling the electric quantity to not exceed a second electric quantity threshold value, enabling the first electric quantity threshold value to be larger than or equal to the second electric quantity threshold value, and enabling the number of vertexes of the low frame rate mode to be smaller than that of vertexes of the high frame rate mode. Therefore, different rendering modes are determined according to different interaction states and electric quantity of the electronic equipment, so that the power consumption of the electronic equipment can be reduced, and meanwhile, the calculated amount in the rendering process is reduced so as to improve the visual effect of rendering.
Inventors
- CHENG LE
- XI WENQIANG
- HUANG JINHUA
- HU WEN
Assignees
- 翱捷科技股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260203
Claims (13)
- 1. A rendering method applied to an electronic device, wherein the electronic device comprises a touch screen, and the rendering method is characterized by comprising the following steps: acquiring the interaction state and the electric quantity of the electronic equipment; And determining a rendering mode corresponding to the object to be rendered according to the interaction state and the electric quantity, wherein different rendering modes comprise different numbers of vertexes used for rendering the object to be rendered.
- 2. The method of claim 1, wherein the rendering mode comprises a high frame rate mode, a low frame rate mode, and a low light mode, the method further comprising: Rendering the object to be rendered through the high frame rate mode under the condition that the interaction state is that sliding operation is performed on the touch screen and/or the electric quantity exceeds a first electric quantity threshold value; Rendering the object to be rendered through the low frame rate mode under the condition that the interaction state is that the time of the display picture of the touch screen is static exceeds a first time threshold value and/or the electric quantity does not exceed a second electric quantity threshold value; Rendering an object to be rendered through the low-light mode under the condition that the interaction state is that the electronic equipment starts the low-light mode and the electronic equipment is in a dormant state and/or the electronic equipment detects forced screen extinguishing; the first electric quantity threshold value is larger than or equal to the second electric quantity threshold value, the grid models of the objects to be rendered corresponding to different rendering modes are different, and the number of vertexes contained in the grid model of the low frame rate mode is smaller than that of vertexes contained in the grid model of the high frame rate mode.
- 3. The method according to claim 2, wherein the method further comprises: The grid model of the object to be rendered is obtained, wherein the object to be rendered comprises a central area and an edge area, the grid model is a non-uniform grid, the non-uniform grid comprises a plurality of vertexes, and the quantity of the vertexes corresponding to the central area and the edge area in the non-uniform grid of the object to be rendered is different; the vertices on the non-uniform mesh are pre-stored in the electronic device.
- 4. A method according to claim 3, characterized in that the method further comprises: The object to be rendered is a sphere.
- 5. The method according to claim 4, wherein the method further comprises: And determining the non-uniform grid according to the normal angle of the sphere relative to the sphere center and the grid step length, wherein the grid step length is the difference value of the normal angle of two adjacent vertexes of the sphere relative to the sphere center.
- 6. The method of claim 5, wherein determining the non-uniform grid based on the normal angle and the grid step on the sphere relative to the center of the sphere comprises: Under the condition that alpha is more than or equal to 0 degree and less than or equal to 60 degrees, the grid step length is more than or equal to 10 degrees and less than or equal to 15 degrees, wherein alpha represents a normal included angle relative to the sphere center on the sphere, and lambda represents the grid step length; In the case of 60 ° < α+≤90°, the mesh step size is 2+≤λ+≤4°.
- 7. A method according to claim 3, characterized in that the method further comprises: performing rotation operation on a first coordinate of the vertex based on the current time to obtain a second coordinate, wherein the first coordinate is the coordinate of the vertex on the grid model; And projecting the second coordinate to a two-dimensional space to obtain a third coordinate, wherein the third coordinate can be displayed on the touch screen.
- 8. The method of claim 7, wherein the method further comprises: determining a quadrilateral positioned on the back of the object to be rendered in the grid model according to the following formula: Wherein n represents the normal vector of any quadrilateral in the grid, Indicating the direction of the line of sight. At the position of Under the condition of (1), the quadrangle corresponding to the normal vector n is positioned on the back of the object to be rendered; Deleting the vertexes contained in the quadrangle positioned on the back of the object to be rendered in the grid model, and obtaining the first vertex set.
- 9. The method of claim 8, wherein the method further comprises: Acquiring a background texture image of the object to be rendered, wherein the background texture image is a background image of the object to be rendered in the touch screen; acquiring a texture image of the object to be rendered, and filling the texture image of the object to be rendered into the first vertex set corresponding to the grid model to obtain an object image of the object to be rendered in the touch screen; Acquiring a mask image corresponding to the object image, wherein the mask image is used for covering grids of the edge area of the object image; And taking the background texture image as a first image layer, taking the object image as a second image layer, taking the mask image as a third image layer, and rendering the object to be rendered according to the first image layer, the second image layer and the third image layer.
- 10. The method according to claim 9, wherein the method further comprises: generating a first instruction according to the first vertex set, wherein the first instruction is used for generating a texture image of the object to be rendered; Wherein the first instruction includes: A source image, wherein the source image refers to a panoramic texture image of the object to be rendered; A source region, wherein the source region refers to a region where the first vertex set is located; A target area, wherein the target area refers to an area where the third coordinate of the quadrilateral corresponding to the first vertex set is located; a transformation matrix, which refers to a matrix that maps the source region to the target region.
- 11. A computer readable storage medium having stored thereon instructions that, when executed on an electronic device, cause the electronic device to implement the method of any of claims 1 to 10.
- 12. An electronic device, comprising: A memory for storing instructions for execution by one or more processors of the electronic device; And a processor, being one of the processors of the electronic device, for executing instructions stored in the memory to implement the method of any one of claims 1 to 10.
- 13. A program product comprising instructions which, when executed on an electronic device, cause the electronic device to carry out the method of any one of claims 1 to 10.
Description
Rendering method, storage medium, electronic device, and program product Technical Field The present application relates to the field of image technologies, and in particular, to a rendering method, a storage medium, an electronic device, and a program product. Background With the widespread popularity of electronic devices (such as smart wearable devices), users have put higher demands on the visual effect of their User Interfaces (UIs), such as displaying a dynamically rotated three-dimensional (3D) earth on a smart watch dial. However, electronic devices are limited by hardware configuration, and there is a significant bottleneck in rendering such 3D visual effects. For example, the operations required for 3D rendering, such as vertex transforms, illumination calculations, etc., exceed the operational capabilities of most electronic devices. For another example, the video memory bandwidth required by frequent full screen refreshing and texture reading is insufficient, so that the tearing of the picture and the system blocking are easy to be caused, and the visual experience is reduced. For another example, continuing 3D rendering also quickly consumes battery power, shortening the endurance of the electronic device. Thus, there is a need for a rendering method adapted to an electronic device with limited hardware configuration, which reduces power consumption and effectively improves the visual effect of rendering. Disclosure of Invention In view of the above, embodiments of the present invention provide a rendering method, a storage medium, an electronic device, and a program product. In a first aspect, the present invention provides a rendering method applied to an electronic device, where the electronic device includes a touch screen, the method includes obtaining an interaction state and an electric quantity of the electronic device; and determining a rendering mode corresponding to the object to be rendered according to the interaction state and the electric quantity, wherein different rendering modes comprise different numbers of vertexes used for rendering the object to be rendered. In one possible implementation of the first aspect, the rendering mode includes a high frame rate mode, a low frame rate mode, and a low light mode, and the method further includes rendering the object to be rendered through the high frame rate mode when the interaction state is that a sliding operation is performed on the touch screen, and/or the electric quantity exceeds a first electric quantity threshold, rendering the object to be rendered through the low frame rate mode when the interaction state is that a display screen of the touch screen is stationary for more than a first time threshold, and/or the electric quantity does not exceed a second electric quantity threshold, and rendering the object to be rendered through the low frame rate mode when the interaction state is that the electric quantity is not more than a second electric quantity threshold, and/or rendering the object to be rendered through the low light mode when the interaction state is that the electronic device is in a low light mode and the electronic device is in a dormant state, and/or the electronic device detects a forced light screen, wherein the first electric quantity threshold is greater than or equal to the second electric quantity threshold, grid models of the object to be rendered corresponding to different types are different, and the grid model of the low frame rate mode includes a number of vertices smaller than the grid model of the high frame rate mode. In one possible implementation manner of the first aspect, a mesh model of an object to be rendered is obtained, where the object to be rendered includes a center area and an edge area, the mesh model is a non-uniform mesh, the non-uniform mesh includes a plurality of vertices, the number of vertices corresponding to the center area and the edge area in the non-uniform mesh of the object to be rendered is different, and the vertices on the non-uniform mesh are pre-stored in an electronic device. In a possible implementation of the first aspect described above, the object to be rendered is a sphere. In a possible implementation manner of the first aspect, the non-uniform grid is determined according to a normal angle on the sphere relative to the center of the sphere and a grid step, where the grid step is a difference between normal angles of two adjacent vertices on the sphere relative to the center of the sphere. In one possible implementation of the first aspect, the non-uniform grid is determined according to a normal angle and a grid step length on the sphere relative to the center of the sphere, including that the grid step length is 10 degrees-15 degrees with alpha being equal to or less than 0 degrees-60 degrees, wherein alpha represents the normal angle on the sphere relative to the center of the sphere, lambda represents the grid step length, and the grid step length is