Highlight effect rendering method and device, equipment, storage medium and program product
By determining the target light source position and light intensity in the virtual scene, the problem of insufficient flexibility in the use of highlight effects in the virtual scene is solved, and the realism of the virtual scene is significantly improved.
Patent Information
- Application Number
- CN202310246870.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-07
- Publication Date
- 2024-09-10
AI Technical Summary
The existing technology cannot flexibly use the highlight effect in virtual scenes, resulting in virtual scenes that are not realistic enough and have poor realism.
By obtaining the initial light source position and the target part position of the virtual light source in the virtual scene, the target light source position is determined based on the target part and the initial light source position, the target area and its illumination intensity are determined, and the highlight effect is rendered on the target part based on this information.
It realizes the flexible use of highlight effects in the target area of virtual objects, significantly enhancing the realism of the virtual scene.
Smart Images

Figure CN118628633A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment, storage medium and program product for rendering a highlight effect. Background Art
[0002] With the development of image rendering technology, in order to simulate more realistic virtual scenes, the highlight effects in virtual scenes are usually rendered.
[0003] In the related art, the rendering of highlight effects is usually based on the actual lighting environment in the virtual scene, and the highlight effects are rendered in the area of the virtual scene that meets the highlight reflection conditions. It is impossible to render the highlight effects in specific areas according to actual needs, so that the highlight effects cannot be flexibly used, and the picture of the virtual scene is not realistic enough, resulting in poor picture realism of the virtual scene. Summary of the invention
[0004] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for rendering a highlight effect.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application provides a method for rendering a highlight effect, including:
[0007] Acquire an initial light source position of a virtual light source in a virtual scene, and a position of a target part of a virtual object in the virtual scene;
[0008] Acquire a target light source position capable of forming a high light reflection in the virtual scene by combining the position of the target part in the virtual scene and the initial light source position;
[0009] Determine a target area in the target area and the light intensity on the target area in combination with the position of the target area in the virtual scene and the position of the target light source;
[0010] Wherein, the target area is the area in the target part where the high light reflection is formed;
[0011] Based on the target area and the light intensity, a highlight effect is rendered at the target part to obtain a rendering result, and the rendering result is used to form the highlight reflection at the target part.
[0012] The present application provides a device for rendering a highlight effect, including:
[0013] An acquisition module, used to acquire an initial light source position of a virtual light source in a virtual scene, and a position of a target part of a virtual object in the virtual scene;
[0014] A position determination module, used to obtain a target light source position capable of forming a high light reflection in the virtual scene by combining the position of the target part in the virtual scene and the initial light source position;
[0015] An area determination module, used to determine a target area in the target part and the light intensity on the target area in combination with the position of the target part in the virtual scene and the position of the target light source; wherein the target area is the area in the target part where the high light reflection is formed;
[0016] A rendering module is used to render a highlight effect at the target part based on the target area and the light intensity to obtain a rendering result, and the rendering result is used to form the highlight reflection at the target part.
[0017] In some embodiments, the above-mentioned position determination module is also used to determine the initial lighting information of the target part in combination with the position of the target part in the virtual scene and the initial light source position; when the initial lighting information indicates that the initial virtual light can form the highlight reflection on the target part, the initial light source position is determined as the target light source position, wherein the initial virtual light is emitted by the virtual light source; when the initial lighting information indicates that the initial virtual light cannot form the highlight reflection on the target part, the target light source position that can form the highlight reflection is determined in the virtual scene, and the virtual light source is moved from the initial light source position to the target light source position.
[0018] In some embodiments, the above-mentioned position determination module is also used to obtain the initial virtual light emitted by the virtual light source at the initial light source position; when the initial virtual light cannot illuminate the position of the target part in the virtual scene, the initial lighting information is determined as the first lighting information, wherein the first lighting information is used to indicate that the initial virtual light cannot form the highlight reflection on the target part; when the initial virtual light can illuminate the position of the target part in the virtual scene, the initial reflected light corresponding to the initial virtual light is obtained, and based on the initial reflected light, the initial lighting information of the target part is determined; wherein the initial reflected light is a virtual light formed by the reflection of the initial virtual light on the target part.
[0019] In some embodiments, the above-mentioned position determination module is also used to obtain shooting rays corresponding to each of the position points, wherein the shooting rays are rays constructed with the position point as the end point and the target virtual camera as the starting point, and the target virtual camera is a virtual camera in the virtual scene used to shoot the target part; when the initial reflected light does not coincide with each of the shooting rays, the initial lighting information is determined as the first lighting information; when the initial reflected light coincides with at least one of the shooting rays, the initial lighting information is determined as the second lighting information, wherein the second lighting information is used to indicate that the initial virtual light can form the highlight reflection on the target part.
[0020] In some embodiments, the position of the target part in the virtual scene includes at least one position point; the above-mentioned position determination module is also used to obtain the shooting rays corresponding to each of the position points, and the shooting rays are constructed with the position point as the end point and the target virtual camera as the starting point. The target virtual camera is a virtual camera in the virtual scene used to shoot the target part; combining the shooting rays and the position points, determining the reflected rays corresponding to each of the position points, and the position point is the starting point of the corresponding reflected ray; based on each of the reflected rays, determining the target light source position.
[0021] In some embodiments, the above-mentioned position determination module is also used to select a candidate light source position from the reflected rays when the number of the reflected rays is one, the candidate light source position being any position on the reflected rays except the position point, and determine the candidate light source position as the target light source position; when the number of the reflected rays is at least two, select a target intersection from at least one intersection formed by at least two of the reflected rays, and determine the position of the target intersection in the virtual scene as the target light source position; wherein, the number of the reflected rays intersecting at the target intersection is the maximum value of the numbers corresponding to each of the intersections.
[0022] In some embodiments, the above-mentioned position determination module is also used to perform the following processing for each of the position points: obtain the normal vector corresponding to the position point, and the normal vector is perpendicular to the tangent plane of the position point; combine the shooting ray corresponding to the position point and the normal vector to determine the reflected ray corresponding to the position point; wherein the angle between the reflected ray and the normal vector is equal to the angle between the shooting ray and the normal vector.
[0023] In some embodiments, the position of the target part in the virtual scene includes at least one position point, and the above-mentioned area determination module is also used to select at least one target position point corresponding to the target light source position from the at least one position point, and the target virtual light emitted by the virtual light source at the target light source position can form the high light reflection on the target position point; the area formed by each of the target position points is determined as the target area; the position light intensity corresponding to each of the target position points is determined, and based on the position light intensity, the light intensity on the target area is determined.
[0024] In some embodiments, the above-mentioned area determination module is also used to perform the following processing for each of the target position points: obtain the light source irradiance of the virtual light source, and determine the first distance between the virtual light source and the target position point, and the second distance between the target position point and the target virtual camera, the target virtual camera is a virtual camera used to shoot the target part in the virtual scene; add the first distance and the second distance to obtain the total distance, and determine the loss value of the light source irradiance based on the total distance and the target position point; subtract the light source irradiance from the loss value to obtain the position light intensity corresponding to the target position point.
[0025] In some embodiments, the above-mentioned area determination module is also used to determine a first loss value of the light source irradiance based on the total distance, and the first loss value is proportional to the numerical value of the total distance; wherein the first loss value is used to indicate the energy absorption value of the propagation medium on the target propagation path to the light source irradiance, and the target propagation path is the propagation path from the virtual light source through the target position point to the target virtual camera; based on the target position point, determine the second loss value of the light source irradiance, and the second loss value is used to indicate the energy absorption value of the light source irradiance at the target position point; the first loss value and the second loss value are summed to obtain the loss value of the light source irradiance.
[0026] In some embodiments, the above-mentioned area determination module is also used to receive a setting instruction for the position light intensity sent by the terminal, and in response to the setting instruction, adjust the position light intensity to obtain an adjusted position light intensity, wherein the setting instruction carries the adjustment range of the position light intensity; and determine each of the adjusted position light intensities as the light intensity of the corresponding target position point on the target area.
[0027] An embodiment of the present application provides an electronic device, including:
[0028] A memory for storing computer executable instructions or computer programs;
[0029] The processor is used to implement the highlight effect rendering method provided in the embodiment of the present application when executing the computer executable instructions or computer program stored in the memory.
[0030] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for causing a processor to execute the method for rendering a highlight effect provided in the embodiment of the present application.
[0031] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device performs the above-mentioned method for rendering the highlight effect in the embodiment of the present application.
[0032] The embodiments of the present application have the following beneficial effects:
[0033] By combining the position of the target part in the virtual scene and the initial light source position, the target light source position that can form highlight reflection is obtained in the virtual scene, and the target area in the target part that can form highlight reflection and the light intensity on the target area are determined in combination with the position of the target part in the virtual scene. Based on the target area and the light intensity, the highlight effect is rendered at the target part to obtain the rendering result. In this way, by determining the target light source position, a highlight reflection is formed in the target area on the target part of the virtual object, and the highlight effect is rendered at the target part to obtain the rendering result, so that the highlight effect can be flexibly used at the target part, effectively enhancing the picture realism of the virtual scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 is a schematic diagram of the architecture of a rendering system for highlight effects provided in an embodiment of the present application;
[0035] Figure 2 is a schematic diagram of the structure of an electronic device for rendering highlight effects provided in an embodiment of the present application;
[0036] Figures 3 to 5 It is a flowchart of a method for rendering a highlight effect provided in an embodiment of the present application;
[0037] Figure 6 It is a schematic diagram of the effect of the method for rendering highlight effects provided in an embodiment of the present application;
[0038] Figure 7 It is a schematic diagram of the principle of a method for rendering a highlight effect provided in an embodiment of the present application;
[0039] Figure 8 It is a schematic diagram of the principle of the initial reflected light provided in the embodiment of the present application;
[0040] Fig. 9 is a schematic diagram of the principle of initial illumination information provided by an embodiment of the present application;
[0041] Fig.10 is a schematic diagram of the principle of initial illumination information provided by an embodiment of the present application;
[0042] Fig.11 is a schematic diagram of the principle of the target light source position provided in an embodiment of the present application;
[0043] Fig.12 is a schematic diagram of the principle of the target light source position provided in an embodiment of the present application;
[0044] Fig.13 is a schematic diagram of the principle of the target location point provided in the embodiment of the present application;
[0045] Fig.14 is a schematic diagram of a propagation path provided in an embodiment of the present application;
[0046] Fig.15 It is a schematic diagram of the effect of the method for rendering highlight effects provided in an embodiment of the present application;
[0047] Fig.16 It is a flowchart of a method for rendering a highlight effect provided in an embodiment of the present application;
[0048] Fig.17 It is a schematic diagram of the principle of a method for rendering a highlight effect provided in an embodiment of the present application;
[0049] Fig.18 It is a schematic diagram of the principle of a method for rendering a highlight effect provided in an embodiment of the present application;
[0050] Fig.19 It is a schematic diagram of the effect of the method for rendering highlight effects provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0052] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0053] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0055] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0056] 1) Augmented Reality (AR): It is a technology that cleverly integrates virtual information with the real world. It widely uses multimedia, three-dimensional modeling, real-time registration, intelligent interaction, sensing and other technical means to simulate computer-generated text, images, three-dimensional models, music, video and other virtual information, and apply them to the real world. The two types of information complement each other, thereby achieving "enhancement" of the real world. Augmented reality technology is also called augmented reality. AR augmented reality technology is a relatively new technical content that promotes the integration of real-world information and virtual-world information content. It simulates and processes physical information that is difficult to experience in the spatial scope of the real world based on computers and other scientific technologies, and superimposes virtual information content to effectively apply it in the real world. In this process, it can be perceived by human senses, thereby achieving a sensory experience beyond reality. After the real environment and virtual objects overlap, they can exist simultaneously in the same picture and space.
[0057] 2) Camera model: It is used to describe the process of mapping coordinate points in the 3D world coordinate system to the 2D image plane. It is the link between 3D space points and 2D plane points. The camera model includes at least: pinhole camera model and fisheye camera model. Taking the pinhole camera model as an example, there are four coordinate systems in the pinhole camera model: 3D world coordinate system, 3D camera coordinate system, 2D image physical coordinate system and 2D image pixel coordinate system.
[0058] 3) Virtual scene: It is a virtual scene displayed or provided when the application is running on the terminal. The virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiment of the present application does not limit the dimension of the virtual scene. For example, the virtual scene may include the sky, land, ocean, etc. The land may include environmental elements such as deserts and cities, and users can control virtual objects to move in the virtual scene.
[0059] 4) Virtual objects: images of various people and objects that can interact in a virtual scene, or movable objects in a virtual scene. The movable objects can be virtual characters, virtual animals, cartoon characters, etc., such as characters, animals, plants, oil drums, walls, stones, etc. displayed in a virtual scene. The virtual object can be a virtual image in the virtual scene that is used to represent the user. The virtual scene can include multiple virtual objects, each of which has its own shape and volume in the virtual scene and occupies a part of the space in the virtual scene. Optionally, the virtual object can be a user character controlled by operations on the client, or an artificial intelligence (AI) set in a virtual scene battle through training, or a non-user character (NPC) set in a virtual scene interaction. Optionally, the virtual object can be a virtual character that performs adversarial interaction in a virtual scene. Optionally, the number of virtual objects participating in the interaction in the virtual scene can be pre-set or dynamically determined according to the number of clients joining the interaction.
[0060] 5) Virtual objects: refers to objects that are moving or stationary in a virtual scene. Moving virtual objects include animals, vehicles, and people in a virtual scene. Stationary virtual objects include walls, stones, and the ground in a virtual scene.
[0061] 6) Virtual light: refers to the light in the virtual scene emitted by the virtual light source used to illuminate the virtual scene. The virtual light includes direct light and indirect light. The direct light is emitted by the virtual light source and reflected from the virtual illumination point to the virtual camera. The indirect light is emitted by the virtual light source and, after at least one reflection, reaches the virtual illumination point and is finally reflected from the virtual illumination point to the virtual camera.
[0062] 7) Irradiance: Also known as radiation illumination, it is the radiation flux per unit area of the irradiated surface. The unit is watt per square meter (W / ㎡). The radiation illumination characterizes the amount of radiation energy received per unit area per unit time on the surface illuminated by the radiation energy, that is, the radiation flux density on the irradiated surface.
[0063] 8) Virtual camera: It is a "camera" set up in computer animation software or virtual engine. The role of virtual camera in expressing viewpoint during animation is equivalent to that of traditional camera. The shooting objects of virtual camera and physical camera are completely different, but the functions are extremely similar. Physical camera shoots real people or actually built scenes, while virtual camera shoots models built in 3D software, which can realize infinite possibilities. Virtual camera is presented in the form of icon in virtual engine, and also has parameters such as lens, focal length, focus, aperture, depth of field, etc. It can realize camera actions such as "push, pull, shake, move, follow, swing, rise, fall, and comprehensive movement", and can realize shooting effects that are difficult or even impossible to achieve with physical camera, such as: passing through walls, passing through keyholes, passing through objects, etc. The parameters that need to be adjusted for physical camera are distributed on the body of physical camera and need manual operation. The camera parameters of the virtual camera are buttons or numerical input bars integrated on the panel. The operator only needs to input parameters or drag the mouse. Sometimes a few key frames can determine the movement path of the virtual camera. In actual shooting, physical cameras often require stabilizers or motion control systems. Even so, the shaking of the picture still exists.
[0064] 9) Virtual engine: A virtual engine refers to some already-written editable computer virtual systems or core components of some interactive real-time graphics applications. These systems provide virtual scene designers with various tools needed to write virtual scenes. The purpose is to enable designers to write programs easily and quickly. Virtual engines include rendering engines (rendering engines include two-dimensional rendering engines and three-dimensional rendering engines), physics engines, collision detection engines, sound engines, script engines, animation engines, artificial intelligence engines, network engines, and scene management engines, etc.
[0065] 10) Camera parameters: Camera parameters include at least one of the attitude angle parameter, field of view angle parameter and position parameter. The attitude angle parameter is defined according to the Euler concept, so it is also called the Euler angle. The attitude angle includes the roll angle, pitch angle and heading angle. Different rotation orders will form different coordinate transformation matrices. Usually, the spatial rotation of the camera coordinate system relative to the object coordinate system is represented in the order of heading angle, pitch angle and roll angle. The numerical value of the field of view angle parameter is positively correlated with the field of view of the virtual camera, and the position parameter represents the three-dimensional position coordinates of the camera.
[0066] 11) Virtual light source: It is a "light source" set up in computer animation software or virtual engines. The role of virtual light source in expressing viewpoints during animation production is equivalent to physical light source in the traditional sense. The objects illuminated by virtual light source and physical light source are completely different, but their functions are extremely similar. Physical light source illuminates real people or actually built scenes, while virtual light source illuminates models built in 3D software, which can realize unlimited possibilities.
[0067] During the implementation of the embodiments of the present application, the applicant discovered that the related technology has the following problems:
[0068] In the related art, the rendering of highlight effects is usually based on the actual lighting environment in the virtual scene, and the highlight effects are rendered in the area of the virtual scene that meets the highlight reflection conditions. It is impossible to render the highlight effects in specific areas according to actual needs, so that the highlight effects cannot be flexibly used, and the picture of the virtual scene is not realistic enough, resulting in poor picture realism of the virtual scene.
[0069] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for rendering highlight effects, which can flexibly use highlight effects to enhance the picture realism of virtual scenes. The following describes an exemplary application of the highlight effect rendering system provided by the embodiments of the present application.
[0070] See also Figure 1 , Figure 1 It is a schematic diagram of the architecture of a highlight effect rendering system 100 provided in an embodiment of the present application. A terminal (terminal 400 is shown as an example) is connected to a server 200 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.
[0071] The terminal 400 is used for the user to use the client 410 and display the rendering result on the graphical interface 410-1 (graphical interface 410-1 is shown as an example). The terminal 400 and the server 200 are connected to each other via a wired or wireless network.
[0072] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart TV, a smart watch, a car terminal, etc., but is not limited thereto. The electronic device provided in the embodiment of the present application may be implemented as a terminal or as a server. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present application.
[0073] In some embodiments, the terminal 400 obtains the initial light source position and the position of the target part of the virtual object in the virtual scene, and sends the initial light source position and the position of the target part in the virtual scene to the server 200. The server 200 determines the target light source position and the target area and the light intensity on the target area based on the received initial light source position and the position of the target part in the virtual scene, renders a highlight effect on the target part in combination with the target area and the light intensity, obtains a rendering result, and sends the rendering result to the terminal 400.
[0074] In other embodiments, the server 200 obtains the initial light source position and the position of the target part of the virtual object in the virtual scene, determines the target light source position and the target area and the light intensity on the target area based on the received initial light source position and the position of the target part in the virtual scene, renders a highlight effect on the target part in combination with the target area and the light intensity, obtains a rendering result, and sends the rendering result to the terminal 400.
[0075] In other embodiments, the embodiments of the present application can be implemented with the aid of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.
[0076] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources.
[0077] See also Figure 2 , Figure 2is a schematic diagram of the structure of an electronic device 500 for rendering highlight effects provided in an embodiment of the present application, wherein: Figure 2 The electronic device 500 shown may be Figure 1 The server 200 or the terminal 400 in Figure 2 The electronic device 500 shown includes: at least one processor 410, a memory 450, and at least one network interface 420. The various components in the electronic device 500 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 2 Various buses are labeled as bus system 440 .
[0078] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0079] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0080] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0081] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0082] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0083] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).
[0084] In some embodiments, the highlight effect rendering device provided in the embodiments of the present application can be implemented in a software manner. Figure 2 A rendering device 455 for highlight effects stored in the memory 450 is shown, which may be software in the form of a program or a plug-in, and includes the following software modules: an acquisition module 4551, a position determination module 4552, an area determination module 4553, and a rendering module 4554. These modules are logical, and thus may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0085] In other embodiments, the rendering device for highlight effects provided in the embodiments of the present application can be implemented in hardware. As an example, the rendering device for highlight effects provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the rendering method for highlight effects provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.
[0086] In some embodiments, the terminal or server can implement the rendering method of the highlight effect provided in the embodiment of the present application by running a computer program or a computer executable instruction. For example, the computer program can be a native program (e.g., a rendering program) or a software module in the operating system, for example, a rendering module that can be embedded in any program (such as an instant messaging client, an album program, an electronic map client, a navigation client); for example, it can be a native (Native) application (APP, Application), that is, a program that needs to be installed in the operating system to run. In short, the above-mentioned computer program can be any form of application, module or plug-in.
[0087] The method for rendering the highlight effect provided in the embodiment of the present application will be described in combination with the exemplary application and implementation of the server or terminal provided in the embodiment of the present application.
[0088] See also Figure 3 , Figure 3 is a flowchart of a method for rendering a highlight effect provided in an embodiment of the present application, which will be combined with Figure 3 Steps 101 to 104 are shown for illustration. The method for rendering highlight effects provided in the embodiment of the present application can be implemented by a server or a terminal alone, or by a server and a terminal in collaboration. The following will be described using the server alone as an example.
[0089] In step 101, an initial light source position of a virtual light source in a virtual scene and a position of a target part of a virtual object in the virtual scene are obtained.
[0090] In some embodiments, a virtual light source is a "light source" set up in computer animation software or a virtual engine. The role of a virtual light source in expressing viewpoints during animation production is equivalent to a physical light source in the traditional sense. The objects of illumination of the virtual light source and the physical light source are completely different, but their functions are extremely similar. The physical light source illuminates real people or actually built scenes, while the virtual light source illuminates models built in three-dimensional software, which can achieve unlimited possibilities.
[0091] In some embodiments, a virtual scene is a virtual scene displayed or provided when an application is running on a terminal. The virtual scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiment of the present application does not limit the dimension of the virtual scene. For example, a virtual scene may include the sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities, and users can control virtual objects to move in the virtual scene.
[0092] In some embodiments, the virtual object is the image of various people and objects that can interact in the virtual scene, or an active object in the virtual scene. The active object can be a virtual character, a virtual animal, an animated character, etc., such as: a person, an animal, a plant, an oil drum, a wall, a stone, etc. displayed in the virtual scene. The virtual object can be a virtual image in the virtual scene that is used to represent the user. The virtual scene can include multiple virtual objects, each of which has its own shape and volume in the virtual scene and occupies a part of the space in the virtual scene. Optionally, the virtual object can be a user character controlled by an operation on the client, or an artificial intelligence (AI) set in a virtual scene battle through training, or a non-user character (NPC) set in a virtual scene interaction. Optionally, the virtual object can be a virtual character that performs confrontational interaction in the virtual scene. Optionally, the number of virtual objects participating in the interaction in the virtual scene can be pre-set, or it can be dynamically determined according to the number of clients joining the interaction.
[0093] In some embodiments, the virtual object includes multiple parts, and different parts of the virtual object indicate different part functions, such as viewing function, audio-visual function, etc.
[0094] As an example, when the virtual object is a virtual plant displayed in a virtual scene, the target part of the virtual object may be a leaf, a stem diameter, etc. of the virtual plant.
[0095] As an example, when the virtual object is a virtual character, the target part of the virtual object may be an arm, an eye, a nose, etc. of the virtual character.
[0096] In some embodiments, the virtual light source is a virtual light source for illuminating a target part of a virtual object. When the virtual light source is a virtual light source including one virtual scene point, the initial light source position of the virtual light source in the virtual scene is used to indicate the initial three-dimensional coordinates of the virtual light source in the virtual scene. When the virtual light source is a virtual light source including multiple virtual scene points, the initial light source position of the virtual light source in the virtual scene is used to indicate the initial three-dimensional coordinate range of the virtual light source in the virtual scene.
[0097] In some embodiments, when the target part is a part including one virtual scene point, the position of the target part of the virtual object in the virtual scene is used to indicate the three-dimensional coordinates of the target part. When the target part is a part including multiple virtual scene points, the position of the target part of the virtual object in the virtual scene is used to indicate the three-dimensional coordinate range of the area where the target part is located.
[0098] As an example, when the target part is the eye of the virtual object, the position of the eye of the virtual object in the virtual scene is used to indicate the three-dimensional coordinate range of the area where the eye of the virtual object is located.
[0099] In this way, by obtaining the initial light source position of the virtual light source used to illuminate the target part of the virtual object in the virtual scene, as well as the position of the target part in the virtual scene, it is convenient to subsequently accurately determine the target light source position that can form highlight reflection, so as to form highlight reflection at the target part, thereby being able to flexibly use the highlight effect at the target part, effectively enhancing the picture realism of the virtual scene.
[0100] In step 102, the target light source position capable of forming high light reflection is obtained in the virtual scene in combination with the position of the target part in the virtual scene and the initial light source position.
[0101] In some embodiments, the target light source position refers to a virtual scene position in the virtual scene that can form a highlight reflection at the target part. When the target light source position is not the initial light source position, the virtual light source can be moved from the initial light source position to the target light source position to form a highlight reflection at the target part.
[0102] In some embodiments, highlight reflection is an optical phenomenon. When the reflected light of the virtual light emitted by the virtual light source at the target position can directly illuminate the virtual camera, a highlight reflection phenomenon is formed at the target position, that is, the target position photographed by the virtual camera appears highlighted (or bright).
[0103] As an example, see Figure 6 , Figure 6 is a schematic diagram of the effect of the rendering method of the highlight effect provided in the embodiment of the present application, such as Figure 6 In the eyeball 61 of the virtual object shown, a highlight reflection phenomenon is formed in the eyeball area 611. The brightness of the eyeball area 611 is significantly higher than other areas in the eyeball 61, that is, the eyeball area 611 captured by the virtual camera appears bright (or highlight).
[0104] In some embodiments, see Figure 4 , Figure 4 is a flowchart of a method for rendering a highlight effect provided in an embodiment of the present application, Figure 3 The illustrated step 102 may be performed by Figure 4 Steps 1021 to 1023 are implemented as shown.
[0105] In step 1021, initial illumination information of the target part is determined based on the position of the target part in the virtual scene and the initial light source position.
[0106] In some embodiments, the initial illumination information of the target part is used to indicate whether the initial virtual light emitted by the virtual light source at the initial light source position can form a highlight reflection on the target part.
[0107] In some embodiments, the above step 1021 can be implemented as follows: obtaining an initial virtual light emitted by a virtual light source at an initial light source position, and when the initial virtual light cannot illuminate the position of the target part in the virtual scene, determining the initial illumination information as the first illumination information. When the initial virtual light can illuminate the position of the target part in the virtual scene, obtaining an initial reflected light corresponding to the initial virtual light, and determining the initial illumination information of the target part based on the initial reflected light.
[0108] In some embodiments, the initial reflected light is a virtual light formed by the initial virtual light reflecting on the target part. The first illumination information is used to indicate that the initial virtual light cannot form a highlight reflection on the target part. The initial reflected light corresponds to the initial virtual light one by one, and one initial virtual light corresponds to one initial reflected light. The number of initial virtual lights emitted by the virtual light source at the initial light source position is at least one.
[0109] In some embodiments, the virtual camera can capture the target part on the premise that the initial virtual light can illuminate the position of the target part in the virtual scene. If the initial virtual light cannot illuminate the position of the target part in the virtual scene, the virtual camera cannot capture the target part (the target part is not illuminated by virtual light, and no reflected light is formed, and no reflected light is collected by the virtual camera, resulting in the virtual camera being unable to capture the target part), and naturally no highlight reflection will be formed at the target part.
[0110] In some embodiments, if the initial virtual light can illuminate the position of the target part in the virtual scene, the virtual camera can photograph the target part (the target part is illuminated by the virtual light, and reflected light is formed at the target part, and the reflected light or the refracted light after the reflected light is refracted is collected by the virtual camera, so that the virtual camera can photograph the target part), when the reflected light itself is directly collected by the virtual camera, a highlight reflection is formed at the target part.
[0111] As an example, see Figure 7 , Figure 7It is a schematic diagram of the principle of the rendering method of the highlight effect provided in an embodiment of the present application. When the target part is the eyeball of a virtual object, the initial virtual light illuminates the position of the upper eyelid of the virtual object in the virtual scene. The initial virtual light cannot illuminate the position of the eyeball of the virtual object in the virtual scene. When the initial virtual light cannot illuminate the position of the target part in the virtual scene, the initial lighting information is determined as the first lighting information, and the first lighting information is used to indicate that the initial virtual light cannot form a highlight reflection on the target part.
[0112] In some embodiments, the above-mentioned acquisition of the initial reflected light corresponding to the initial virtual light can be achieved in the following way: obtain the normal vector corresponding to the irradiation point of the initial virtual light, the normal vector is perpendicular to the tangent plane of the irradiation point, and combine the shooting ray and the normal vector corresponding to the irradiation point to determine the reflected ray corresponding to the irradiation point, wherein the angle between the reflected ray and the normal vector is equal to the angle between the shooting ray and the normal vector.
[0113] As an example, see Figure 8 , Figure 8 It is a principle schematic diagram of the initial reflected light provided in an embodiment of the present application. The normal vector 83 corresponding to the illumination point 85 of the initial virtual light 82 is obtained. The normal vector 83 is perpendicular to the tangent plane 81 of the illumination point 85. The shooting ray 82 and the normal vector 83 corresponding to the illumination point 85 are combined to determine the reflected ray 84 corresponding to the illumination point 85, wherein the angle q between the reflected ray 84 and the normal vector 83 is equal to the angle p between the shooting ray 82 and the normal vector 83.
[0114] In some embodiments, the position of the target site in the virtual scene includes at least one position point.
[0115] As an example, see Figure 7 , when the target part is the eyeball of the virtual object, the position of the eyeball of the virtual object in the virtual scene includes multiple position points.
[0116] In some embodiments, the above-mentioned determination of the initial illumination information of the target part based on the initial reflected light can be achieved in the following manner: obtaining the shooting rays corresponding to each position point, the shooting rays are rays constructed with the position point as the end point and the target virtual camera as the starting point; when the initial reflected light does not coincide with any of the shooting rays, the initial illumination information is determined as the first illumination information; when the initial reflected light coincides with at least one shooting ray, the initial illumination information is determined as the second illumination information.
[0117] As an example, see Fig. 9 , Fig. 9It is a schematic diagram of the principle of initial illumination information provided in an embodiment of the present application, obtaining a shooting ray 91 corresponding to position point 97, a shooting ray 93 corresponding to position point 98, and a shooting ray 95 corresponding to position point 99, wherein shooting ray 91 is a ray constructed with position point 97 as the end point and target virtual camera 90 as the starting point, shooting ray 93 is a ray constructed with position point 98 as the end point and target virtual camera 90 as the starting point, shooting ray 95 is a ray constructed with position point 99 as the end point and target virtual camera 90 as the starting point, and when the initial reflected light 96 coincides with the shooting ray 95, the initial illumination information is determined as the second illumination information.
[0118] As an example, see Fig.10 , Fig.10 It is a schematic diagram of the principle of initial illumination information provided in an embodiment of the present application, obtaining a shooting ray 91 corresponding to position point 97, a shooting ray 93 corresponding to position point 98, and a shooting ray 95 corresponding to position point 99, wherein shooting ray 91 is a ray constructed with position point 97 as the end point and target virtual camera 90 as the starting point, shooting ray 93 is a ray constructed with position point 98 as the end point and target virtual camera 90 as the starting point, shooting ray 95 is a ray constructed with position point 99 as the end point and target virtual camera 90 as the starting point, and when the initial reflected light 96 does not overlap with any of the shooting rays (shooting ray 91, shooting ray 93, shooting ray 95), the initial illumination information is determined as the second illumination information.
[0119] In some embodiments, the second illumination information is used to indicate that the initial virtual light can form a high light reflection on the target part. The target virtual camera is a virtual camera used to shoot the target part in the virtual scene.
[0120] In this way, by comparing the shooting rays corresponding to each position point with the initial reflected light, it is determined whether the initial reflected light coincides with the shooting ray, so as to determine the accurate initial lighting information. When the shooting ray coincides with the initial reflected light, the virtual camera can receive the full amount of the initial reflected light, thereby being able to form a highlight reflection at the corresponding position point on the target part, effectively improving the accuracy of the determined initial lighting information.
[0121] In step 1022, when the initial illumination information indicates that the initial virtual light can form a highlight reflection on the target portion, the initial light source position is determined as the target light source position.
[0122] In some embodiments, the initial virtual light ray is emitted by a virtual light source.
[0123] In some embodiments, when the initial illumination information indicates that the initial virtual light can form a highlight reflection on the target portion, the initial light source position is the light source position that can form a highlight reflection, and the initial light source position can be directly determined as the target light source position.
[0124] In step 1023, when the initial illumination information indicates that the initial virtual light cannot form a highlight reflection on the target part, a target light source position that can form a highlight reflection is determined in the virtual scene, and the virtual light source is moved from the initial light source position to the target light source position.
[0125] In some embodiments, when the initial lighting information indicates that the initial virtual light cannot form a highlight reflection on the target part, it is necessary to re-search for the target light source position that can form a highlight reflection from positions other than the initial light source position in the virtual scene, and move the virtual light source from the initial light source position to the target light source position.
[0126] In some embodiments, the position of the target site in the virtual scene includes at least one position point.
[0127] In some embodiments, the above-mentioned determination of the target light source position that can form a highlight reflection in the virtual scene can be achieved by: obtaining the shooting rays corresponding to each position point, the shooting rays are rays constructed with the position point as the end point and the target virtual camera as the starting point; combining the shooting rays and the position point, determining the reflection rays corresponding to each position point, the position point is the starting point of the corresponding reflection ray. Based on each reflection ray, determine the target light source position.
[0128] As an example, see Fig.11 , Fig.11 1 is a schematic diagram of the principle of the target light source position provided by an embodiment of the present application. The shooting ray 14 corresponding to the position point 15, the shooting ray 13 corresponding to the position point 16, and the shooting ray 12 corresponding to the position point 17 are obtained. The shooting ray 14 is a ray constructed with the position point 15 as the end point and the target virtual camera 11 as the starting point. The shooting ray 13 is a ray constructed with the position point 16 as the end point and the target virtual camera 11 as the starting point. The shooting ray 12 is a ray constructed with the position point 17 as the end point and the target virtual camera 11 as the starting point. Combine the shooting ray 14 and the position point 15 to determine the reflection ray 18 corresponding to the position point 15. Combine the shooting ray 13 and the position point 16 to determine the reflection ray 19 corresponding to the position point 16. Combine the shooting ray 12 and the position point 17 to determine the reflection ray 20 corresponding to the position point 17. Based on the reflection rays 18, 19, and 20, the target light source position is determined.
[0129] In some embodiments, the target virtual camera is a virtual camera used to photograph a target part in a virtual scene.
[0130] In some embodiments, the above-mentioned determination of the target light source position based on each reflected ray can be achieved in the following manner: when the number of reflected rays is one, a candidate light source position is selected from the reflected rays, the candidate light source position is any position on the reflected rays except the position point, and the candidate light source position is determined as the target light source position; when the number of reflected rays is at least two, a target intersection is selected from at least one intersection formed by at least two reflected rays, and the position of the target intersection in the virtual scene is determined as the target light source position.
[0131] In some embodiments, a target intersection is selected from at least one intersection formed by at least two reflected rays, and the position of the target intersection in the virtual scene is determined as the target light source position. This can be achieved in the following way: a target intersection is selected from at least one intersection formed by at least two reflected rays, and when the target intersection is a visible point in the virtual scene, the position of the target intersection in the virtual scene is determined as the target light source position.
[0132] In some embodiments, when the target intersection is a non-visible point in the virtual scene, the symmetrical position of the target intersection in the virtual scene is determined as the target light source position, wherein the position of the target intersection in the virtual scene and the corresponding symmetrical position are symmetrical about the tangent plane of the position point.
[0133] In some embodiments, a visible point refers to a virtual scene point that can be captured by a target virtual camera, and a non-visible point refers to a virtual scene point that cannot be captured by the target virtual camera.
[0134] As an example, see Fig.12 , Fig.12 It is a principle schematic diagram of the target light source position provided in an embodiment of the present application. The target intersection 21 is selected from the intersections 21 and 22 formed by the reflected rays 18, 19 and 20. When the target intersection 21 is a visible point in the virtual scene, the position of the target intersection 21 in the virtual scene is determined as the target light source position.
[0135] As an example, see Fig.12 , select the target intersection point 21 from the intersection points 21 and 22 formed by the reflected rays 18, 19 and 20. When the target intersection point 21 is a non-visible point in the virtual scene, the symmetrical position 23 of the position of the target intersection point 21 in the virtual scene is determined as the target light source position.
[0136] In some embodiments, the number of reflected rays intersecting at the target intersection point is the maximum value among the numbers corresponding to the intersection points.
[0137] In some embodiments, the above-mentioned selection of the target intersection from at least one intersection formed by at least two reflected rays can be achieved in the following way: obtaining the number of rays corresponding to each intersection, and determining the intersection with the largest number of rays as the target intersection, wherein the number of rays is used to indicate the number of reflected rays intersecting at the intersection.
[0138] As an example, see Fig.12 , obtain the number of rays corresponding to intersection 21 (2), and the number of rays corresponding to intersection 22 (2), and select the intersection with the largest number of rays (the number of rays of intersection 21 and intersection 22 are both 2). Then, any intersection between intersection 21 and intersection 22 can be rendered and determined as the target intersection. For example, intersection 21 can be determined as the target intersection.
[0139] In some embodiments, the above-mentioned combination of shooting rays and position points to determine the reflected rays corresponding to each position point can be achieved by performing the following processing on each position point: obtaining the normal vector corresponding to the position point, where the normal vector is perpendicular to the tangent plane of the position point; combining the shooting rays and the normal vector corresponding to the position point to determine the reflected rays corresponding to the position point.
[0140] In some embodiments, the angle between the reflected ray and the normal vector is equal to the angle between the captured ray and the normal vector.
[0141] As an example, see Fig.12 , obtain the normal vector 24 corresponding to position point 15, obtain the normal vector 25 corresponding to position point 16, the normal vector 25 is perpendicular to the tangent plane of position point 16, obtain the normal vector 26 corresponding to position point 17, and combine the normal vectors 24, 25, and 26 corresponding to position points 15, 16, and 17 to determine the reflected rays 18, 19, and 20 corresponding to position points 15, 16, and 17, respectively.
[0142] In this way, by obtaining the shooting rays corresponding to each position point, combining the shooting rays and the position points, determining the reflected rays corresponding to each position point, and determining the target light source position on each reflected ray, the virtual light emitted by the virtual light source from the target light source position can be reflected on the reflected rays until the target virtual camera, thereby minimizing the loss of light intensity received by the target virtual camera and forming a highlight reflection, so that the highlight effect can be flexibly used at the target location, effectively enhancing the picture realism of the virtual scene.
[0143] In step 103, the target area in the target area and the illumination intensity on the target area are determined in combination with the position of the target area in the virtual scene and the position of the target light source.
[0144] In some embodiments, the target area is an area in the target site where high light reflection is formed.
[0145] In some embodiments, the position of the target site in the virtual scene includes at least one position point.
[0146] In some embodiments, the area of the target region may be less than or equal to the area of the target part, that is, the target region may be a sub-region of the target part. For example, when the target part is an eyeball, the target region may be one or more virtual viewpoints in the eyeball.
[0147] As an example, see Figure 7 , combined with the position of the target part in the virtual scene (the position between eye point 71 and eye point 72) and the position of the target light source, determine the target area in the target part (for example, the position between eye point 73 and eye point 74) and the light intensity on the target area.
[0148] In some embodiments, see Figure 5 , Figure 5 is a flowchart of a method for rendering a highlight effect provided in an embodiment of the present application, Figure 3 The illustrated step 103 may be performed by Figure 4 Steps 1031 to 1034 are implemented as shown.
[0149] In step 1031, at least one target position point corresponding to the target light source position is selected from the at least one position point.
[0150] In some embodiments, the target virtual light emitted by the virtual light source at the target light source position can form a highlight reflection at the target position point.
[0151] In some embodiments, the above step 1031 can be implemented as follows: from at least one position point, select a position point where the target virtual light emitted at the target light source position can form a highlight reflection, and determine the selected position point as the target position point.
[0152] As an example, see Fig.13 , Fig.13 is a schematic diagram of the principle of the target position point provided in the embodiment of the present application. The position of the target part in the virtual scene includes Fig.13The three position points shown, position point 131, position point 132 and position point 133, are used to determine the target position point 131 corresponding to the target light source position 134, wherein the target virtual light ray 145 emitted by the virtual light source at the target light source position 134 can form a highlight reflection on the target position point 131, and the target virtual light ray 145 emitted by the virtual light source at the target light source position 134 cannot form a highlight reflection on the position point 132, and the target virtual light ray 145 emitted by the virtual light source at the target light source position 134 cannot form a highlight reflection on the target position point 133.
[0153] In step 1032, the area formed by each target position point is determined as the target area.
[0154] In some embodiments, the above step 1032 can be implemented as follows: when the number of target location points is one, the area of the target location point in the virtual scene is determined as the target area; when the number of target location points is multiple, the union area of the areas of each target location point in the virtual scene is determined as the target area.
[0155] As an example, see Figure 7 , the area formed by the target position points between the target position point 73 and the target position point 74 is determined as the target area in the target part.
[0156] In step 1033, the position illumination intensity corresponding to each target position point is determined.
[0157] In some embodiments, the target position point corresponds to the position light intensity, which is used to indicate the irradiance corresponding to the target position point received by the target virtual camera.
[0158] In some embodiments, irradiance, also known as radiation illumination, is the radiation flux per unit area of the illuminated surface, and the unit is watt per square meter (W / ㎡). The radiation illumination characterizes the amount of radiation energy received per unit area per unit time on the surface illuminated by the radiation energy, that is, the radiation flux density on the illuminated surface.
[0159] In some embodiments, the above step 1033 can be implemented by performing the following processing for each target position point: obtaining the light source irradiance of the virtual light source, and determining the first distance between the virtual light source and the target position point, and the second distance between the target position point and the target virtual camera, where the target virtual camera is a virtual camera used to shoot the target part in the virtual scene; adding the first distance and the second distance to obtain the total distance, and determining the loss value of the light source irradiance based on the total distance and the target position point; subtracting the light source irradiance from the loss value to obtain the position light intensity corresponding to the target position point.
[0160] In some embodiments, the numerical value of the light source irradiance of the virtual light source is positively correlated with the power of the virtual light source. The light source irradiance of the virtual light source is used to indicate the irradiance corresponding to the virtual light emitted by the virtual light source. The virtual light emitted by the virtual light source has energy loss during the propagation process, so that the irradiance received by the target virtual camera is less than the light source irradiance.
[0161] In some embodiments, the propagation path of the virtual light emitted by the virtual light source is: from the virtual light source to the target position point, and from the target position point to the target virtual camera. Therefore, the energy loss of the virtual light emitted by the virtual light source during the propagation process comes from the propagation path, and the source of energy absorption in the propagation path depends on the medium between the virtual light source and the target position point, the target position point and the target virtual camera, and the material of the target position point.
[0162] In some embodiments, the above-mentioned determination of the loss value of the light source irradiance based on the total distance and the target position point can be achieved in the following manner: based on the total distance, determine the first loss value of the light source irradiance; based on the target position point, determine the second loss value of the light source irradiance; sum the first loss value and the second loss value to obtain the loss value of the light source irradiance.
[0163] In some embodiments, the first loss value is proportional to the numerical value of the total distance. The first loss value is used to indicate the energy absorption value of the propagation medium on the target propagation path to the irradiance of the light source. The target propagation path is the propagation path from the virtual light source through the target position point to the target virtual camera.
[0164] In some embodiments, the second loss value is used to indicate the energy absorption value of the target location point to the irradiance of the light source.
[0165] As an example, see Fig.14 , Fig.14 : is a schematic diagram of the propagation path provided by the embodiment of the present application. The propagation path of the virtual light emitted by the virtual light source is: from the virtual light source 142 to the target position point 143, and from the target position point 143 to the target virtual camera 141. The light source irradiance of the virtual light source 142 is obtained, and the first distance between the virtual light source 142 and the target position point 143 and the second distance between the target position point 143 and the target virtual camera 141 are determined. The target virtual camera 142 is a virtual camera used to shoot the target part in the virtual scene; the first distance and the second distance are added to obtain the total distance, and based on the total distance and the target position point 143, the loss value of the light source irradiance is determined; the light source irradiance is subtracted from the loss value to obtain the position light intensity corresponding to the target position point.
[0166] In this way, by determining the loss value of the light source irradiance on the propagation path corresponding to each target position point, the position light intensity corresponding to the target position point can be determined, which is convenient for subsequently determining the light intensity on the target area based on the position light intensity, so as to render the highlight effect at the target part and obtain the rendering result, so that the highlight effect can be flexibly used at the target part, effectively enhancing the picture realism of the virtual scene.
[0167] In step 1034 , the illumination intensity on the target area is determined based on the illumination intensity at each position.
[0168] In some embodiments, the above-mentioned step 1034 can be implemented in the following manner: receiving a setting instruction for the position lighting intensity sent by the terminal, adjusting the position lighting intensity in response to the setting instruction to obtain an adjusted position lighting intensity, wherein the setting instruction carries an adjustment range of the position lighting intensity; and determining each adjusted position lighting intensity as the lighting intensity of the corresponding target position point on the target area.
[0169] In some embodiments, the above-mentioned setting instructions for the position lighting intensity can be generated in the following manner: in response to the user's triggering operation on the target control displayed in the human-computer interaction interface on the terminal, a setting instruction for the position lighting intensity is generated, and the setting instruction carries the adjustment range of the position lighting intensity.
[0170] In some other embodiments, the above step 1034 may be implemented in the following manner: the illumination intensity at each position is determined as the illumination intensity of the corresponding target position point on the target area.
[0171] In step 104, based on the target area and the light intensity, a highlight effect is rendered at the target part to obtain a rendering result.
[0172] In some embodiments, the rendering result is used to form a specular reflection at the target location.
[0173] In some embodiments, a rendering result is obtained by rendering a highlight effect on a target part, thereby forming a highlight reflection on a target area of the target part, so that the highlight effect can be flexibly used on the target part, effectively enhancing the picture realism of the virtual scene.
[0174] In this way, by combining the position of the target part in the virtual scene and the initial light source position, the target light source position that can form highlight reflection is obtained in the virtual scene, and by combining the position of the target part in the virtual scene and the target light source position, the target area in the target part that can form highlight reflection and the light intensity on the target area are determined, and based on the target area and the light intensity, the highlight effect is rendered at the target part to obtain the rendering result. In this way, by determining the target light source position, a highlight reflection is formed in the target area on the target part of the virtual object, and a highlight effect is rendered at the target part to obtain the rendering result, so that the highlight effect can be flexibly used at the target part, effectively enhancing the picture realism of the virtual scene.
[0175] Next, an exemplary application of the embodiment of the present application in an actual application scenario of eyeball rendering of a virtual object will be described.
[0176] A virtual object is an image of various people and objects that can interact in a virtual scene, or an active object in a virtual scene. The active object can be a virtual person, a virtual animal, a cartoon character, etc., such as a person, an animal, a plant, an oil drum, a wall, a stone, etc. displayed in a virtual scene. The virtual object can be a virtual image in the virtual scene that is used to represent a user. A virtual scene can include multiple virtual objects, each of which has its own shape and volume in the virtual scene and occupies a part of the space in the virtual scene. When the virtual object is a virtual person, a virtual animal or a cartoon character, the virtual object has a corresponding eyeball. The eyeball is a part of the virtual object that has a higher light requirement (the degree of light authenticity directly affects whether the rendered eyeball can be more vivid). Therefore, the rendering of the eyeball highlight effect of the virtual object is particularly important.
[0177] See also Fig.15 , Fig.15 is a schematic diagram of the effect of the method for rendering a highlight effect provided in an embodiment of the present application, Fig.15 The rendering result 11 shown is obtained by rendering the highlight effect in the eyeball of the virtual object 1 , and the rendering result 21 shown is obtained by rendering the highlight effect in the eyeball of the virtual object 2 .
[0178] In some embodiments, see Fig.16 , Fig.16 is a flow chart of a method for rendering a highlight effect provided in an embodiment of the present application. The method for rendering a highlight effect provided in an embodiment of the present application can be performed by Fig.16 Steps 201 to 213 are shown to be implemented.
[0179] In step 201, an eyeball illumination model is added.
[0180] In step 202, an eye illumination model macro is defined.
[0181] In step 203, the software part is prepared.
[0182] In some embodiments, an eyeball lighting model is first customized and the C++ rendering pipeline code is modified, and attention needs to be paid to macro naming rules and the limit on the number of lighting models.
[0183] In step 204, data is prepared.
[0184] In step 205, the data interface is activated.
[0185] In step 206, lighting calculation begins.
[0186] In some embodiments, illumination calculation may be performed using a semi-Lambert illumination model to avoid dead black in dark areas.
[0187] In some embodiments, the expression of diffuse reflection calculation result can be:
[0188] Diffuse=Basecolor×(NL×0.5+0.5) (1)
[0189] Among them, Diffuse is used to indicate the diffuse reflection calculation result, Basecolor is used to indicate the basic color information of the material, and NL is used to indicate the dot product result of the normal and the illumination vector.
[0190] In some embodiments, the highlight calculation can be performed based on a standard illumination model. The expression of the highlight result can be:
[0191] Specular=NL×D×G×F (2)
[0192] Among them, Specular is used to indicate the highlight result, D is used to indicate the normal distribution result, G is used to indicate the shadow occlusion result, and F is used to indicate the Finnel result.
[0193] In some embodiments, the expression of the normal distribution may be:
[0194] D=D_DGX(R×R,NH,H,N) (3)
[0195] Among them, D is used to indicate the discovery distribution, D_DGX is used to indicate the normal distribution function, R is used to indicate the roughness, NH is used to indicate the dot product result of the normal vector and the half-angle vector, H is used to indicate the half-angle vector, and N is used to indicate the normal vector.
[0196] In some embodiments, the expression of the shadow shading result may be:
[0197] G=V_Schlick(R, NV, NL) (4)
[0198] Among them, G is used to indicate the shadow shading result, V_Schlick is used to indicate the shadow shading function, R is used to indicate the roughness, NV is used to indicate the dot product result of the normal vector and the sight vector, and NL is used to indicate the dot product result of the normal and the illumination vector.
[0199] In some embodiments, the expression of the Fresnel result may be:
[0200] F=F_Schlick(Specular,VH) (5)
[0201] Among them, F is used to indicate the Finnel result, F_Schlick is used to indicate the Finnel function, Specular is used to indicate the highlight result, and VH is used to indicate the dot product result of the sight vector and the half-angle vector.
[0202] In some embodiments, for correct lighting calculations, add highlight direction control, see Fig.17 , Fig.17 This is a schematic diagram of the principle of the highlight effect rendering method provided by the embodiment of the present application. In a normal gaming environment, the main light angle is too high, which will cause the light source to be blocked in most time periods. To address this problem, the main light is locked at some angles and appropriately offset, that is, the direction after the offset (corrected light and optimal light) is set to ensure that good eye highlights are always produced under complex lighting conditions.
[0203] In step 207, variables are declared.
[0204] In step 208, direct light is calculated.
[0205] In some embodiments, the control of direct light and indirect light may be calculated and controlled separately.
[0206] In step 209, indirect light is calculated.
[0207] In some embodiments, the control of direct light and indirect light may be calculated and controlled separately.
[0208] In step 210, the material is modified and the custom data is passed in.
[0209] In some embodiments, see Fig.18 , Fig.18 It is a schematic diagram of the principle of the rendering method of the highlight effect provided in the embodiment of the present application. By rendering, interface 1 or interface 0 is called, the corresponding data interface 0 / 1 is activated, the material part, the material input is calculated and passed in, and the custom ones mentioned above are calculated and passed in respectively.
[0210] In step 211 , the eye parallax depth is calculated.
[0211] In some embodiments, the depth offset value of the pupil uv sampling is controlled by using the height map, and the depth is the front-back depth offset of the camera Y direction vector, so that the pupil effect of the eyeball with depth offset effect is obtained. For the eyeball detail parallax depth effect, simply put, the direction of uv.r / uv.g (texture coordinates) is offset along the line of sight, and the intensity of the offset is controlled.
[0212] As an example, see Fig.19 , Fig.19 It is a schematic diagram of the effect of the rendering method of the highlight effect provided in an embodiment of the present application. Eyeball 811 is the eyeball effect before calculating the eyeball parallax depth, and eyeball 812 is the eyeball effect before calculating the eyeball parallax depth. The parallax depth of eyeball 812 is significantly higher than that of eyeball 811.
[0213] In step 212, eye caustics are calculated.
[0214] In some embodiments, the expression of eye caustics may be:
[0215] Caustics=lerp(0, Basecolor+Causticscolor×mask, NL) (6)
[0216] Among them, Caustics is used to indicate the caustics result, Basecolor is used to indicate the base color, cuasticscolor is used to indicate the caustics color, Mask is used to indicate the caustics range and is used to control the white of the eye and the pupil part, and NL is used to indicate the dot product result of the light source vector and the normal vector.
[0217] In step 213, further material function integration and detail optimization are performed according to requirements.
[0218] In this way, the rendering method of highlight effects provided by the embodiment of the present application reduces the amount of calculation to 1 / 3 of the original compared to the related technology, and the overall performance is greatly improved. The overall picture effect is basically the same as the original effect. The number of samples is greatly reduced, reducing the bandwidth. It has flexible highlight detail adjustment effects, and art students are more flexible and controllable. The lighting calculation has been corrected, and the eye highlight effect is more stable and vivid. Comparison of highlight effects: Under the same large world lighting environment, the left is the default eye effect, and the right is the effect of this solution. It can be seen that the highlight detail effect has been enhanced a lot.
[0219] Under the current UE4 default rendering pipeline, the eyeball lighting model used has a very large amount of calculation, a large number of sampled pictures, and a large amount of bandwidth. At the same time, a large number of post-processing technologies are used to calculate blur. Generally, it is used for film and television rendering and large stand-alone games. Similarly, because the official eyeball rendering technology has a large amount of calculation and a high degree of rendering complexity, these have a relatively large performance consumption on the mobile terminal, and also rely on a large number of post-processing technologies. The performance of blur sampling calculation is worrying, so the official does not support mobile devices. Our project is dual-end, so we have to consider the mobile terminal solution. After a large number of shader optimizations, the number of instructions is reduced and the performance is improved. It does not rely on complex post-processing technology. Reasonably distinguish between direct light and indirect light intensity, and art students can more accurately control the performance of detail effects. The sampling data is greatly reduced, and less bandwidth is occupied. Optimize the direction of light, and the eyeball effect is stable. The detail effect is displayed. No additional pass (rendering process) is required to increase the eyeball caustic effect, making the eyeball more vivid.
[0220] It is understandable that in the embodiments of the present application, related data such as virtual scenes are involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0221] The following further describes an exemplary structure of a highlight effect rendering device 455 provided in an embodiment of the present application implemented as a software module. In some embodiments, for example, Figure 2 As shown, the software modules in the rendering device 455 for highlight effects stored in the memory 450 may include: an acquisition module 4551, used to acquire the initial light source position of the virtual light source in the virtual scene, and the position of the target part of the virtual object in the virtual scene; a position determination module 4552, used to obtain the target light source position that can form highlight reflection in the virtual scene in combination with the position of the target part in the virtual scene and the initial light source position; an area determination module 4553, used to determine the target area in the target part and the light intensity on the target area in combination with the position of the target part in the virtual scene and the target light source position; wherein the target area is the area in the target part where highlight reflection is formed; a rendering module 4554, used to render the highlight effect at the target part based on the target area and the light intensity to obtain a rendering result, and the rendering result is used to form highlight reflection at the target part.
[0222] In some embodiments, the above-mentioned position determination module 4552 is also used to determine the initial lighting information of the target part in combination with the position of the target part in the virtual scene and the initial light source position; when the initial lighting information indicates that the initial virtual light can form a highlight reflection on the target part, the initial light source position is determined as the target light source position, wherein the initial virtual light is emitted by the virtual light source; when the initial lighting information indicates that the initial virtual light cannot form a highlight reflection on the target part, the target light source position that can form the highlight reflection is determined in the virtual scene, and the virtual light source is moved from the initial light source position to the target light source position.
[0223] In some embodiments, the above-mentioned position determination module 4552 is also used to obtain the initial virtual light emitted by the virtual light source at the initial light source position; when the initial virtual light cannot illuminate the position of the target part in the virtual scene, the initial lighting information is determined as the first lighting information, wherein the first lighting information is used to indicate that the initial virtual light cannot form a highlight reflection on the target part; when the initial virtual light can illuminate the position of the target part in the virtual scene, the initial reflected light corresponding to the initial virtual light is obtained, and based on the initial reflected light, the initial lighting information of the target part is determined; wherein the initial reflected light is a virtual light formed by the reflection of the initial virtual light on the target part.
[0224] In some embodiments, the above-mentioned position determination module 4552 is also used to obtain the shooting rays corresponding to each position point, where the shooting rays are constructed with the position point as the end point and the target virtual camera as the starting point, and the target virtual camera is a virtual camera used to shoot the target part in the virtual scene; when the initial reflected light does not coincide with each shooting ray, the initial lighting information is determined as the first lighting information; when the initial reflected light coincides with at least one shooting ray, the initial lighting information is determined as the second lighting information, wherein the second lighting information is used to indicate that the initial virtual light can form a high-light reflection on the target part.
[0225] In some embodiments, the position of the target part in the virtual scene includes at least one position point; the above-mentioned position determination module 4552 is also used to obtain the shooting rays corresponding to each position point, and the shooting rays are constructed with the position point as the end point and the target virtual camera as the starting point. The target virtual camera is a virtual camera in the virtual scene used to shoot the target part; combining the shooting rays and the position points, determine the reflected rays corresponding to each position point, and the position point is the starting point of the corresponding reflected ray; based on each reflected ray, determine the position of the target light source.
[0226] In some embodiments, the above-mentioned position determination module 4552 is also used to select a candidate light source position from the reflected rays when the number of reflected rays is one, the candidate light source position is any position on the reflected rays except the position point, and determine the candidate light source position as the target light source position; when the number of reflected rays is at least two, select the target intersection from at least one intersection formed by at least two reflected rays, and determine the position of the target intersection in the virtual scene as the target light source position; wherein the number of reflected rays intersecting at the target intersection is the maximum value of the numbers corresponding to each intersection.
[0227] In some embodiments, the above-mentioned position determination module 4552 is also used to perform the following processing for each position point: obtain the normal vector corresponding to the position point, and the normal vector is perpendicular to the tangent plane of the position point; combine the shooting ray and the normal vector corresponding to the position point to determine the reflected ray corresponding to the position point; wherein the angle between the reflected ray and the normal vector is equal to the angle between the shooting ray and the normal vector.
[0228] In some embodiments, the position of the target part in the virtual scene includes at least one position point, and the above-mentioned area determination module 4553 is also used to select at least one target position point corresponding to the target light source position from the at least one position point, and the target virtual light emitted by the virtual light source at the target light source position can form a high light reflection on the target position point; the area formed by each target position point is determined as the target area; the position light intensity corresponding to each target position point is determined, and based on the light intensity of each position, the light intensity on the target area is determined.
[0229] In some embodiments, the above-mentioned area determination module 4553 is also used to perform the following processing for each target position point: obtain the light source irradiance of the virtual light source, and determine the first distance between the virtual light source and the target position point, and the second distance between the target position point and the target virtual camera. The target virtual camera is a virtual camera used to shoot the target part in the virtual scene; add the first distance and the second distance to obtain the total distance, and determine the loss value of the light source irradiance based on the total distance and the target position point; subtract the light source irradiance from the loss value to obtain the position light intensity corresponding to the target position point.
[0230] In some embodiments, the above-mentioned area determination module 4553 is also used to determine a first loss value of the light source irradiance based on the total distance, and the first loss value is proportional to the numerical value of the total distance; wherein the first loss value is used to indicate the energy absorption value of the propagation medium on the target propagation path to the light source irradiance, and the target propagation path is the propagation path from the virtual light source through the target position point to the target virtual camera; based on the target position point, determine the second loss value of the light source irradiance, and the second loss value is used to indicate the energy absorption value of the light source irradiance at the target position point; sum the first loss value and the second loss value to obtain the loss value of the light source irradiance.
[0231] In some embodiments, the above-mentioned area determination module 4553 is also used to receive a setting instruction for the position lighting intensity sent by the terminal, and adjust the position lighting intensity in response to the setting instruction to obtain the adjusted position lighting intensity, wherein the setting instruction carries the adjustment range of the position lighting intensity; and determine each adjusted position lighting intensity as the lighting intensity of the corresponding target position point on the target area.
[0232] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device performs the above-mentioned method for rendering the highlight effect in the embodiment of the present application.
[0233] The present application embodiment provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will be caused to execute the highlight effect rendering method provided by the present application embodiment, for example, Figure 3 Rendering method showing the highlight effect.
[0234] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEP ROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various electronic devices including one or any combination of the above memories.
[0235] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0236] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0237] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.
[0238] In summary, the embodiments of the present application have the following beneficial effects:
[0239] (1) By combining the position of the target part in the virtual scene and the initial light source position, the target light source position that can form highlight reflection is obtained in the virtual scene, and the target area in the target part that can form highlight reflection and the light intensity on the target area are determined by combining the position of the target part in the virtual scene and the target light source position. Based on the target area and the light intensity, a highlight effect is rendered at the target part to obtain a rendering result. In this way, by determining the target light source position, a highlight reflection is formed in the target area on the target part of the virtual object, and a highlight effect is rendered at the target part to obtain a rendering result, so that the highlight effect can be flexibly used at the target part, effectively enhancing the picture realism of the virtual scene.
[0240] (2) By obtaining the initial light source position of the virtual light source used to illuminate the target part of the virtual object in the virtual scene, as well as the position of the target part in the virtual scene, it is convenient to accurately determine the target light source position that can form a highlight reflection, so as to form a highlight reflection at the target part, thereby being able to flexibly use the highlight effect at the target part, effectively enhancing the picture realism of the virtual scene.
[0241] (3) By comparing the shooting rays corresponding to each position point with the initial reflected light, it is determined whether the initial reflected light coincides with the shooting rays, so as to determine the accurate initial lighting information. When the shooting rays coincide with the initial reflected light, the virtual camera can receive the full amount of the initial reflected light, thereby forming a highlight reflection at the corresponding position point on the target part, effectively improving the accuracy of the determined initial lighting information.
[0242] (4) By obtaining the shooting rays corresponding to each position point, combining the shooting rays and the position points, the reflection rays corresponding to each position point are determined, and the target light source position is determined on each reflection ray, so that the virtual light emitted by the virtual light source from the target light source position can be reflected on the reflection ray until it reaches the target virtual camera, thereby minimizing the loss of light intensity received by the target virtual camera and forming a highlight reflection, so that the highlight effect can be flexibly used in the target part, effectively enhancing the picture realism of the virtual scene.
[0243] (5) By determining the loss value of the light source irradiance on the propagation path corresponding to each target position point, the position light intensity corresponding to the target position point is determined, which facilitates the subsequent determination of the light intensity on the target area based on the position light intensity, so as to render the highlight effect at the target part and obtain the rendering result, so that the highlight effect can be flexibly used at the target part, effectively enhancing the picture realism of the virtual scene.
[0244] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A method for rendering a highlight effect, characterized in that: The method comprises: Acquire an initial light source position of a virtual light source in a virtual scene, and a position of a target part of a virtual object in the virtual scene; Acquire a target light source position capable of forming a high light reflection in the virtual scene by combining the position of the target part in the virtual scene and the initial light source position; Determine a target area in the target area and the light intensity on the target area in combination with the position of the target area in the virtual scene and the position of the target light source; Wherein, the target area is the area in the target part where the high light reflection is formed; Based on the target area and the light intensity, a highlight effect is rendered at the target part to obtain a rendering result, and the rendering result is used to form the highlight reflection at the target part.
2. The method according to claim 1, characterized in that The step of combining the position of the target part in the virtual scene with the initial light source position to obtain the target light source position capable of forming high light reflection in the virtual scene includes: Determine initial illumination information of the target part by combining the position of the target part in the virtual scene and the initial light source position; When the initial illumination information indicates that the initial virtual light can form the high light reflection on the target part, determining the initial light source position as the target light source position, wherein the initial virtual light is emitted by the virtual light source; When the initial lighting information indicates that the initial virtual light cannot form the highlight reflection on the target part, a target light source position that can form the highlight reflection is determined in the virtual scene, and the virtual light source is moved from the initial light source position to the target light source position.
3. The method according to claim 2, characterized in that The determining the initial illumination information of the target part by combining the position of the target part in the virtual scene and the initial light source position includes: Acquire the initial virtual light emitted by the virtual light source at the initial light source position; When the initial virtual light cannot illuminate the position of the target part in the virtual scene, determining the initial illumination information as first illumination information, wherein the first illumination information is used to indicate that the initial virtual light cannot form the highlight reflection on the target part; When the initial virtual light can illuminate the position of the target part in the virtual scene, obtaining the initial reflected light corresponding to the initial virtual light, and determining the initial illumination information of the target part based on the initial reflected light; The initial reflected light is a virtual light formed by the initial virtual light being reflected on the target part.
4. The method according to claim 3, characterized in that The position of the target part in the virtual scene includes at least one position point; and determining the initial illumination information of the target part based on the initial reflected light includes: Acquire shooting rays corresponding to each of the position points, wherein the shooting rays are rays constructed with the position point as the end point and the target virtual camera as the starting point, and the target virtual camera is a virtual camera in the virtual scene used to shoot the target part; When the initial reflected light does not overlap with any of the shooting rays, determining the initial illumination information as the first illumination information; When the initial reflection ray coincides with at least one of the shooting rays, the initial illumination information is determined as second illumination information, wherein the second illumination information is used to indicate that the initial virtual ray can form the highlight reflection on the target part.
5. The method according to claim 2, characterized in that: The position of the target part in the virtual scene includes at least one position point; and determining the position of the target light source capable of forming the high light reflection in the virtual scene includes: Acquire shooting rays corresponding to each of the position points, wherein the shooting rays are rays constructed with the position point as the end point and the target virtual camera as the starting point, and the target virtual camera is a virtual camera in the virtual scene used to shoot the target part; Combining the shooting rays and the position points, determining the reflected rays corresponding to the position points, wherein the position points are the starting points of the corresponding reflected rays; Based on each of the reflected rays, the position of the target light source is determined.
6. The method according to claim 5, characterized in that The determining the position of the target light source based on each of the reflected rays comprises: When the number of the reflected rays is one, selecting a candidate light source position from the reflected rays, the candidate light source position being any position on the reflected rays except the position point, and determining the candidate light source position as the target light source position; When the number of the reflected rays is at least two, selecting a target intersection point from at least one intersection point formed by the at least two reflected rays, and determining the position of the target intersection point in the virtual scene as the target light source position; The number of the reflected rays intersecting at the target intersection is the maximum value among the numbers corresponding to the intersections.
7. The method according to claim 5, characterized in that The combining the shooting rays and the position points to determine the reflected rays corresponding to the position points respectively includes: The following processing is performed for each of the position points: Obtaining a normal vector corresponding to the position point, wherein the normal vector is perpendicular to a tangent plane of the position point; Determine the reflected ray corresponding to the position point by combining the shooting ray corresponding to the position point and the normal vector; The angle between the reflected ray and the normal vector is equal to the angle between the captured ray and the normal vector.
8. The method according to claim 1, characterized in that The position of the target part in the virtual scene includes at least one position point, and combining the position of the target part in the virtual scene and the position of the target light source to determine the target area in the target part and the light intensity on the target area includes: From the at least one position point, select at least one target position point corresponding to the target light source position, the target virtual light emitted by the virtual light source at the target light source position being able to form the highlight reflection at the target position point; Determine the area formed by each of the target position points as the target area; The position illumination intensity corresponding to each of the target position points is determined, and based on the position illumination intensity, the illumination intensity on the target area is determined.
9. The method according to claim 8, characterized in that The step of determining the position illumination intensity corresponding to each of the target position points includes: The following processing is performed for each target location point: Acquire the light source irradiance of the virtual light source, and determine a first distance between the virtual light source and the target position point, and a second distance between the target position point and a target virtual camera, wherein the target virtual camera is a virtual camera in the virtual scene used to photograph the target part; Adding the first distance and the second distance to obtain a total distance, and determining a loss value of the light source irradiance based on the total distance and the target position point; The light source irradiance is subtracted from the loss value to obtain the position light intensity corresponding to the target position point.
10. The method according to claim 9, characterized in that The determining the loss value of the light source irradiance based on the total distance and the target position point includes: Based on the total distance, determining a first loss value of the irradiance of the light source, wherein the first loss value is proportional to a numerical value of the total distance; The first loss value is used to indicate the energy absorption value of the propagation medium on the target propagation path to the irradiance of the light source, and the target propagation path is the propagation path from the virtual light source through the target position point to the target virtual camera; Based on the target position point, determining a second loss value of the light source irradiance, wherein the second loss value is used to indicate an energy absorption value of the target position point to the light source irradiance; The first loss value and the second loss value are summed to obtain a loss value of the light source irradiance.
11. The method according to claim 8, characterized in that The step of determining the illumination intensity on the target area based on the illumination intensity at each of the positions includes: receiving a setting instruction for the location lighting intensity sent by the terminal, and adjusting the location lighting intensity in response to the setting instruction to obtain an adjusted location lighting intensity, wherein the setting instruction carries an adjustment range of the location lighting intensity; The adjusted position illumination intensity is determined as the illumination intensity of the corresponding target position point on the target area.
12. A device for rendering a highlight effect, characterized in that: The device comprises: An acquisition module, used to acquire an initial light source position of a virtual light source in a virtual scene, and a position of a target part of a virtual object in the virtual scene; A position determination module, used to obtain a target light source position capable of forming a high light reflection in the virtual scene by combining the position of the target part in the virtual scene and the initial light source position; An area determination module, used to determine a target area in the target part and the light intensity on the target area in combination with the position of the target part in the virtual scene and the position of the target light source; wherein the target area is the area in the target part where the high light reflection is formed; A rendering module is used to render a highlight effect at the target part based on the target area and the light intensity to obtain a rendering result, and the rendering result is used to form the highlight reflection at the target part.
13. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions or computer programs; A processor is used to implement the method for rendering a highlight effect as described in any one of claims 1 to 11 when executing the computer executable instructions or computer programs stored in the memory.
14. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the method for rendering the highlight effect according to any one of claims 1 to 11 is implemented.
15. A computer program product comprising a computer program or computer executable instructions, characterized in that: When the computer program or computer executable instruction is executed by a processor, the method for rendering a highlight effect as described in any one of claims 1 to 11 is implemented.
