Search

CN-122023635-A - Light supplementing rendering method and device for virtual character and electronic equipment

CN122023635ACN 122023635 ACN122023635 ACN 122023635ACN-122023635-A

Abstract

The invention provides a light supplementing and rendering method, device and electronic equipment of a virtual character, wherein the method comprises the steps that the virtual character is located in a virtual scene, the virtual scene further comprises a virtual camera, a detection point is determined in the virtual scene based on the sight target position of the virtual camera, whether the detection point is located in a shadow area of the virtual scene or not is detected to obtain a detection result, a first light supplementing intensity is determined based on the character orientation of the virtual character and the light ray direction of a scene light source, a final light supplementing intensity is generated based on the detection result, the first light supplementing intensity and a preset second light supplementing intensity, and the virtual character is subjected to light supplementing and rendering according to the final light supplementing intensity. In the above manner, the final light-supplementing intensity is determined jointly by using the first light-supplementing intensity and the preset second light-supplementing intensity, and when the virtual character is located in the shadow area and faces the scene light source, the light supplementing can be performed through the second light-supplementing intensity, so that the stability of the light-supplementing effect of the character is improved, and the visual effect of the virtual character is improved.

Inventors

  • Zou Panchen
  • ZHENG QIQIANG
  • ZHOU MINZHE

Assignees

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

Dates

Publication Date
20260512
Application Date
20260106

Claims (15)

  1. 1. A light supplementing rendering method of a virtual character is characterized in that the virtual character is located in a virtual scene, the virtual scene further comprises a virtual camera, and the method comprises the following steps: Determining a detection point in the virtual scene based on a gaze target position of the virtual camera; Detecting whether the detection point is positioned in a shadow area of the virtual scene or not to obtain a detection result, wherein the shadow area is generated by irradiating a specified model through a scene light source in the virtual scene; determining a first light supplementing intensity based on a character orientation of the virtual character and a light ray direction of the scene light source; And generating final light supplementing intensity based on the detection result, the first light supplementing intensity and the preset second light supplementing intensity, and performing light supplementing rendering on the virtual character according to the final light supplementing intensity.
  2. 2. The method of claim 1, wherein prior to the step of determining detection points in the virtual scene based on the gaze target location of the virtual camera, the method further comprises: Responding to the virtual camera to shoot along with the virtual character, and determining the character position of the virtual character as the sight line target position of the virtual camera; or responding that the virtual camera does not follow the virtual character to shoot, and determining the sight line target position in the virtual scene based on the preset focus parameter of the virtual camera.
  3. 3. The method of claim 1, wherein the step of determining detection points in the virtual scene based on the gaze target position of the virtual camera comprises: and determining the scene position meeting the preset relative position condition with the sight line target position of the virtual camera from the virtual scene, and determining the determined scene position as a detection point.
  4. 4. The method of claim 1, wherein the step of detecting whether the detection point is located in a shadow area of the virtual scene comprises: the scene depth of the appointed model in the virtual scene and the scene depth of the detection point are obtained by taking the scene light source as a starting point, and the screen space position corresponding to the detection point is obtained, wherein the screen space position is positioned in the screen space corresponding to a scene picture shot by taking the scene light source as a visual angle; Acquiring the scene depth corresponding to the screen space position from the scene depth of the appointed model; And determining whether the detection point is positioned in a shadow area of the virtual scene or not based on the scene depth corresponding to the screen space position and the scene depth of the detection point.
  5. 5. The method of claim 4, wherein the step of determining whether the detection point is located in a shadow area of the virtual scene based on a scene depth corresponding to the screen space position and a scene depth of the detection point comprises: Determining that the detection point is not positioned in a shadow area of the virtual scene in response to the scene depth corresponding to the screen space position being greater than or equal to the scene depth of the detection point; And/or determining that the detection point is positioned in a shadow area of the virtual scene in response to the scene depth corresponding to the screen space position being smaller than the scene depth of the detection point.
  6. 6. The method of claim 1, wherein the step of determining a first supplemental light intensity based on a character orientation of the virtual character and a ray direction of the scene illuminant comprises: Acquiring a direction included angle between the character orientation and the light direction of the scene light source; and determining the first light supplementing intensity within a preset light supplementing intensity range based on the direction included angle.
  7. 7. The method of claim 6, wherein determining a first supplemental light intensity within a predetermined supplemental light intensity range based on the included angle, comprises: acquiring front-side light-compensating intensity and side-side light-compensating intensity preset by the virtual character in response to the direction included angle being in a first included angle range; Or responding that the direction included angle is positioned in a second included angle range, acquiring back surface light supplementing intensity and side surface light supplementing intensity preset by the virtual character; The maximum value in the first included angle range is smaller than or equal to the minimum value in the second included angle range, the front side light compensating intensity is smaller than or equal to the side light compensating intensity, and the side light compensating intensity is smaller than or equal to the back side light compensating intensity.
  8. 8. The method of claim 1, wherein prior to the step of generating a final supplemental light intensity based on the detection result, the first supplemental light intensity, and a preset second supplemental light intensity, the method further comprises: Aiming at a current pixel to be rendered of a scene picture to be rendered, determining a light filling attenuation parameter of the current pixel to be rendered based on the distance between the current pixel to be rendered and a picture center pixel of the scene picture; And determining a second light supplementing intensity based on the light supplementing attenuation parameter and the back light supplementing intensity preset by the virtual character.
  9. 9. The method of claim 8, wherein determining the light-compensating attenuation parameter for the current pixel to be rendered based on a distance between the current pixel to be rendered and a picture center pixel of the scene picture comprises: controlling the light filling attenuation parameter of the current pixel to be rendered to increase along with the increase of the distance in response to the distance between the current pixel to be rendered and the picture center pixel of the scene picture being smaller than a preset distance threshold; And controlling the light filling attenuation parameter of the current pixel to be rendered to be a preset maximum value in response to the distance between the current pixel to be rendered and the picture center pixel of the scene picture being greater than or equal to a preset distance threshold.
  10. 10. The method of claim 8, wherein the step of determining a second light intensity based on the light attenuation parameter and a back light intensity preset by the virtual character comprises: And performing linear interpolation processing on back surface light compensation intensity and reference light compensation intensity preset by the virtual character based on the light compensation attenuation parameters to obtain second light compensation intensity, wherein the back surface light compensation intensity is larger than the reference light compensation intensity.
  11. 11. The method of claim 1, wherein the detection points include a plurality of detection points, and wherein the step of generating a final light intensity based on the detection result, the first light intensity, and a preset second light intensity comprises: Acquiring a quantity ratio of a first quantity of detection points in a shadow area of the virtual scene to the total quantity of the detection points; And performing linear interpolation processing on the first light supplementing intensity and the preset second light supplementing intensity based on the quantity ratio to obtain final light supplementing intensity.
  12. 12. The method of claim 1, wherein the step of light-filling rendering the virtual character according to the final light filling intensity comprises: adjusting the appointed illumination intensity in the virtual scene based on the final light supplementing intensity, wherein the appointed illumination intensity comprises at least one of the ambient light intensity, the image-based illumination intensity and the spherical harmonic illumination intensity of the virtual scene; superposing the adjusted appointed illumination intensity, the illumination intensity of the scene light source and the illumination intensity of the lens of the virtual camera to obtain the superposed illumination intensity; and rendering the virtual character based on the superimposed illumination intensity to obtain a rendering effect of the virtual character after light supplementing.
  13. 13. A light filling rendering device of a virtual character is characterized in that the virtual character is located in a virtual scene, the virtual scene further comprises a virtual camera, and the device comprises: a detection point determining module for determining a detection point in the virtual scene based on a gaze target position of the virtual camera; The detection module is used for detecting whether the detection point is positioned in a shadow area of the virtual scene to obtain a detection result, wherein the shadow area is generated by irradiating a specified model through a scene light source in the virtual scene; the intensity determining module is used for determining first light supplementing intensity based on the role orientation of the virtual role and the light ray direction of the scene light source; and the light supplementing rendering module is used for generating final light supplementing intensity based on the detection result, the first light supplementing intensity and the preset second light supplementing intensity, and performing light supplementing rendering on the virtual character according to the final light supplementing intensity.
  14. 14. An electronic device comprising a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method of light-compensating rendering of a virtual character of any of claims 1-12.
  15. 15. A computer readable storage medium storing computer executable instructions which, when invoked and executed by a processor, cause the processor to implement the method of light-supplementing rendering of a virtual character according to any one of claims 1 to 12.

Description

Light supplementing rendering method and device for virtual character and electronic equipment Technical Field The present invention relates to the field of virtual rendering technologies, and in particular, to a method and an apparatus for light supplementing rendering of a virtual character, and an electronic device. Background In order to ensure visual effect of the virtual character, when the virtual character is weak in illumination, the virtual character needs to be subjected to light supplementing. In the related art, the light supplementing intensity of the virtual character is generally determined according to the angle between the character direction of the virtual character and the direction of the scene light in the virtual scene, for example, when the angle is larger, the light supplementing intensity is represented by the backlight of the virtual character, so that the problem that the virtual character is darkened due to the backlight is solved. However, when the virtual character enters the shadow area of the virtual scene, and the virtual character faces the scene light source, the light supplementing cannot be performed in the mode because the included angle between the character orientation and the direction of the scene light is smaller, so that the virtual character is still dark, and the character light supplementing effect stability is poor. Disclosure of Invention Accordingly, the present invention is directed to a method, an apparatus, and an electronic device for light-supplementing rendering of a virtual character, so as to improve stability of light-supplementing effect of the character and improve visual effect of the virtual character. The embodiment of the invention provides a light supplementing and rendering method for a virtual character, wherein the virtual character is located in a virtual scene, the virtual scene further comprises a virtual camera, the method comprises the steps of determining a detection point in the virtual scene based on the sight target position of the virtual camera, detecting whether the detection point is located in a shadow area of the virtual scene to obtain a detection result, wherein the shadow area is generated by irradiating a specified model through a scene light source in the virtual scene, determining first light supplementing intensity based on the character orientation of the virtual character and the light ray direction of the scene light source, generating final light supplementing intensity based on the detection result, the first light supplementing intensity and a preset second light supplementing intensity, and conducting light supplementing and rendering on the virtual character according to the final light supplementing intensity. The embodiment of the invention provides a light supplementing rendering device of a virtual character, wherein the virtual character is located in a virtual scene, the virtual scene further comprises a virtual camera, a detection point determining module is used for determining a detection point in the virtual scene based on the sight target position of the virtual camera, a detection module is used for detecting whether the detection point is located in a shadow area of the virtual scene to obtain a detection result, the shadow area is generated by irradiating a specified model through a scene light source in the virtual scene, an intensity determining module is used for determining first light supplementing intensity based on the character orientation of the virtual character and the light direction of the scene light source, and a light supplementing rendering module is used for generating final light supplementing intensity based on the detection result, the first light supplementing intensity and a preset second light supplementing intensity and conducting light supplementing rendering on the virtual character according to the final light supplementing intensity. In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, where the memory stores computer executable instructions executable by the processor, and the processor executes the computer executable instructions to implement the light-compensating rendering method of the virtual character. In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform a method for light-compensating rendering of the above-mentioned virtual character. The embodiment of the invention has the following beneficial effects: The light supplementing rendering method, device and electronic equipment for the virtual character are characterized in that the virtual character is located in a virtual scene, the virtual scene further comprises a virtual camera, a detection point is determined in the virtual scene based on the sight target position of t