Illumination control method, device, equipment, medium and product
By determining the lighting control strategy in the virtual application display scene and generating the target lighting parameters, and adjusting the lighting effect of the preset light source, the problem of excessive lighting cost in virtual applications is solved, and the effect of reducing the load and power consumption of the graphics processor while maintaining the lighting effect is achieved.
Patent Information
- Application Number
- CN202311551655.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2043-11-20
AI Technical Summary
In virtual application display scenarios, in order to improve the display effect, it is usually necessary to improve the frame rate, resolution and lighting quality, which leads to a significant increase in the consumption cost of hardware devices, especially the increase in power consumption and load of graphics processors, display screens and memory, which becomes a non-essential burden.
A lighting control method is proposed. By responding to a scene lighting control request that reduces lighting costs in a virtual scene, a lighting control strategy for a preset light source is determined, a target lighting parameters for adjusting the low-cost lighting effect of the light source are generated, and a lighting rendering task is performed using these parameters. This method includes a fixed control strategy and a dynamic control strategy. By adjusting the attenuation parameters and compensation parameters, the lighting range is reduced and the lighting brightness is improved, ensuring that the lighting effect remains unchanged or basically remains unchanged.
Without reducing the lighting effect, it effectively reduces lighting costs, including reducing the load of graphics processors, power consumption and overall power consumption of electronic devices, avoiding or reducing unnecessary rendering or over-rendering, and reducing energy consumption losses caused during lighting rendering.
Smart Images

Figure CN120070715A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of display technologies, and in particular, to a method, apparatus, device, medium, and product for light control. Background Art
[0002] In virtual application display scenarios, to improve the display effect, both product parameters and the performance of hardware devices have been significantly improved.
[0003] In practical applications, to improve the display effect, the frame rate, resolution, etc. are usually increased. At the same time, great improvements have also been made in the light quality effect, including an increase in the number of light sources and an increase in the light range, resulting in a significant increase in the cost of hardware devices. For example, the computing power and power consumption of a Graphics Processing Unit (GPU), the power consumption of a display screen, the power consumption of Double Data Rate (DDR) memory, and so on. This excessive consumption of power and computing power becomes an unnecessary burden for electronic devices in some cases. Therefore, a solution is needed to reduce the light cost while meeting the display requirements. Summary of the Invention
[0004] Multiple aspects of this application provide a method, apparatus, device, medium, and product for light control to solve the problem of excessive light cost during the light control process.
[0005] In a first aspect, an embodiment of this application provides a method for light control, including:
[0006] Responding to a scene light control request for reducing light cost in a virtual scene, and determining a light control strategy for a preset light source in the virtual scene;
[0007] Based on the light control strategy, generating target light parameters for adjusting the low-cost light effect of the preset light source;
[0008] Performing a light rendering task on the preset light source using the target light parameters.
[0009] After receiving a scene light control request for reducing light cost, it is possible to further generate, according to the light control strategy, target light parameters that can reduce the light cost while ensuring that the original light effect remains unchanged or basically unchanged, and then meet the display requirements of the virtual scene and the user's viewing and usage experience, effectively reducing the device power consumption and the load of related components.
[0010] Optionally, generating target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy includes: generating the target lighting parameters for reducing the lighting cost based on a fixed control strategy or a dynamic control strategy, where the target lighting parameters include at least one of an attenuation parameter and a compensation parameter.
[0011] When determining the target lighting parameters, it is necessary to determine them according to the selected control strategy. The target lighting parameters mentioned here include at least one of an attenuation parameter and a compensation parameter. Among them, the attenuation parameter is used to narrow the lighting range, and the compensation parameter is used to increase the lighting brightness. When selecting the target lighting parameters, they can be selected according to actual needs. For example, if the lighting effect is not significantly affected after adjusting the attenuation parameter, the compensation parameter can be not adjusted or replaced. The target lighting parameters are more reasonably selected through the above solution.
[0012] Optionally, generating target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy includes: when the determined lighting control strategy is a fixed control strategy, intercepting the lighting rendering instruction; determining the number of light sources and / or the type of light source based on the lighting rendering instruction; generating a fixed attenuation parameter for reducing the lighting range and a fixed compensation parameter for increasing the lighting brightness according to the number of light sources and / or the type of light source.
[0013] When calculating the attenuation parameter and the compensation parameter, it is necessary to determine according to the content included in the real-time intercepted rendering instruction. Specifically, the corresponding fixed attenuation parameter and fixed compensation parameter should be determined according to the number of light sources, the type of light source, etc. included in the rendering instruction. During the subsequent game execution process, there is no need to modify or adjust the attenuation parameter and the compensation parameter, avoiding frequent calculation of the attenuation parameter and the compensation parameter and reducing the computing power consumption.
[0014] Optionally, generating target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy includes: when the determined lighting control strategy is a dynamic control strategy, intercepting the lighting rendering instruction and obtaining the device operating parameters; generating a dynamic attenuation parameter for reducing the lighting range and a dynamic compensation parameter for increasing the lighting brightness based on the lighting rendering instruction and the device operating parameters.
[0015] When calculating the attenuation parameter and the compensation parameter, it should be comprehensively determined according to the content included in the real-time intercepted rendering instruction and the device operating parameters. Specifically, the corresponding dynamic attenuation parameter and dynamic compensation parameter should be determined according to the number of light sources, the type of light sources included in the rendering instruction, and the device operating parameters. During the subsequent game execution, during the process of switching from the original lighting parameter to the target lighting parameter, the lighting parameter is finely adjusted frame by frame until the target lighting parameter is reached. Since the adjustment process is spread over multiple frames, the difference in lighting effects between two adjacent frames is very small, making the lighting effect transition in the whole adjustment process more natural and avoiding the situation of sudden changes that can be perceived by users. Thus, users can obtain a better viewing and usage experience.
[0016] Optionally, generating the dynamic attenuation parameter for reducing the lighting range and the dynamic compensation parameter for enhancing the lighting brightness based on the lighting rendering instruction and the device operating parameters includes: determining the number of light sources and / or the type of light sources based on the lighting rendering instruction; obtaining the graphics processor operating parameters and the device temperature parameter collected by the sensor; generating the dynamic attenuation parameter and the dynamic compensation parameter based on the number of light sources and / or the type of light sources, the graphics processor operating parameters, and the device temperature parameter.
[0017] When generating the corresponding lighting parameter based on the dynamic control strategy, it not only depends on the information included in the rendering instruction, but also on the device-related parameters input externally, including the graphics processor operating parameters (such as load, temperature, power consumption, etc.) and the device temperature parameter, and then comprehensively determines the dynamic attenuation parameter and the dynamic compensation parameter. These dynamic lighting parameters can be dynamically adjusted according to the rendering instruction and the externally input device-related parameters. Thus, it can better meet the lighting effect while reducing the lighting cost.
[0018] Optionally, generating the dynamic attenuation parameter and the dynamic compensation parameter based on the number of light sources and / or the type of light sources, the graphics processor operating parameters, and the device temperature parameter includes: determining the weight coefficients corresponding to the number of light sources and / or the type of light sources, the graphics processor operating parameters, and the device temperature parameter respectively; obtaining the total weight value obtained by summing up each weight coefficient; and selecting the dynamic attenuation parameter and the dynamic compensation parameter from the preset lighting parameter table according to the total weight value.
[0019] Optionally, the determination method of the dynamic compensation parameter includes: when the dynamic attenuation parameter is less than the first threshold, generating a compensation parameter greater than the first threshold corresponding to the attenuation parameter, so as to use the compensation parameter to enhance the light source brightness, and the enhanced light source brightness is not greater than the brightness entering the virtual scene.
[0020] By setting reasonable attenuation parameters, the lighting range can be reduced, thereby directly and significantly reducing the lighting cost. However, sometimes reducing the lighting range will cause a significant change in the lighting effect compared to the original lighting. To mitigate the change in the lighting effect, appropriate compensation parameters need to be selected to increase the light source brightness. That is, when calculating the lighting brightness, it needs to be comprehensively determined based on the impact caused by the attenuation parameters. In other words, the compensation parameters are calculated based on the attenuation parameters.
[0021] Optionally, after intercepting the lighting rendering instruction, it further includes: determining lighting model parameters based on the lighting rendering instruction; creating a copy of the lighting model based on the lighting model parameters for performing the lighting rendering task using the copy of the lighting model.
[0022] Performing the lighting rendering task on the preset light source using the target lighting parameters includes: replacing the historical lighting parameters in the copy of the lighting model with the target lighting parameters; binding the copy of the lighting model based on the rendering instruction; performing the lighting rendering task on the preset light source based on the copy of the lighting model.
[0023] In practical applications, to facilitate the adjustment of the lighting effect, a copy of the model is established for the original lighting model. When performing the rendering task, the copy of the lighting model is used to replace the original lighting model. At the same time, the target lighting parameters are used to replace the original lighting parameters. After completing the replacement task, the rendering task for the preset light source is performed. In this solution, the number of original light sources will not be changed because changing the number of light sources will make it easy for users to notice and even wrongly change the game plot.
[0024] Optionally, performing the lighting rendering task on the preset light source using the target lighting parameters includes: converting the target lighting parameters into code parameters executable by the shader; after adjusting the historical lighting model and historical lighting parameters in the shader using the code parameters, performing the lighting rendering task on the preset light source.
[0025] In an alternative solution, if no replacement of the lighting model copy and target lighting parameters is performed, the target lighting parameters can also be converted into code parameters and input into the shader at the stage when the shader executes the code task to achieve the modification of the execution effect of the rendering task for the preset light source.
[0026] Optionally, in response to a scene lighting control request in a virtual scene, determining a lighting control strategy for a preset light source in the virtual scene, including: if a scene lighting control request for reducing lighting cost triggered by a user is received, or a scene lighting control request for reducing lighting cost triggered by a preset default is read, then determining whether to select a default configuration according to a local configuration file; if so, determining that the lighting control strategy is a fixed control strategy; if not, determining that the lighting control strategy is a dynamic control strategy.
[0027] In a second aspect, an embodiment of the present application further provides a lighting control device, including:
[0028] A determination module, configured to determine a lighting control strategy for a preset light source in the virtual scene in response to a scene lighting control request for reducing lighting cost in the virtual scene;
[0029] A generation module, configured to generate target lighting parameters for adjusting a low-cost lighting effect of the preset light source based on the lighting control strategy;
[0030] An execution module, configured to execute a lighting rendering task for the preset light source by using the target lighting parameters.
[0031] In a third aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory. The memory is used to store computer-executable program code, and the program code includes instructions; when the processor executes the instructions, the instructions cause the electronic device to execute the method in the first aspect.
[0032] In a fourth aspect, an embodiment of the present application provides a computer program product containing instructions, which, when running on a computer, causes the computer to execute the method in the first aspect above.
[0033] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored, and when running on a computer, cause the computer to execute the method in the first aspect above.
[0034] In some embodiments of the present application, when a scene lighting control request for reducing lighting costs is received, the lighting control strategy of a preset light source in the corresponding virtual scene is further determined. According to the selected lighting control strategy, target lighting parameters for adjusting the low-cost lighting effect of the preset light source are generated, and then the lighting rendering task for the preset light source can be executed using the newly determined target lighting parameters. Through the above solution, when performing lighting rendering in a virtual scene, a suitable lighting control strategy is selected according to actual needs. Furthermore, based on the lighting control strategy, corresponding target lighting parameters for achieving a low-cost lighting effect are formulated, so that the lighting cost can be effectively reduced without reducing the lighting effect, including effectively reducing the graphics processor load, power consumption of the lighting, and overall power consumption of the electronic device, avoiding or reducing unnecessary rendering or over-rendering, and reducing the energy consumption loss caused during the lighting rendering process. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments and descriptions thereof of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0036] Figure 1 A schematic structural diagram of an electronic device is shown;
[0037] Figure 2 It is a software structural block diagram of the electronic device according to an embodiment of the present invention;
[0038] Figure 3 A flowchart of a lighting control method provided by an exemplary embodiment of the present application;
[0039] Figure 4a A schematic diagram of the lighting parameter effect corresponding to a fixed control strategy provided by an embodiment of the present application;
[0040] Figure 4b A schematic diagram of the lighting parameter effect corresponding to another fixed control strategy provided by an embodiment of the present application;
[0041] Figure 5 A schematic diagram of the lighting parameter effect corresponding to yet another fixed control strategy provided by an embodiment of the present application;
[0042] Figure 6 A flowchart of a method for determining target lighting parameters based on a dynamic lighting control strategy provided by an embodiment of the present application;
[0043] Figure 7 A schematic diagram of the lighting parameter effect corresponding to a dynamic control strategy provided by an embodiment of the present application;
[0044] Figure 8Schematic diagram of a light control device provided by an exemplary embodiment of the present application;
[0045] Figure 9 Schematic diagram of an electronic device provided by an exemplary embodiment of the present application;
[0046] Figure 10 Schematic diagram of a light control process illustrated by an example of an embodiment of the present application. Detailed implementation manners
[0047] To make the objectives, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be clearly and completely described below in conjunction with specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only a part rather than all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0048] A Graphics Processing Unit (GPU) is a hardware device specifically designed to process graphics and image data. It is an important component in a computer system and is used to accelerate graphics rendering, image processing, and computing tasks. Compared with a Central Processing Unit (CPU), the GPU has more powerful performance in processing graphics and images. The GPU uses parallel computing, has a large number of processing units and dedicated graphics memory, and can process multiple image pixels and vertex data simultaneously. This enables the GPU to have wide applications in fields such as gaming, computer-aided design (CAD), scientific computing, and deep learning. The main functions of the GPU include graphics rendering, image processing, physical simulation, data parallel computing, etc. It can execute complex graphics algorithms such as ray tracing, shading, and texture mapping, enabling images to be presented on the screen at a faster speed and higher quality. In addition, the GPU can also perform tasks such as image and video encoding and decoding, image filtering, and image recognition.
[0049] A Lighting Model is a mathematical model used in computer graphics to simulate lighting effects. It describes how light interacts with objects and determines visual effects such as the brightness, color, and shadows of the object's surface. The lighting model usually considers three basic lighting components: ambient light, diffuse light, and specular light. Various lighting effects require corresponding light sources to be achieved.
[0050] A Light Source is an element used to simulate lighting effects. It is an important part of a game, used to create realistic lighting and shadow effects, enhancing the visual expressiveness of the game scene. In a game, a light source can be virtual, created and controlled by the game engine or developer. A light source can have various attributes and characteristics, such as range, brightness, color, position, type, etc. By adjusting the attributes and position of the light source, the brightness, color, and shadow effects of objects in the game scene can be changed, enhancing the realism and atmosphere of the scene.
[0051] In practical applications, when performing lighting rendering on a light source in a virtual scene, the graphics processing unit often needs to consume a large amount of computing power to achieve the required lighting effects. Especially when the frame rate of the game is high, the graphics processing unit sometimes has difficulty meeting the graphics rendering requirements, and there may be a lag situation. In addition, components such as the graphics processing unit, central processing unit, and display module in an electronic device will consume a large amount of electrical energy and generate a relatively high amount of heat, seriously affecting the stability and battery life of the electronic device. Therefore, there is a need to solve the problem of how to reduce lighting costs (including reducing the computing power of the graphics processing unit, power consumption, power consumption of the display module, and temperature of the electronic device) while ensuring the lighting effect.
[0052] The following will, with reference to the accompanying drawings, elaborate on the technical solutions provided by each embodiment of this application.
[0053] Figure 1 The structural schematic diagram of the electronic device 100 is shown.
[0054] The electronic device 100 can be a mobile phone, a personal computer (PC), a tablet computer, an AR device, a VR device, an in-vehicle computer, a wearable device, a smart home device, etc.
[0055] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0056] It can be understood that the structure schematically shown in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0057] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0058] The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
[0059] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can hold the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the said memory. This avoids repeated accesses and reduces the waiting time of the processor 110, thus improving the efficiency of the system.
[0060] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0061] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flashlight, the camera 193, etc. through different I2C bus interfaces. For example: The processor 110 can be coupled to the touch sensor 180K through the I2C interface, enabling the processor 110 to communicate with the touch sensor 180K through the I2C bus interface to implement the touch function of the electronic device 100.
[0062] The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple groups of I2S buses. The processor 110 can be coupled to the audio module 170 through the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the I2S interface to implement the function of answering a call through a Bluetooth headset.
[0063] The PCM interface can also be used for audio communication to sample, quantize, and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled through a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0064] The UART interface is a general-purpose serial data bus for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0065] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100.
[0066] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0067] The USB interface 130 is an interface that complies with the USB standard specification, and can specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used for data transmission between the electronic device 100 and peripheral devices. It can also be used to connect a headset to play audio through the headset. This interface can also be used to connect other electronic devices, such as AR devices, etc.
[0068] It can be understood that the interface connection relationships among the modules illustrated in the embodiments of the present invention are only illustrative descriptions and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners in the above embodiments, or a combination of multiple interface connection manners.
[0069] The charging management module 140 is used to receive a charging input from a charger. The charger may be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 may receive the charging input from the wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 may receive the wireless charging input through the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 may also supply power to the electronic device through the power management module 141.
[0070] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives the inputs from the battery 142 and / or the charging management module 140 and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, etc. The power management module 141 may also be used to monitor parameters such as the battery capacity, the number of battery cycles, and the battery health status (leakage, impedance). In some other embodiments, the power management module 141 may also be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.
[0071] The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, etc.
[0072] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas may also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 may be multiplexed as the diversity antenna of the wireless local area network. In some other embodiments, the antenna may be used in combination with a tuning switch.
[0073] The mobile communication module 150 may provide a solution for wireless communication including 2G / 3G / 4G / 5G, etc., which is applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and then transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least some functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be disposed in the same device.
[0074] The modulation and demodulation processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 110 and disposed in the same device as the mobile communication module 150 or other functional modules.
[0075] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSSs), frequency modulation (FM), near field communication (NFC), infrared (IR), and so on. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive signals to be sent from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.
[0076] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, such that electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).
[0077] Electronic device 100 implements a display function through a GPU, display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, and is connected to display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0078] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0079] The electronic device 100 can implement the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.
[0080] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light passes through the lens and is transmitted to the camera photosensitive element. The optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0081] The camera 193 is used to capture static images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in standard RGB, YUV, etc. formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0082] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.
[0083] The video codec is used to compress or decompress digital videos. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple coding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0084] The NPU is a neural-network (NN) computing processor. By drawing on the structure of the biological neural network, such as the transmission mode between human brain neurons, it can quickly process the input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as: image recognition, face recognition, speech recognition, text understanding, etc.
[0085] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.
[0086] The internal memory 121 can be used to store computer-executable program code, and the executable program code includes instructions. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, the image playback function, etc.). The data storage area can store the data created during the use of the electronic device 100 (such as audio data, phone book, etc.). In addition, the internal memory 121 can include high-speed random access memory and can also include non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121 and / or the instructions stored in the memory provided in the processor.
[0087] The electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor, etc. For example, music playback, recording, etc.
[0088] The audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some functional modules of the audio module 170 can be disposed in the processor 110.
[0089] The speaker 170A, also known as the "loudspeaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or hands-free calls through the speaker 170A.
[0090] The receiver 170B, also known as the "earpiece", is used to convert an audio electrical signal into a sound signal. When the electronic device 100 answers a call or a voice message, the voice can be listened to by placing the receiver 170B close to the human ear.
[0091] The microphone 170C, also known as the "microphone" or "transmitter", is used to convert a sound signal into an electrical signal. When making a call or sending a voice message, the user can speak by placing the mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In some other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also implement a noise reduction function. In some other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and implement functions such as directional recording.
[0092] The headphone jack 170D is used to connect a wired headphone. The headphone jack 170D can be a USB interface 130, or a 3.5 mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0093] The pressure sensor 180A is used to sense pressure signals and can convert pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor may include at least two parallel plates having conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, the instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
[0094] The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., the x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. Exemplarily, when the shutter is pressed, the gyroscope sensor 180B detects the angle of jitter of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and makes the lens offset the jitter of the electronic device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenarios.
[0095] The barometric pressure sensor 180C is used to measure barometric pressure. In some embodiments, the electronic device 100 calculates the altitude according to the barometric pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.
[0096] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Furthermore, according to the detected opening and closing state of the leather case or the opening and closing state of the flip, features such as automatic flip unlocking are set.
[0097] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0098] A distance sensor 180F is used to measure distance. The electronic device 100 can measure distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure distance to achieve fast focusing.
[0099] The proximity light sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The light-emitting diode may be an infrared light-emitting diode. The electronic device 100 emits infrared light outward through the light-emitting diode. The electronic device 100 uses the photodiode to detect the infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect when the user holds the electronic device 100 close to the ear for a call, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used for automatic unlocking and locking of the holster mode and pocket mode.
[0100] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touch.
[0101] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint taking pictures, fingerprint answering calls, etc.
[0102] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by low temperature. In other some embodiments, when the temperature is lower than yet another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0103] The touch sensor 180K, also known as the "touch control device". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also known as the "touch control screen". The touch sensor 180K is used to detect a touch operation acting thereon or nearby. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a different position from that of the display screen 194.
[0104] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals of the vibrating bone mass of the human vocal part. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure pulsation signals. In some embodiments, the bone conduction sensor 180M can also be disposed in the earphone to form a bone conduction earphone. The audio module 170 can parse out voice signals based on the vibration signals of the vibrating bone mass of the human vocal part acquired by the bone conduction sensor 180M to implement the voice function. The application processor can parse out heart rate information based on the blood pressure pulsation signals acquired by the bone conduction sensor 180M to implement the heart rate detection function.
[0105] The button 190 includes a power-on button, a volume button, etc. The button 190 can be a mechanical button. It can also be a touch button. The electronic device 100 can receive button inputs to generate key signal inputs related to the user settings and function control of the electronic device 100.
[0106] The motor 191 can generate vibration prompts. The motor 191 can be used for incoming call vibration prompts and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playing, etc.) can correspond to different vibration feedback effects. Touch operations acting on different regions of the display screen 194 can also correspond to different vibration feedback effects for the motor 191. Different application scenarios (such as time reminder, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0107] The indicator 192 can be an indicator light and can be used to indicate the charging state, power change, and can also be used to indicate messages, missed calls, notifications, etc.
[0108] The SIM card interface 195 is used to connect to the SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to achieve contact with and separation from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communication. In some embodiments, the electronic device 100 uses an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0109] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present invention, the Android system with a layered architecture is taken as an example to exemplarily illustrate the software structure of the electronic device 100.
[0110] Figure 2 It is a software structure block diagram of the electronic device 100 in the embodiments of the present invention.
[0111] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0112] The application layer may include a series of application packages.
[0113] As Figure 2 shown, the application packages may include applications such as a camera, a gallery, a calendar, a call, a map, a navigation, a WLAN, a Bluetooth, music, a video, a short message, etc.
[0114] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.
[0115] As Figure 2 shown, the application framework layer may include a window manager, a content provider, a view system, a telephone manager, a resource manager, a notification manager, etc.
[0116] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0117] The content provider is used to store and obtain data, and make this data accessible to application programs. The data may include videos, images, audio, incoming and outgoing calls, browsing history and bookmarks, phone books, etc.
[0118] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build application programs. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
[0119] The phone manager is used to provide the communication function of the electronic device 100. For example, the management of call states (including connection, disconnection, etc.).
[0120] The resource manager provides various resources for application programs, such as localized strings, icons, pictures, layout files, video files, etc.
[0121] The notification manager enables application programs to display notification information in the status bar. It can be used to convey message types that need to be informed. It can disappear automatically after a short stay without user interaction. For example, the notification manager is used to inform that the download is completed, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as the notification of a background running application program, and can also be a notification that appears on the screen in the form of a dialogue window. For example, it prompts text information in the status bar, emits a prompt sound, the electronic device vibrates, the indicator light flashes, etc.
[0122] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for the scheduling and management of the Android system.
[0123] The core libraries contain two parts: one part is the functional functions that need to be called by the Java language, and the other part is the core libraries of Android.
[0124] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as the management of object life cycles, stack management, thread management, security and exception management, and garbage collection.
[0125] The system library may include multiple functional modules. For example: surface manager, Media Libraries, 3D graphics processing library (such as: OpenGL ES), 2D graphics engine (such as: SGL), etc.
[0126] The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
[0127] The media library supports the playback and recording of various common audio and video formats, as well as static image files, etc. The media library can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0128] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.
[0129] The 2D graphics engine is a drawing engine for 2D drawing.
[0130] The kernel layer is the layer between hardware and software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.
[0131] The following combines the capture and photo-taking scenario to exemplarily illustrate the working processes of the software and hardware of the electronic device 100.
[0132] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including information such as touch coordinates and the timestamp of the touch operation). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation and the control corresponding to the click operation as the control of the camera application icon as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer, and captures a static image or video through the camera 193.
[0133] Figure 3 It is a schematic flowchart of the light control method provided by an exemplary embodiment of the present application. As Figure 3 shown, the execution subject of this method can be an electronic device of a user terminal, and this electronic device can be used in light control scenarios in games, light control scenarios in home design applications, light control scenarios in modeling applications, light control scenarios in augmented reality applications, and light control scenarios in virtual display applications, etc. For the sake of easy understanding, the following embodiments will be described by taking the light control scenario in a game as an example. Specifically, it includes the following steps:
[0134] Step 301: In response to a scene lighting control request for reducing lighting costs in a virtual scene, determine a lighting control strategy for a preset light source in the virtual scene.
[0135] Step 302: Based on the lighting control strategy, generate target lighting parameters for adjusting the low-cost lighting effect of the preset light source.
[0136] Step 303: Use the target lighting parameters to perform a lighting rendering task on the preset light source.
[0137] Taking a game virtual scene as an example, in a game application scenario, there are not only virtual objects that can be manipulated by users (such as virtual characters, virtual animals, virtual weapons, virtual vehicles, etc.), but also many virtual environment contents, such as virtual plants, virtual landscapes, virtual lights, etc. in the virtual environment. Due to some plot requirements, many light sources are set to make the game scene more realistic and users obtain a better game experience.
[0138] When the number of light sources is relatively large, the graphics processor needs to render them one by one, and the computing power cost of the graphics processor is relatively high. Sometimes it even affects the overall game rendering smoothness effect. For example, the game screen may freeze, etc., directly affecting the user experience. In addition, the power consumption of the graphics processor will also be relatively high, affecting the battery life of the electronic device.
[0139] Therefore, according to the actual situation, it is possible to reduce the lighting cost as much as possible while maintaining the original lighting effect. The reduction of lighting cost mentioned here includes reducing the load of the graphics processing unit (GPU), reducing the power consumption of the electronic device (including reducing the power consumption of the GPU and the display module), etc.
[0140] The preset light source mentioned here refers to the number of light sources, light source types, etc. set according to the game plot requirements in the game scene. When controlling and adjusting the lighting effect, ensure that the number of light sources remains unchanged, that is, the lighting effect required by the original game plot will not be changed.
[0141] For example, when the game is just started, it will be rendered and displayed according to the established parameters. When entering the game scene, it will be adjusted to a low-cost lighting effect according to the need. It should be noted that when adjusting the lighting effect, in order to reduce the difference before and after adjustment, it is necessary to comprehensively determine the target lighting parameters, that is, to maintain the original lighting effect and reduce the lighting cost at the same time. How to determine the required target lighting parameters will be explained through specific embodiments below, and will not be repeated here.
[0142] The low-cost lighting effect mentioned here can be understood as having a lower lighting implementation cost for achieving the same or similar lighting effects. Specifically, on the basis of ensuring the same number of light sources, the lighting range of one or more light sources can be appropriately reduced, so as to reduce the GPU load, power consumption, and power consumption of the display module, etc. To mitigate or avoid the negative impact of reducing the lighting range on the lighting effect (for example, directly affecting the user's game experience), the brightness of one or more light sources can be specifically increased, so as to effectively reduce the visual deviation before and after adjustment, making it difficult for users to notice that the lighting parameters have been adjusted, or even if they can see that the lighting effect has been adjusted, it will not affect the overall user experience. Of course, if the impact on the lighting effect is not obvious after reducing the lighting range of one or more light sources, the brightness of one or more light sources may not be increased.
[0143] There can be various ways to generate the scene lighting control request for reducing the lighting cost mentioned here. For example, in an electronic device, the lighting cost of all light sources in the game can be set to be reduced by default for the game, or the scene lighting control request can be triggered when the user clearly indicates that the game effect (including the lighting cost in the game scene) needs to be reduced. It can also be automatically or manually triggered when the electronic device reaches certain conditions (such as the mobile phone battery level is lower than 50%, the game energy consumption is greater than 10%, the GPU load reaches 80%, and the mobile phone temperature reaches 40°C). The scene lighting control request can also be triggered according to the game plot or game scene. For example, when the number of light sources in the game scene is greater than a certain number threshold (when the number of light sources is greater than 10), when the game plot is a close-up shot (such as highlighting the protagonist), aiming shot, ultimate move confrontation, etc., and the user's attention is not on the game background environment.
[0144] Through the above solution, after receiving the scene lighting control request for reducing the lighting cost in the virtual scene, the lighting control strategy for the preset light source in the virtual scene is further determined. When selecting the lighting parameters, according to the specific lighting control strategy, the target lighting parameters for adjusting the low-cost lighting effect of the preset light source are generated. On the premise of changing or slightly changing the original lighting effect, the lighting implementation cost is significantly reduced, that is, the lighting range is reduced, so as to achieve the purpose of reducing the load of the graphics processing unit (GPU), GPU power consumption, and power consumption of the display module.
[0145] In one or more embodiments of the present application, generating the target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy includes: generating the target lighting parameters for reducing the lighting cost based on a fixed control strategy or a dynamic control strategy, and the target lighting parameters include at least one of an attenuation parameter and a compensation parameter.
[0146] In practical applications, there can be various lighting control strategies, including fixed control strategies and dynamic control strategies. Among them, the fixed control strategy can be understood as the final determined target lighting parameters being fixed and remaining so throughout the game, without any process of gradual adjustment of the lighting effect. The "fixed" here can be absolute fixation, that is, the lighting ranges and lighting intensities of all light sources in the game scene are the same and fixed; it can also be relative fixation, that is, in the game scene, different lighting parameters can be set according to different light source types, and once determined, they will not change during the game process.
[0147] The dynamic control strategy can be understood as the target lighting parameters being adjusted in real time and dynamically, which can be adjusted according to the game plot, according to the load situation, according to the power consumption, and can also be slowly adjusted frame by frame from the original parameters and finally adjusted to the target lighting parameters.
[0148] In the solution of this application, the target lighting parameters include attenuation parameters and compensation parameters. Among them, the role of the attenuation parameter is to adjust the size of the original lighting model (the size of the lighting model is reflected by the range of model vertex coordinates. In other words, if you want to adjust the size of the lighting model, it can be understood as adjusting the coordinates of the vertices of the lighting model), as well as the size of the corresponding initial lighting intensity Uniform parameter value, so as to be able to adjust the size of the lighting range, which is equivalent to shrinking the input, and thus finally changing the computing power, load, and power consumption required for the same lighting effect of the output.
[0149] For example, the size of the model can be changed by performing a scaling operation on the model in the rendering pipeline. Before rendering, multiply the vertex coordinates of the model by a scaling factor to change the size of the model. This will affect both the geometry and the lighting effect of the model at the same time. By scaling the model to change its size, during the rendering process, the GPU needs to calculate and process fewer pixels. A smaller model means a smaller vertex range, thus reducing the amount of data and the amount of calculation that the GPU needs to process. Therefore, the computing power required for rendering will be reduced accordingly.
[0150] Figure 4a It is a schematic diagram of the lighting parameter effect corresponding to a fixed control strategy provided by an embodiment of this application. From Figure 4a it can be seen that before adjustment, the model corresponding to the lamp has a larger range of vertices. After scaling it using the attenuation coefficient, the new model of the lamp obtained has a smaller vertex range. This means that the model size is reduced, and the corresponding GPU rendering workload is also reduced, thus being able to reduce the GPU load, reduce the power consumption, and improve the battery life of the electronic device.
[0151] The compensation parameter mentioned here is used to adjust the brightness level of the light source. Increasing the brightness compensation parameter will make the light source brighter, and decreasing the brightness compensation parameter will make the light source darker. For example, increasing the brightness compensation parameter can increase the brightness value of each pixel by a fixed offset. In practical applications, the adjustment of the compensation parameter is not necessary. If the overall effect of the game is not significantly affected after adjusting the attenuation parameter, the compensation parameter can be left unadjusted. Conversely, if the user can clearly see the adjustment after adjusting the attenuation parameter, and it even affects the user's gaming experience, then the compensation parameter needs to be adjusted to reduce the negative impact on the overall game display effect caused by adjusting the attenuation parameter.
[0152] It should be noted that the compensation parameter is to make up for the negative impact brought by the attenuation parameter. Therefore, when determining the target lighting parameter, it is necessary to first determine the attenuation parameter, and then further determine the appropriate compensation parameter that can make up for the negative impact brought by the attenuation parameter according to the influence of the attenuation parameter on the lighting effect. When the attenuation parameter is a dynamically adjustable parameter, the corresponding compensation parameter also needs to be adjusted dynamically. The specific adjustment method will be described in detail in the following embodiments and will not be repeated here.
[0153] Based on the foregoing embodiments, generating the target lighting parameter for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy includes:
[0154] When the determined lighting control strategy is a fixed control strategy, intercept the lighting rendering instruction;
[0155] Based on the lighting rendering instruction, determine the number of light sources and / or the type of light source;
[0156] According to the number of light sources and / or the type of light source, generate a fixed attenuation parameter for reducing the lighting range and a fixed compensation parameter for enhancing the lighting brightness.
[0157] The lighting rendering instruction mentioned here is an instruction or function used to implement the lighting effect, which is used to calculate the lighting intensity and color on the surface of objects in the scene to simulate the lighting effect in the real world. The role of the lighting rendering instruction is to determine the brightness, reflection, refraction and other optical effects on the object surface, so as to make the rendering result more realistic. The lighting rendering instruction usually includes lighting model parameters, light source parameters, etc. Among them, the lighting model refers to a three-dimensional model composed of a bunch of coordinate vertices. For example, the physical model of lighting drawing is divided into spherical, conical, hemispherical, cylindrical, etc. from 3D features. Therefore, the accurate description should be the Mesh model of the light source, and the attenuation in the solution is also adjusted according to the corresponding size of the three-dimensional Mesh model. The lighting attenuation coefficient is the change coefficient applied to the Mesh model and the lighting intensity. Because the lighting is attenuated from the final effect, it can reduce the GPU load and power consumption.
[0158] Light source parameters are used to describe attributes such as the type, position, color, and intensity of a light source. The type of light source can be different types such as a point light source, a directional light source, or a spot light. By adjusting the parameters of the light source, the direction, intensity, range, brightness, and color of the illumination can be changed, thereby affecting the illumination effect on the object surface. Among them, the illumination range and the number of light sources have a relatively obvious impact on the graphics processor load.
[0159] In addition, the illumination model can also be the Lambert illumination model, the Blinn-Phong illumination model, the Phong illumination model, etc. These models define the calculation methods for effects such as light attenuation, diffuse reflection, and specular reflection. Correspondingly, the attenuation parameter is used to simulate the attenuation effect of light during propagation. The light will gradually weaken at positions farther away from the light source, and the attenuation parameter controls the way and degree of this attenuation. The attenuation parameter is usually related to the type and intensity of the light source and is used to calculate the attenuation coefficient of the light during propagation. The attenuation coefficient represents the degree to which the light intensity weakens as the distance increases. Common attenuation models include linear attenuation, quadratic attenuation, and inverse-square attenuation. By adjusting the value of the attenuation parameter, the attenuation degree of the light during propagation can be controlled, that is, it can be used to adjust the size of the illumination range of the light source. During the rendering process of the same light source, the larger the illumination range, the greater the GPU load and power consumption, and the smaller the illumination range, the smaller the GPU load and power consumption. Therefore, a low-cost illumination effect can be achieved by adjusting or selecting an appropriate attenuation parameter, that is, reducing the illumination cost.
[0160] The attenuation coefficient corresponding to the above illumination model is used to simulate the effect of the light gradually weakening during propagation. It determines the rate at which the light attenuates as the distance increases, thereby affecting the illumination intensity received by the object surface. The illumination attenuation coefficient is usually calculated using a formula, and the two most common methods are linear attenuation and quadratic attenuation.
[0161] For example, linear attenuation: Linear attenuation is the simplest attenuation method, which assumes that the intensity of the light is linearly related to the distance. Determining the specific value of the illumination attenuation coefficient usually requires adjustment according to the actual requirements of the scene and the characteristics of the light source. A larger attenuation coefficient will cause the light to attenuate faster at a shorter distance, while a smaller attenuation coefficient will allow the light to propagate farther. By adjusting the attenuation coefficient, the illumination range can be controlled to achieve the desired illumination effect. The attenuation coefficient can be calculated using the following formula:
[0162] Attenuation=1 / (Constant+Linear*Distance)
[0163] Among them, Constant, Linear, and Distance are the constant, linear term, and distance respectively. Constant is used to control the constant attenuation part, Linear is used to control the linear attenuation part, and Distance represents the propagation distance of light. Therefore, at least one parameter in the above calculation formula can be adjusted according to actual needs. For example, the Distance distance parameter is multiplied by the reciprocal of the number of light sources (1 / N, where N represents the number of light sources), thereby narrowing the illumination range. In addition, the type of light source can also be considered. For example, a point light source can be multiplied by twice the reciprocal of the number of light sources, and other light sources can be multiplied by the reciprocal of the number of light sources. In practical applications, adjustments can be made according to needs. Here, it is only for illustrative purposes and does not constitute a limitation to the technical solution of this application. Generally speaking, the more the number of light sources, the more obvious the reduction of the illumination range.
[0164] Such as Figure 4b is a schematic diagram of the effect of the illumination parameters corresponding to another fixed control strategy provided by the embodiment of the present application. As can be seen from Figure 4b , the illumination range is represented by the length of the light ray, and the brightness of the light is represented by the thickness of the light ray. In the current game screen, there are virtual characters and a virtual background environment. In the virtual background environment, buildings can be seen, and multiple lighting fixtures are hung on the buildings. Before adjusting the illumination parameters, the illumination ranges of each fixture are relatively large, and the illumination ranges of each fixture overlap. After adjusting the illumination parameters, the illumination ranges of each fixture are relatively small, and there is no intersection between the illumination ranges of adjacent fixtures. At the same time, as can also be seen from Figure 4b , the brightness before adjustment is relatively low (that is, Figure 4b the light ray lines in Figure 4b are thinner), and the brightness increases after adjustment (that is,
[0165] such as Figure 5 is a schematic diagram of the effect of the illumination parameters corresponding to yet another fixed control strategy provided by the embodiment of the present application. As can be seen from Figure 5 , in the current game screen, there are virtual characters and a virtual background environment. In the virtual background environment, buildings can be seen, and multiple lighting fixtures are hung on the buildings. Before adjusting the illumination parameters, the illumination ranges of each fixture are relatively large, and the illumination ranges of each fixture overlap. After adjusting the illumination parameters, the illumination ranges of multiple fixtures are adjusted at intervals. The illumination ranges of the adjusted fixtures are relatively small, and there is no intersection between the illumination ranges of adjacent fixtures. At the same time, as can also be seen from Figure 5 the brightness before adjustment is relatively low (that is, Figure 5 the light ray lines in Figure 5 are thicker).
[0166] Through the above solution, the target lighting parameters finally determined based on the number of light sources and / or the type of light sources can adjust the lighting range, effectively reduce the load and power consumption of the graphics processor, and thus effectively achieve a low-cost lighting effect. In addition, the target lighting parameters in the above embodiments are fixed and do not need to be adjusted during the game, which can effectively reduce the lighting rendering frequency and the amount of calculation.
[0167] In one or more embodiments of the present application, as Figure 6 is a schematic flowchart of a method for determining target lighting parameters based on a dynamic lighting control strategy provided by an embodiment of the present application. As can be seen from Figure 6 it, generating target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy includes:
[0168] Step 601: When the determined lighting control strategy is a dynamic control strategy, intercept the lighting rendering instruction and obtain the device operating parameters.
[0169] Step 602: Based on the lighting rendering instruction and the device operating parameters, generate a dynamic attenuation parameter for reducing the lighting range and a dynamic compensation parameter for enhancing the lighting brightness.
[0170] Among them, the specific implementation process of generating a dynamic attenuation parameter for reducing the lighting range and a dynamic compensation parameter for enhancing the lighting brightness in step 602 based on the lighting rendering instruction and the device operating parameters includes:
[0171] Step 6021: Based on the lighting rendering instruction, determine the number of light sources and / or the type of light sources.
[0172] Step 6022: Obtain the operating parameters of the graphics processor and collect the device temperature parameters using a sensor.
[0173] Step 6023: Based on the number of light sources and / or the type of light sources, the operating parameters of the graphics processor, and the device temperature parameters, generate the dynamic attenuation parameter and the dynamic compensation parameter.
[0174] The lighting rendering instructions mentioned here are instructions or functions used to achieve lighting effects, which are used to calculate the lighting intensity and color on the surface of objects in a scene to simulate the lighting effects in the real world. The role of the lighting rendering instructions is to determine the brightness, reflection, refraction and other optical effects on the surface of objects, so that the rendering results are more realistic. Lighting rendering instructions usually include lighting model parameters, light source parameters, etc. Among them, the lighting model parameters are used to describe the way light interacts with the object surface. Common lighting models include the Lambert lighting model, the Blinn-Phong lighting model, and the Phong lighting model, etc. These models define the calculation methods for effects such as light attenuation, diffuse reflection, and specular reflection.
[0175] Light source parameters are used to describe the properties of the light source, such as the type, position, color, and intensity of the light source. The light source type can be different types such as point light source, parallel light source, or spotlight. By adjusting the parameters of the light source, the direction, intensity, range, brightness, and color of the light can be changed, thereby affecting the lighting effect on the object surface. Among them, the lighting range and the number of light sources have a relatively obvious impact on the graphics processor load.
[0176] The light attenuation coefficient is used to simulate the effect of light gradually weakening during propagation. It determines the rate at which light attenuates as the distance increases, thereby affecting the lighting intensity received by the object surface. The light attenuation coefficient is usually calculated using a formula, and the most common are the linear attenuation and quadratic attenuation methods.
[0177] For example, linear attenuation: Linear attenuation is the simplest attenuation method, which assumes that the intensity of the light is linearly related to the distance. Determining the specific value of the light attenuation coefficient usually requires adjustment according to the actual needs of the scene and the characteristics of the light source. A larger attenuation coefficient will cause the light to attenuate faster at a shorter distance, while a smaller attenuation coefficient will allow the light to travel farther. By adjusting the attenuation coefficient, the lighting range can be controlled to achieve the desired lighting effect. The attenuation coefficient can be calculated using the following formula:
[0178] Attenuation=1 / (Constant+Linear*Distance)
[0179] Among them, Constant, Linear, and Distance are the constant, linear term, and distance respectively. Constant is used to control the constant attenuation part, Linear is used to control the linear attenuation part, and Distance represents the propagation distance of light. Therefore, at least one parameter in the above calculation formula can be adjusted according to actual needs. For example, the Distance distance parameter is multiplied by the reciprocal of the number of light sources (1 / N, where N represents the number of light sources), thereby narrowing the illumination range. In addition, the type of light source can also be considered. For example, a point light source can be multiplied by the reciprocal of twice the number of light sources, and other light sources can be multiplied by the reciprocal of the number of light sources. In practical applications, it can be adjusted according to needs. Here, it is only for illustrative purposes and does not constitute a limitation on the technical solution of this application. Generally speaking, the more the number of light sources, the more obvious the reduction of the illumination range.
[0180] Furthermore, the influence of device operating parameters is also considered. Specifically, the GPU utilization rate (for example, the GPU utilization rate reaches 70%) can be used as the coefficient for multiplying the Distance distance parameter, and the device temperature parameter can also be used as the coefficient for multiplying the Distance distance parameter. For example, when the device temperature parameter is 30°C, the corresponding coefficient is 1, and when it is 40°C, the corresponding coefficient is 1.5, etc. Here, it is only for illustrative purposes. In practical applications, it can be adaptively adjusted according to needs and the attenuation coefficient calculation formula. It should be noted that the more the number of light sources, the more the illumination range is reduced; the higher the GPU utilization rate, the more the illumination range is reduced; the higher the device temperature parameter, the more the illumination range is reduced.
[0181] Such as Figure 7 is a schematic diagram of the effect of the illumination parameters corresponding to the dynamic control strategy provided by the embodiment of this application. From Figure 7 it can be seen that there are virtual characters and a virtual background environment displayed in the current game screen. In the virtual background environment, buildings can be seen, and there are multiple lighting fixtures hanging on the buildings. Before adjusting the illumination parameters, the illumination ranges of each fixture are relatively large, and the illumination ranges of each fixture overlap with each other. During the process of adjusting the illumination parameters, it is adjusted in multiple frames. In each frame, the illumination range is reduced a little, and at the same time, the illumination brightness is increased a little, gradually adjusting the illumination range so that the illumination ranges of each fixture are relatively small, and there is no intersection between the illumination ranges of adjacent fixtures, and at the same time, the illumination brightness reaches the expected standard.
[0182] It should be noted that in addition to the device temperature parameter and the graphics processor operating parameters (GPU load, utilization rate, temperature) mentioned above, the device operating parameters can also include parameters such as game power consumption and remaining battery power of the electronic device.
[0183] Through the above solution, the target lighting parameters determined based on the number and / or type of light sources, as well as the graphics processor load, device temperature parameters, etc. can achieve the adjustment of the lighting range, effectively reduce the load and power consumption of the graphics processor, and thus effectively achieve a low-cost lighting effect. In addition, the target lighting parameters in the above embodiments are dynamically changed, which can effectively reduce the impact of lighting parameter adjustment on the lighting effect, making the adjustment process less noticeable to users and not affecting the user's gaming experience.
[0184] Next, how to determine the dynamic attenuation parameter and the dynamic compensation parameter will be specifically described. Generating the dynamic attenuation parameter and the dynamic compensation parameter based on the number and / or type of light sources, the graphics processor working parameters, and the device temperature parameters includes: determining the weight coefficients corresponding to the number of light sources and / or the type of light source, the graphics processor working parameters, and the device temperature parameters respectively; obtaining the total weight value based on the sum of each of the weight coefficients; and selecting the dynamic attenuation parameter and the dynamic compensation parameter from a preset lighting parameter table according to the total weight value.
[0185] There are many factors affecting the lighting parameters, including GPU load, GPU frequency, device temperature parameters, and the number of real-time light sources. Among them, the GPU load and device temperature parameters are external input factors, and the number of real-time light sources is obtained by counting through the rendering instruction interception method. Each influencing factor has a fixed weight coefficient kn. Multiply the values of all N influencing factors by the corresponding weight coefficient kn and accumulate them to obtain the total weight value R.
[0186] In the algorithm, M different attenuation and compensation coefficient levels are preset in advance. At the same time, a lighting parameter table is also preset for different levels. According to the size of the total weight value R, select different coefficient levels by looking up the table, and change the attenuation and compensation coefficient values in effect for the current solution in real time. The algorithm performs a dynamic decision calculation process every fixed N frames.
[0187] Since there are significant differences in the coefficient values between different gears, switching the scenario coefficients in real time during the game will cause sudden changes in the lighting effect, reducing the user's gaming experience. Therefore, in the implementation of the coefficient scheme for dynamic decision-making, a switching method with gradual coefficient change is introduced. Specifically, according to a preset gradual change slope (fixed value / N frames), the difference between the currently used lighting parameters and the target lighting parameters is calculated. Then, the difference is divided by the gradual change slope to obtain the number of frames for gradual change. In each frame, the difference is divided by the number of frames for gradual change to obtain the step size for gradual change, and then the coefficient is gradually increased by the step size for gradual change in each frame until the target lighting parameters are reached. In this way, an adaptive gradual adjustment of the lighting effect is achieved. According to multiple influencing factors and corresponding weight coefficients in the system, a threshold coefficient is calculated to select an appropriate gear for attenuation and compensation. To avoid sudden changes in the lighting effect, a switching method with gradual coefficient change is introduced, and the coefficient value is gradually adjusted in each frame to achieve smooth transition and adaptive adjustment of the lighting effect. This can improve the user's gaming experience and ensure the continuity and stability of the lighting effect in different scenarios.
[0188] After determining the dynamic attenuation parameter, the dynamic compensation parameter can be further determined, specifically including: when the dynamic attenuation parameter is less than the first threshold, a compensation parameter greater than the first threshold corresponding to the attenuation parameter is generated, so as to use the compensation parameter to increase the brightness of the light source, and the increased brightness of the light source is not greater than the brightness entering the virtual scene.
[0189] For example, when the light attenuation coefficient is less than 1, a compensation coefficient is usually introduced. This compensation coefficient is a value greater than 1 and corresponding to the attenuation coefficient. The compensation coefficient is multiplied by the RGB values of the light source respectively to increase the overall brightness of the light source. The purpose of this is to compensate for the light effect after the attenuation coefficient is adjusted by the foregoing solution, reduce the brightness difference between the overall game screen and the original screen after the solution, and thus improve the picture quality experience. Specifically, when the light attenuation coefficient is less than 1, it means that the light will gradually weaken during propagation, the light propagation distance becomes shorter, and the range becomes smaller. In order to maintain the brightness balance of the screen, a compensation coefficient needs to be introduced to increase the brightness of the light source. This can make up for the brightness loss caused by the attenuation effect and ensure that the brightness between the screen after the solution is processed and the original screen is consistent. By multiplying the compensation coefficient by the RGB values of the light source, the brightness of the entire light source can be increased, so as to achieve the effect of compensating for the light after attenuation. This compensation can reduce the brightness difference between the overall game screen and the original screen after the solution, improve the picture quality experience, and enable players to obtain a more realistic and comfortable visual experience in the game. By introducing the compensation coefficient and multiplying it by the RGB values of the light source, the light after attenuation by the solution can be compensated for its effect when the light attenuation coefficient is less than 1, so as to reduce the picture brightness difference and improve the picture quality experience. This compensation mechanism can ensure the overall brightness consistency of the game screen under different lighting conditions and provide better visual effects.
[0190] In one or more embodiments of the present application, after intercepting the light rendering instruction, it further includes: determining light model parameters based on the light rendering instruction; creating a copy of the light model based on the light model parameters, so as to execute the light rendering task using the copy of the light model.
[0191] In order to determine the light model parameters, it is first necessary to select a light model suitable for the current application scenario. Common light models include the classic Phong model, Blinn-Phong model, Lambert model, etc. Each light model has a set of parameters for defining the calculation method and characteristics of the light effect.
[0192] After determining the light model parameters, a copy of the light model can be created. The copy of the light model is an instance based on the light model parameters and is used to execute the light rendering task. By using the copy of the light model, the light model can be modified and adjusted during the rendering process to achieve different light effects.
[0193] The copy of the light model can be used to execute various light rendering tasks, such as real-time rendering, offline rendering, game rendering, etc. According to specific application requirements, the parameters of the copy of the light model can be set, the light source can be configured, and the material properties can be adjusted to achieve the required light effect.
[0194] Determining the lighting model parameters is to select a lighting model suitable for the application scenario and define its parameters. Creating a copy of the lighting model is an instance based on the lighting model parameters and is used to perform the lighting rendering task. The copy of the lighting model can be parameter - set and adjusted according to requirements to achieve the desired lighting effect.
[0195] There are two ways to perform the lighting rendering task on the preset light source based on the target lighting parameters. One is by using the method of model replacement and parameter replacement, specifically including:
[0196] Using the target lighting parameters to replace the historical lighting parameters in the copy of the lighting model;
[0197] Binding the copy of the lighting model based on the rendering instruction;
[0198] Performing the lighting rendering task on the preset light source based on the copy of the lighting model.
[0199] Replacing the historical lighting parameters in the copy of the lighting model: According to the target lighting parameters, replace the historical lighting parameters in the copy of the lighting model. This can ensure that the copy of the lighting model uses the latest lighting parameters for rendering.
[0200] The historical lighting parameters mentioned here can be understood as the original lighting parameters in the copy of the lighting model. When using the original lighting parameters to perform the lighting rendering task, the power consumption is relatively high and the GPU load is relatively high. Therefore, it is necessary to replace the historical lighting parameters in the copy of the lighting model with the target lighting parameters.
[0201] When binding the copy of the lighting model based on the rendering instruction, before drawing, when the game uses the glBindBuffer instruction to bind the copy of the light source model, that is, by saving the corresponding relationship between the native model and the copy model before, replace the native lighting model ID bound in the rendering instruction with the ID of the copy of the lighting model, so as to use the lighting parameters of the copy of the lighting model for calculation during the rendering process, and then realize the adjustment of the lighting range of each light source in the game scene and reduce the lighting cost.
[0202] Through the above - mentioned scheme, the target lighting parameters can be used to replace the historical lighting parameters in the copy of the lighting model to ensure that the copy of the lighting model uses the latest parameters for rendering. At the same time, bind the copy of the lighting model with the rendering instruction to ensure that the rendering instruction uses the correct lighting model for lighting calculation. Finally, based on the copy of the lighting model and the preset light source, perform the lighting rendering task to achieve the desired lighting effect.
[0203] The other is during the code execution process, performing the rendering task through the shader program, specifically including:
[0204] Convert the target light parameter into a code parameter executable by the shader;
[0205] After adjusting the historical lighting model and historical lighting parameters in the shader using the code parameter, perform the lighting rendering task for the preset light source.
[0206] In practical applications, in addition to handling the replacement of the lighting model and lighting parameters, the lighting effect can also be adjusted in the shader to reduce the lighting cost. After obtaining the target light parameter using the above solution, it is further converted into a code parameter that can be received and executed by the shader. Input this code parameter into the shader,
[0207] For example, inside the Shader shader, the model and Uniform parameters can be adjusted by identifying, modifying, and replacing the source code during the compilation process. This can be achieved by modifying arrays such as model input and Uniform parameter input at the initial position of the main function in the shader code.
[0208] Specifically, in the main function of the shader code, numerical scaling of the product of the attenuation compensation coefficient can be performed on the model input and Uniform parameter input. This means multiplying the original model data and Uniform parameters by the attenuation compensation coefficient to change their values, thereby affecting the lighting effect.
[0209] For example, numerical scaling can be achieved by adding logic similar to the following in the code in the main function:
[0210]
[0211] In the above code, attenuationFactor represents the attenuation compensation coefficient, which can be adjusted as needed. By multiplying the model position and Uniform parameters by the attenuation compensation coefficient, numerical scaling can be performed on them, thereby changing the lighting effect.
[0212] In one or more embodiments of the present application, in response to a scene lighting control request in a virtual scene, determine a lighting control strategy for a preset light source in the virtual scene, including: if a scene lighting control request for reducing the lighting cost triggered by the user is received, or a scene lighting control request for reducing the lighting cost triggered by the preset default is read, then determine whether to select the default configuration according to the local configuration file; if so, determine the lighting control strategy as a fixed control strategy; if not, determine the lighting control strategy as a dynamic control strategy.
[0213] In practical applications, there are various ways to trigger a scene lighting control request. It can be triggered based on the default settings in the configuration file, that is, as long as the game is launched, the request is automatically triggered. It can also be selectively triggered manually by the user according to actual needs. For example, when the user feels that the mobile phone is getting hot, the request can be triggered. Of course, it can also be triggered when certain conditions of the electronic device are detected. For example, when it is detected that the CPU load reaches 80%, the request is triggered; when the temperature of the electronic device reaches 40 degrees Celsius, the request is triggered. It can also be selectively triggered according to the game plot. When the game plot contains a number of light sources greater than a certain threshold, such as greater than 5, the request is triggered; when the game plot is in a close-up state, aiming state or ultimate move confrontation state, the request can also be triggered.
[0214] When selecting a lighting control strategy, it can be selected according to the configuration content in the game's configuration file. For example, in some games, the lighting effect can be configured as a fixed control strategy in the configuration file, and in some games, the lighting effect can be configured as a dynamic control strategy in the configuration file. It should be noted that the configuration file can be modified as needed. For example, the user wants to modify it, or it is modified according to the status of the electronic device.
[0215] In some of the processes described in the above embodiments and the accompanying drawings, multiple operations appear in a specific order. However, it should be clearly understood that these operations can be executed not in the order in which they appear in this article or in parallel. The operation numbers such as 401, 402, etc. are only used to distinguish different operations, and the numbers themselves do not represent any execution order. In addition, these processes can include more or fewer operations, and these operations can be executed in sequence or in parallel. It should be noted that the descriptions such as "first" and "second" in this article are used to distinguish different messages, devices, modules, etc., and do not represent a sequence, nor do they limit that "first" and "second" are of different types.
[0216] Figure 8 The figure is a schematic structural diagram of a lighting control device provided by an exemplary embodiment of the present application. As Figure 8 shown, the device includes:
[0217] A determination module 81, configured to determine a lighting control strategy for a preset light source in the virtual scene in response to a scene lighting control request for reducing lighting costs in the virtual scene.
[0218] A generation module 82, configured to generate target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy.
[0219] An execution module 83, configured to execute a lighting rendering task for the preset light source by using the target lighting parameters.
[0220] Optionally, a generation module 82 is configured to generate the target illumination parameters for reducing the illumination cost based on a fixed control strategy or a dynamic control strategy, where the target illumination parameters include at least one of an attenuation parameter and a compensation parameter.
[0221] Optionally, when the determined illumination control strategy is a fixed control strategy, the generation module 82 is configured to intercept an illumination rendering instruction;
[0222] Based on the illumination rendering instruction, determine the number of light sources and / or the type of light sources;
[0223] According to the number of light sources and / or the type of light sources, generate a fixed attenuation parameter for reducing the illumination range and a fixed compensation parameter for enhancing the illumination brightness.
[0224] Optionally, when the determined illumination control strategy is a dynamic control strategy, the generation module 82 is configured to intercept an illumination rendering instruction and obtain device operating parameters;
[0225] Based on the illumination rendering instruction and the device operating parameters, generate a dynamic attenuation parameter for reducing the illumination range and a dynamic compensation parameter for enhancing the illumination brightness.
[0226] Optionally, the generation module 82 is configured to determine the number of light sources and / or the type of light sources based on the illumination rendering instruction;
[0227] Obtain the operating parameters of the graphics processing unit and collect the device temperature parameter using a sensor;
[0228] Based on the number of light sources and / or the type of light sources, the operating parameters of the graphics processing unit, and the device temperature parameter, generate the dynamic attenuation parameter and the dynamic compensation parameter.
[0229] Optionally, the generation module 82 is configured to determine the weight coefficients corresponding to the number of light sources and / or the type of light sources, the operating parameters of the graphics processing unit, and the device temperature parameter respectively;
[0230] Based on the total weight value obtained by summing up each of the weight coefficients;
[0231] Select the dynamic attenuation parameter and the dynamic compensation parameter from a preset illumination parameter table according to the total weight value.
[0232] Optionally, a determination module 81 is configured to determine the dynamic compensation parameter, specifically including:
[0233] When the dynamic attenuation parameter is less than a first threshold, a compensation parameter greater than the first threshold corresponding to the attenuation parameter is generated, so as to use the compensation parameter to increase the brightness of the light source, and the increased brightness of the light source is not greater than the brightness entering the virtual scene.
[0234] Optionally, a determination module 81, configured to determine lighting model parameters based on the lighting rendering instruction;
[0235] Based on the lighting model parameters, a lighting model copy is created, so as to use the lighting model copy to execute the lighting rendering task.
[0236] Optionally, an execution module 83, configured to replace historical lighting parameters in the lighting model copy with the target lighting parameters;
[0237] Bind the lighting model copy based on the rendering instruction;
[0238] Execute a lighting rendering task on the preset light source based on the lighting model copy.
[0239] Optionally, a centroid module 83, configured to convert the target lighting parameters into code parameters executable by a shader;
[0240] After adjusting the historical lighting model and historical lighting parameters in the shader by using the code parameters, execute a lighting rendering task on the preset light source.
[0241] Optionally, a determination module 81, configured to, if receiving a scene lighting control request for reducing lighting cost triggered by a user, or reading a preset default triggered scene lighting control request for reducing lighting cost, determine whether to select a default configuration according to a local configuration file; if so, determine the lighting control strategy as a fixed control strategy; if not, determine the lighting control strategy as a dynamic control strategy.
[0242] The internal functions and structures of the lighting control device are described above, as Figure 9 is a schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application. In practice, the lighting control device may be implemented as an electronic device, including: a memory 91, a processor 92, and a communication component 93.
[0243] The memory 91 is used to store computer programs and may be configured to store various other data to support operations on the electronic device. Examples of these data include instructions for any application program or method for operating on the electronic device, contact data, phone book data, messages, pictures, videos, etc.
[0244] The memory 91 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0245] The processor 92, coupled to the memory 91, is configured to execute a computer program in the memory 91 for:
[0246] In response to a scene lighting control request for reducing lighting cost in a virtual scene, determining a lighting control strategy for a preset light source in the virtual scene;
[0247] Based on the lighting control strategy, generating target lighting parameters for adjusting a low-cost lighting effect of the preset light source;
[0248] Performing a lighting rendering task on the preset light source by using the target lighting parameters.
[0249] The processor 92 is configured to generate the target lighting parameters for reducing lighting cost based on a fixed control strategy or a dynamic control strategy, and the target lighting parameters include at least one of an attenuation parameter and a compensation parameter.
[0250] When the determined lighting control strategy is a fixed control strategy, the processor 92 is configured to intercept a lighting rendering instruction;
[0251] Based on the lighting rendering instruction, determining the number of light sources and / or the type of light sources;
[0252] According to the number of light sources and / or the type of light sources, generating a fixed attenuation parameter for reducing the lighting range and a fixed compensation parameter for enhancing the lighting brightness.
[0253] When the determined lighting control strategy is a dynamic control strategy, the processor 92 is configured to intercept a lighting rendering instruction and obtain device operating parameters;
[0254] Based on the lighting rendering instruction and the device operating parameters, generating a dynamic attenuation parameter for reducing the lighting range and a dynamic compensation parameter for enhancing the lighting brightness.
[0255] The processor 92 is configured to determine the number of light sources and / or the type of light sources based on the lighting rendering instruction;
[0256] Obtaining graphics processor operating parameters and collecting device temperature parameters by using a sensor;
[0257] Generate the dynamic attenuation parameter and the dynamic compensation parameter based on the number and / or type of the light sources, the operating parameters of the graphics processor, and the device temperature parameter.
[0258] The processor 92 is configured to determine the weight coefficients corresponding to the number and / or type of the light sources, the operating parameters of the graphics processor, and the device temperature parameter respectively.
[0259] Based on the total weight value obtained by summing up each of the weight coefficients.
[0260] Select the dynamic attenuation parameter and the dynamic compensation parameter from a preset illumination parameter table according to the total weight value.
[0261] When the dynamic attenuation parameter is less than a first threshold, the processor 92 is configured to generate a compensation parameter greater than the first threshold corresponding to the attenuation parameter, so as to use the compensation parameter to increase the brightness of the light source, and the brightness of the light source after the increase is not greater than the brightness entering the virtual scene.
[0262] The processor 92 is configured to determine the illumination model parameters based on the illumination rendering instruction.
[0263] Create a copy of the illumination model based on the illumination model parameters, so as to perform the illumination rendering task using the copy of the illumination model.
[0264] The processor 92 is configured to replace the historical illumination parameters in the copy of the illumination model with the target illumination parameters.
[0265] Bind the copy of the illumination model based on the rendering instruction.
[0266] Perform the illumination rendering task on the preset light source based on the copy of the illumination model.
[0267] The processor 92 is configured to convert the target illumination parameters into code parameters executable by the shader.
[0268] After adjusting the historical illumination model and the historical illumination parameters in the shader using the code parameters, perform the illumination rendering task on the preset light source.
[0269] If the processor 92 receives a scene illumination control request for reducing the illumination cost triggered by the user, or reads a preset default-triggered scene illumination control request for reducing the illumination cost, it determines whether to select the default configuration according to the local configuration file.
[0270] If so, determine that the illumination control strategy is a fixed control strategy.
[0271] If not, determine that the illumination control strategy is a dynamic control strategy.
[0272] Further, as Figure 9 shown, the electronic device further includes: other components such as a communication component 93, a display 94, a power supply component 95, an audio component 96, etc. Figure 9 Only some components are schematically shown in Figure 9 the figure, which does not mean that the electronic device only includes
[0273] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed, it can implement the steps executable by the electronic device in the above method embodiment.
[0274] The above Figure 9 The communication component is configured to facilitate communication between the device where the communication component is located and other devices in a wired or wireless manner. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G / LTE, 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0275] The above Figure 9 The display in the above includes a screen, and the screen can include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes and gestures on the touch panel. The touch sensor can not only sense the boundaries of touch or swipe actions, but also detect the duration and pressure associated with the touch or swipe operation.
[0276] The above Figure 9 The power supply component in the above provides power for various components of the device where the power supply component is located. The power supply component can include a power management system, one or more power supplies, and other components associated with generating, managing and distributing power for the device where the power supply component is located.
[0277] The above Figure 9The audio component therein can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC). When the device where the audio component is located is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive external audio signals. The received audio signals can be further stored in a memory or sent via a communication component. In some embodiments, the audio component further includes a speaker for outputting audio signals.
[0278] For ease of understanding, the implementation process of the technical solution of this application will be described through a specific embodiment. As Figure 10 This is a schematic diagram of the light control process exemplified in the embodiments of this application. From Figure 10 it can be seen that after the game starts, the game configuration file is read. In this configuration file, it is set whether to trigger a scene light control request for reducing light cost. If it does not take effect by default, the user needs to manually turn it on and make it effective. If the configuration content in the configuration file takes effect by default, the rendering instructions are intercepted and the model data is extracted and saved during the game execution. Furthermore, according to the configuration file, a light control strategy is selected, including a fixed light control strategy and a dynamic light control strategy. Generally, the fixed light control strategy is used as the default configuration content. Based on the selected strategy, the corresponding attenuation coefficient and compensation coefficient are calculated respectively. Further, based on the rendering instructions, the light model is replaced and the target light parameters are replaced. In addition, when executing the dynamic control strategy, it is also necessary to further determine whether to execute at an interval of N frames.
[0279] Those skilled in the art should understand that the embodiments of this application can be provided as a method, a system, or a computer program product. Therefore, this application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0280] This application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of this application. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate for implementing in the process Figure 1 one process or multiple processes and / or blocks Figure 1means for the functions specified in one or more blocks.
[0281] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction means that implements the functions specified in one Figure 1 one or more processes and / or blocks Figure 1 means for the functions specified in one or more blocks.
[0282] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one Figure 1 one or more processes and / or blocks Figure 1 means for the functions specified in one or more blocks.
[0283] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0284] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
[0285] Computer-readable media includes both permanent and non-permanent, removable and non-removable media implemented by any method or technology for storing information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0286] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the phrase "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the said element.
[0287] The above description is only for the embodiments of the present application and is not intended to limit the present application. For those skilled in the art, various modifications and variations can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A lighting control method, characterized in that, the method includes: responding to a scene lighting control request for reducing lighting costs in a virtual scene, and determining a lighting control strategy for a preset light source in the virtual scene; generating target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy; performing a lighting rendering task on the preset light source by using the target lighting parameters.
2. The lighting control method according to claim 1, characterized in that, the generating target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy includes: generating the target lighting parameters for reducing lighting costs based on a fixed control strategy or a dynamic control strategy, and the target lighting parameters include at least one of an attenuation parameter and a compensation parameter.
3. The lighting control method according to claim 2, characterized in that, the generating target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy includes: when the determined lighting control strategy is a fixed control strategy, intercepting a lighting rendering instruction; determining the number of light sources and / or the type of light source based on the lighting rendering instruction; generating a fixed attenuation parameter for reducing the lighting range and a fixed compensation parameter for enhancing the lighting brightness according to the number of light sources and / or the type of light source.
4. The lighting control method according to claim 2, characterized in that, the generating target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy includes: when the determined lighting control strategy is a dynamic control strategy, intercepting a lighting rendering instruction and obtaining device operating parameters; generating a dynamic attenuation parameter for reducing the lighting range and a dynamic compensation parameter for enhancing the lighting brightness based on the lighting rendering instruction and the device operating parameters.
5. The lighting control method according to claim 4, characterized in that, the generating a dynamic attenuation parameter for reducing the lighting range and a dynamic compensation parameter for enhancing the lighting brightness based on the lighting rendering instruction and the device operating parameters includes: determining the number of light sources and / or the type of light source based on the lighting rendering instruction; obtaining the operating parameters of the graphics processor and collecting the device temperature parameters by using a sensor; generating the dynamic attenuation parameter and the dynamic compensation parameter based on the number of light sources and / or the type of light source, the operating parameters of the graphics processor, and the device temperature parameters.
6. The lighting control method according to claim 5, characterized in that, the generating the dynamic attenuation parameter and the dynamic compensation parameter based on the number of light sources and / or the type of light source, the operating parameters of the graphics processor, and the device temperature parameters includes: determining the weight coefficients corresponding to the number of light sources and / or the type of light source, the operating parameters of the graphics processor, and the device temperature parameters respectively; based on the total weight value obtained by summing up each of the weight coefficients; selecting the dynamic attenuation parameter and the dynamic compensation parameter from a preset lighting parameter table according to the total weight value.
7. The lighting control method according to claim 2, wherein, the method for determining the dynamic compensation parameter includes: when the dynamic attenuation parameter is less than a first threshold, generating a compensation parameter greater than the first threshold corresponding to the attenuation parameter, so as to use the compensation parameter to increase the brightness of the light source, and the increased brightness of the light source is not greater than the brightness entering the virtual scene.
8. The lighting control method according to claim 2, wherein, after intercepting the lighting rendering instruction, it further includes: determining lighting model parameters based on the lighting rendering instruction; creating a copy of the lighting model based on the lighting model parameters, so as to use the copy of the lighting model to execute the lighting rendering task.
9. The lighting control method according to claim 8, wherein, the execution of the lighting rendering task on the preset light source using the target lighting parameters includes: replacing the historical lighting parameters in the copy of the lighting model with the target lighting parameters; binding the copy of the lighting model based on the rendering instruction; executing the lighting rendering task on the preset light source based on the copy of the lighting model.
10. The lighting control method according to claim 2, wherein, the execution of the lighting rendering task on the preset light source using the target lighting parameters includes: converting the target lighting parameters into code parameters executable by the shader; after adjusting the historical lighting model and historical lighting parameters in the shader using the code parameters, executing the lighting rendering task on the preset light source.
11. The lighting control method according to claim 1, wherein, in response to a scene lighting control request in the virtual scene, determining a lighting control strategy for a preset light source in the virtual scene, including: if receiving a scene lighting control request for reducing lighting cost triggered by a user, or reading a scene lighting control request for reducing lighting cost triggered by a preset default, then determining whether to select the default configuration according to the local configuration file; if so, determining the lighting control strategy as a fixed control strategy; if not, determining the lighting control strategy as a dynamic control strategy.
12. A lighting control device, wherein, the device includes: a determination module, configured to determine a lighting control strategy for a preset light source in the virtual scene in response to a scene lighting control request for reducing lighting cost in the virtual scene; a generation module, configured to generate target lighting parameters for adjusting the low-cost lighting effect of the preset light source based on the lighting control strategy; an execution module, configured to execute a lighting rendering task on the preset light source using the target lighting parameters.
13. An electronic device, wherein, it includes: a processor and a memory; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, so that the processor executes the method according to any one of claims 1-11.
14. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program or instructions, and when the computer program or instructions are run, the method described in any one of claims 1-11 is implemented.
15. A computer program product, comprising a computer program or instructions, characterized in that when the computer program or instructions are executed by a processor, the method described in any one of claims 1-11 is implemented.
Citation Information
Patent Citations
Object rendering method and device and shader
CN113610955A
Model rendering method and device, computer readable storage medium and electronic equipment
CN116543094A
Compute amortization heuristics for lighting estimation for augmented reality
US20210166437A1