Search

CN-119919556-B - Texture rendering method, device, equipment and program product

CN119919556BCN 119919556 BCN119919556 BCN 119919556BCN-119919556-B

Abstract

The present application relates to the field of rendering technologies, and in particular, to a texture rendering method, apparatus, device, and program product. The method comprises the steps of obtaining vertex data of N small texture images, wherein N is a positive integer, the vertex data comprise index information corresponding to each small texture image, inputting the vertex data of the N small texture images into a shader, and calling the shader to render each small texture image based on the index information. The method and the device can improve the rendering efficiency of texture rendering on equipment with lower computing performance.

Inventors

  • HU CHAOCHAO
  • YUE YILIN
  • ZHANG HE

Assignees

  • 浙江吉利控股集团有限公司
  • 吉利汽车研究院(宁波)有限公司

Dates

Publication Date
20260508
Application Date
20250106

Claims (10)

  1. 1. A texture rendering method, comprising: Obtaining vertex data of N small texture images, wherein N is a positive integer, the vertex data comprises index information corresponding to each small texture image, and the small texture images refer to image data which is processed as a basic unit in a texture rendering process; Inputting vertex data of the N small texture images into a shader; And calling the shaders to respectively render each small texture image based on the index information, wherein the shaders comprise vertex shaders and fragment shaders, and the index information is transmitted from the vertex shaders to the fragment shaders.
  2. 2. The texture rendering method according to claim 1, wherein the acquiring vertex data of the N small texture images includes: Creating a data list based on the number M of texture units in the rendering device, wherein M is a positive integer greater than or equal to N, and the data list is used for storing vertex data of at most M small texture images; Storing vertex data of the N small texture images to the data list; the inputting vertex data of the N small texture images into a shader includes: the data list is input to the shader.
  3. 3. The texture rendering method according to claim 1, wherein the invoking the shader to render each of the small texture images based on the index information, respectively, comprises: invoking the vertex shader, receiving the vertex data, and transmitting the vertex data to the fragment shader; And calling the fragment shader, and rendering each small texture image based on the index information.
  4. 4. A method of texture rendering as claimed in claim 3, wherein the index information received by the vertex shader comprises index data of a floating point type; The invoking the shader, before rendering each small texture image based on the index information, further includes: The index information is converted from the floating point type to an integer type by the fragment shader.
  5. 5. The texture rendering method according to claim 1, wherein the acquiring vertex data of the N small texture images includes: Loading a large texture image into a graphic memory based on a first texture identifier of the large texture image, wherein the large texture image comprises P small texture images, a second texture identifier of each small texture image in the large texture image is identical to the first texture identifier, and P is an integer greater than or equal to N; traversing the small texture images in the large texture images, determining N small texture images, and obtaining the vertex data of the N small texture images.
  6. 6. The texture rendering method of claim 5, wherein the invoking the shader, after rendering each of the small texture images based on the index information, respectively, further comprises: Judging whether the small texture image in the large texture image is completely traversed, if not, determining N unrendered small texture images in the large texture image again, and obtaining the vertex data of the N re-determined small texture images until the small texture image in the large texture image is completely traversed.
  7. 7. The texture rendering method of any one of claims 1 to 6, wherein the vertex data includes custom texture coordinates; The custom texture coordinates include the index information.
  8. 8. A texture rendering apparatus, comprising: The system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring vertex data of N small texture images, wherein N is a positive integer, the vertex data comprises index information corresponding to each small texture image respectively, and the small texture images refer to image data which is processed as a basic unit in a texture rendering process; the input module is used for inputting vertex data of the N small texture images into a shader; and the rendering module is used for calling the shaders and respectively rendering each small texture image based on the index information, wherein the shaders comprise vertex shaders and fragment shaders, and the index information is transmitted from the vertex shaders to the fragment shaders.
  9. 9. An electronic device is characterized by comprising a memory and a processor; the memory is connected with the processor and used for storing programs; The processor is configured to implement the texture rendering method according to any one of claims 1 to 7 by running a program in the memory.
  10. 10. A computer program product comprising computer program instructions; The computer program instructions, when executed by a processor, cause the processor to perform the texture rendering method of any one of claims 1-7.

Description

Texture rendering method, device, equipment and program product Technical Field The present application relates to the field of rendering technologies, and in particular, to a texture rendering method, apparatus, device, and program product. Background With the development of technology, the texture rendering technology is increasingly applied to the life of people, for example, the texture rendering technology is implemented on devices such as vehicle-mounted instruments, vehicle machines, intelligent home equipment and the like, so that a richer and more exquisite picture is provided for users. However, the current texture rendering principle rendering modes mainly comprise immediate rendering and multi-target rendering. Immediate rendering refers to rendering each texture one by one, and the rendering mode is high in efficiency under the condition of small number of textures, but when a large number of textures are rendered, the rendering efficiency is reduced by frequently calling a rendering function. The multi-target rendering may generate rendering results for a plurality of textures through one invocation of the rendering function. However, the multi-target rendering has high performance requirements on the device, and cannot be applied to devices with low computing performance, such as vehicle-mounted instruments. Disclosure of Invention Based on the defects and shortcomings of the prior art, the application provides a texture rendering method, a device, equipment and a program product, which can improve the rendering efficiency of texture rendering on equipment with lower computing performance. According to a first aspect of the application, a texture rendering method is provided, which comprises the steps of obtaining vertex data of N small texture images, wherein N is a positive integer, the vertex data comprise index information corresponding to each small texture image respectively, inputting the vertex data of the N small texture images into a shader, and calling the shader to render each small texture image based on the index information respectively. According to the texture rendering method provided by the first aspect of the application, the method for acquiring the vertex data of N small texture images comprises the steps of creating a data list based on the number M of texture units in rendering equipment, wherein M is a positive integer greater than or equal to N, the data list is used for storing the vertex data of at most M small texture images, storing the vertex data of the N small texture images into the data list, and inputting the vertex data of the N small texture images into a shader, wherein the data list is input into the shader. According to the texture rendering method provided by the first aspect of the application, the shader comprises a vertex shader and a fragment shader, the invoking of the shader is used for respectively rendering each small texture image based on the index information, the invoking of the vertex shader is used for receiving the vertex data and transmitting the vertex data to the fragment shader, and the invoking of the fragment shader is used for rendering each small texture image based on the index information. According to the texture rendering method provided by the first aspect of the application, the index information received by the vertex shader comprises index data of a floating point type, and the method further comprises the step of converting the index information from the floating point type to an integer type through the fragment shader before respectively rendering each small texture image based on the index information. According to the texture rendering method provided by the first aspect of the application, vertex data of N small texture images are acquired, wherein the method comprises the steps of loading the large texture images into a graphic memory based on first texture identifiers of the large texture images, wherein the large texture images comprise P small texture images, second texture identifiers of each small texture image in the large texture images are identical to the first texture identifiers, P is an integer greater than or equal to N, traversing the small texture images in the large texture images, determining N small texture images, and acquiring the vertex data of N small texture images. According to the texture rendering method provided by the first aspect of the application, after each small texture image is rendered based on the index information, the method further comprises the steps of judging whether the small texture image in the large texture image is completely traversed, if not, determining N unrendered small texture images in the large texture image again, and obtaining the vertex data of the N re-determined small texture images until the small texture image in the large texture image is completely traversed. According to the texture rendering method provided by the first aspect of the application, th