Search

CN-122023634-A - Light model rendering method, device, electronic equipment, storage medium and program product

CN122023634ACN 122023634 ACN122023634 ACN 122023634ACN-122023634-A

Abstract

The present disclosure provides a light model rendering method, a device, an electronic apparatus, a storage medium and a program product, and relates to the technical field of rendering, wherein the light model rendering method includes obtaining texture data corresponding to a light model; the method comprises the steps of determining a first deformation parameter corresponding to a vertex based on a preset deformation parameter and a first coordinate corresponding to the vertex, adjusting first relative position information between the vertex and a preset reference point in a lamplight model based on the first deformation parameter, determining second relative position information corresponding to the vertex, and rendering the lamplight model based on texture data and the second relative position information corresponding to each vertex respectively. Compared with the related art, the light planarization texture effect can be enhanced.

Inventors

  • ZHANG SHENG

Assignees

  • 网易(杭州)网络有限公司

Dates

Publication Date
20260512
Application Date
20251217

Claims (15)

  1. 1. A method of rendering a light model, the method comprising: obtaining texture data corresponding to the lamplight model; For at least one vertex in the lamplight model, determining a first deformation parameter corresponding to the vertex based on a preset deformation parameter and a first coordinate corresponding to the vertex, wherein the preset deformation parameter is a deformation parameter corresponding to a preset coordinate in the texture data in a first preset coordinate direction, and the first coordinate is a coordinate of the vertex in the first preset coordinate direction; based on the first deformation parameters, adjusting first relative position information between the vertex and a preset reference point in the lamplight model, and determining second relative position information corresponding to the vertex; And rendering the lamplight model based on the texture data and second relative position information corresponding to each vertex respectively.
  2. 2. The method of claim 1, wherein the preset deformation parameters include a first preset deformation parameter and a second preset deformation parameter, and wherein the determining the first deformation parameter corresponding to the vertex based on the preset deformation parameter and the first coordinate corresponding to the vertex includes: and determining the first deformation parameter based on the first preset deformation parameter, the second preset deformation parameter and the first coordinate, wherein the first preset coordinate corresponding to the first preset deformation parameter and the second preset coordinate corresponding to the second preset deformation parameter are adjacent in the direction of the first preset coordinate, and the first coordinate is located between the first preset coordinate and the second preset coordinate.
  3. 3. The method of claim 2, wherein the determining the first deformation parameter based on the first preset deformation parameter, the second preset deformation parameter, and the first coordinate comprises: and carrying out linear interpolation on the deformation parameters of the coordinates between the first preset coordinates and the second preset coordinates based on the first preset deformation parameters and the second preset deformation parameters to obtain the first deformation parameters.
  4. 4. A method according to any one of claims 1-3, wherein said adjusting the first relative position information between the vertex and a preset reference point in the light model based on the first deformation parameter, before determining the second relative position information corresponding to the vertex, the method further comprises: acquiring a second coordinate of the vertex in a world coordinate system and a third coordinate of the preset reference point in the world coordinate system; And determining a first relative position vector between the vertex and the preset reference point based on the second coordinate and the third coordinate, wherein the first relative position vector is used for indicating the first relative position information.
  5. 5. The method of claim 4, wherein the predetermined deformation parameters include sub-parameters corresponding to each coordinate axis in the world coordinate system, wherein the adjusting the first relative position information between the vertex and a predetermined reference point in the light model based on the first deformation parameters, and determining the second relative position information corresponding to the vertex comprises: And for each coordinate axis, determining a value corresponding to the coordinate axis in a second relative position vector according to the sub-parameter corresponding to the coordinate axis and the value in the first relative position vector, wherein the second relative position vector is used for indicating the second relative position information.
  6. 6. The method of claim 4, wherein prior to rendering the light model based on the texture data and the second relative position information for each of the vertices, the method further comprises: Acquiring a fourth coordinate of the virtual camera in the world coordinate system at the current moment; and constructing a target coordinate system based on the fourth coordinate, the third coordinate and a second preset coordinate direction in the world coordinate system.
  7. 7. The method of claim 6, wherein rendering the light model based on the texture data and second relative position information for each of the vertices, respectively, comprises: for each vertex, determining a fifth coordinate of the vertex in the target coordinate system based on second relative position information corresponding to the vertex; based on the fifth coordinate, adjusting the coordinate of the current moment of the vertex in the world coordinate system, and determining a sixth coordinate of the vertex; Rendering the light model based on the texture data and the sixth coordinates of each of the vertices.
  8. 8. The method of claim 7, wherein said rendering the light model based on the texture data and the sixth coordinates of each of the vertices comprises: generating smoothing parameters corresponding to a plurality of coordinates in the direction of the first preset coordinates based on a third preset coordinate and a fourth preset coordinate in the direction of the first preset coordinates; And rendering the lamplight model based on the texture data, the sixth coordinate of each vertex and the smoothing parameters corresponding to the coordinates.
  9. 9. The method according to claim 8, wherein the generating smoothing parameters respectively corresponding to the plurality of coordinates in the first preset coordinate direction based on the third preset coordinate and the fourth preset coordinate in the first preset coordinate direction includes: Determining a gradual change position in the direction of the first preset coordinate according to the third preset coordinate and the fourth preset coordinate; and generating smoothing parameters corresponding to the coordinates respectively according to the gradual change positions and a preset curve interpolation rule.
  10. 10. The method of claim 8, wherein rendering the light model based on the texture data, the sixth coordinate of each of the vertices, and smoothing parameters to which the plurality of coordinates respectively correspond, comprises: generating gradient data corresponding to the coordinates respectively based on the first preset gradient parameter, the second preset gradient parameter and the smoothing parameters corresponding to the coordinates respectively; And rendering the lamplight model based on the texture data, the sixth coordinate of each vertex and the gradual change data corresponding to the coordinates.
  11. 11. A method according to any one of claims 1-3, wherein prior to obtaining texture data corresponding to a light model, the method further comprises: Acquiring a reference view corresponding to the lamplight model under the visual angle of the front virtual camera; tiling texture coordinates corresponding to the lamplight model according to the visual angle of the front virtual camera based on the reference view; and generating the texture data based on the tiled texture coordinates.
  12. 12. A lighting model rendering device, the device comprising: The acquisition module is used for acquiring texture data corresponding to the lamplight model; The determining module is used for determining a first deformation parameter corresponding to at least one vertex in the lamplight model based on a preset deformation parameter and a first coordinate corresponding to the vertex, wherein the preset deformation parameter is a deformation parameter corresponding to a preset coordinate in a first preset coordinate direction in the texture data, and the first coordinate is a coordinate of the vertex in the first preset coordinate direction; The adjusting module is used for adjusting first relative position information between the vertex and a preset reference point in the lamplight model based on the first deformation parameter and determining second relative position information corresponding to the vertex; and the rendering module is used for rendering the lamplight model based on the texture data and the second relative position information corresponding to each vertex respectively.
  13. 13. An electronic device, comprising: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the light model rendering method of any of claims 1 to 11.
  14. 14. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the light model rendering method of any one of claims 1 to 11.
  15. 15. A computer program product comprising computer instructions for causing a computer to perform the light model rendering method of any one of claims 1 to 11.

Description

Light model rendering method, device, electronic equipment, storage medium and program product Technical Field The disclosure relates to the technical field of rendering, in particular to a lamplight model rendering method, a lamplight model rendering device, electronic equipment, a storage medium and a program product. Background In virtual scenes (e.g., games, virtual simulations, digital twin systems), the light model serves as a core element in the scene visual system, and the rendering quality directly determines the immersion experience of the user on the scene. The lighting effect and the texture detail of the lamplight model are presented at present so as to simulate the irradiation characteristics of different light sources and realize the expected rendering effect. However, in the rendering process of the light model, there are problems such as non-ideal light planarization texture effect, and the like, so that the rendering mode of the light model needs to be optimized to improve the visual presentation quality of the virtual scene. Disclosure of Invention In view of the above, the present disclosure provides a light model rendering method, apparatus, electronic device, storage medium and program product, so as to solve the problem of non-ideal light planarization texture effect in the related art. In a first aspect, the present disclosure provides a light model rendering method, including: obtaining texture data corresponding to the lamplight model; For at least one vertex in the lamplight model, determining a first deformation parameter corresponding to the vertex based on a preset deformation parameter and a first coordinate corresponding to the vertex, wherein the preset deformation parameter is a deformation parameter corresponding to a preset coordinate in the texture data in the direction of the first preset coordinate, and the first coordinate is a coordinate of the vertex in the direction of the first preset coordinate; Based on the first deformation parameters, adjusting first relative position information between the vertex and a preset reference point in the lamplight model, and determining second relative position information corresponding to the vertex; And rendering the lamplight model based on the texture data and the second relative position information corresponding to each vertex respectively. In a second aspect, the present disclosure provides a light model rendering apparatus, the apparatus comprising: The acquisition module is used for acquiring texture data corresponding to the lamplight model; The determining module is used for determining a first deformation parameter corresponding to the vertex based on a preset deformation parameter and a first coordinate corresponding to the vertex for at least one vertex in the lamplight model, wherein the preset deformation parameter is a deformation parameter corresponding to a preset coordinate in a first preset coordinate direction in texture data, and the first coordinate is a coordinate of the vertex in the first preset coordinate direction; the adjusting module is used for adjusting the first relative position information between the vertex and a preset reference point in the lamplight model based on the first deformation parameter and determining the second relative position information corresponding to the vertex; and the rendering module is used for rendering the lamplight model based on the texture data and the second relative position information corresponding to each vertex respectively. In a third aspect, the present disclosure provides an electronic device, including a memory and a processor, where the memory and the processor are communicatively connected to each other, and the memory stores computer instructions, and the processor executes the computer instructions, thereby executing the light model rendering method of the first aspect or any implementation manner corresponding to the first aspect. In a fourth aspect, the present disclosure provides a computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the light model rendering method of the first aspect or any one of its corresponding embodiments. In a fifth aspect, the present disclosure provides a computer program product comprising computer instructions for causing a computer to perform the light model rendering method of the first aspect or any of its corresponding embodiments. In the light model rendering method provided by the embodiment of the disclosure, the preset deformation parameters corresponding to the preset coordinates in the direction of the first preset coordinates in the texture data are taken as the basis, the corresponding deformation parameters are determined by combining the texture coordinates of the vertexes, so that the binding of the deformation parameters and the texture coordinates is realized, the lasting problem caused by the dislocation of textures and deformations in the relat