Light effect generation method and electronic device

CN122574152BActive Publication Date: 2026-10-23SHENZHEN LINGDIANLINGYI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611048898.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-15
Publication Date
2026-10-23
Estimated Expiration
2046-07-15

AI Technical Summary

Technical Problem

[0003]本申请的主要目的在于提供一种灯光特效生成方法及电子设备,旨在解决传统的外设产品无法为用户提供较高的使用体验的技术问题

Benefits of technology

在本申请实施例中,将基于用户描述文本和/或游戏特征文本确定用于描述外设产品灯效的初始灯效文本,其中,所述游戏特征文本通过所述外设产品所接入的目标设备的输出画面确定;通过预设优化模型对所述初始灯效文本进行优化得到目标灯效文本;通过所述目标提示词引导预设生成模型生成目标灯效代码数据,其中,所述预设提示词模板至少包括所述外设产品上发光元件的排布信息。即本申请实施例,将通过游戏特征文本和/或用户描述文本确定出初始灯效文本,而游戏特征文本又会基于外设产品所接入的目标设备的输出画面来确定,一方面可以使得初始灯效文本包括用户的主观意愿,另一方案也可以使得初始灯效文本包括外设产品的使用场景。再进一步通过预设优化模型对初始的灯效文本进行优化形成目标灯效文本,避免了灯效文本描述不精确、内容不完整的问题,确保了预设生成模型输入内容的质量,提升生成模型生成代码的准确性和稳定性。最后通过目标灯效文本以及预设提示词模板,引导生成模型生成目标灯效代码数据,其中,提示词模板中嵌入了外设产品发光元件的排布信息,使得目标灯效代码数据与外设产品的硬件结构,也即发光元件的排布相适配,提升目标灯效代码数据所能产生的灯光效果的质量。故本申请以低门槛的方式实现了高质量外设产品的个性化灯效生成,大幅度提升外设产品的使用体验。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122574152B_ABST
    Figure CN122574152B_ABST
Patent Text Reader

Abstract

The application discloses a light effect generation method and an electronic device, and relates to the technical field of computers, which comprises the following steps: determining initial light effect text for describing the light effect of an external product based on user description text and / or game feature text, wherein the game feature text is determined through the output picture of a target device to which the external product is connected; optimizing the initial light effect text through a preset optimization model to obtain target light effect text; constructing a target prompt word based on the target light effect text and a preset prompt word template, and guiding a preset generation model to generate target light effect code data through the target prompt word, wherein the preset prompt word template at least comprises arrangement information of light emitting elements on the external product. Therefore, the application realizes the personalized light effect generation of high-quality external products in a low-threshold manner, and greatly improves the use experience of the external products.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method and electronic device for generating lighting effects. Background Technology

[0002] With the rapid development of computer hardware performance and graphics processing technology, users' demands for personalized and interactive experiences in computer peripherals are increasing. Currently, mainstream peripherals such as keyboards, mice, headphones, and speakers generally integrate programmable LED (Light Emitting Diode) light source systems, capable of presenting basic monochrome backlighting or simple dynamic lighting effects, such as monochrome constant light, breathing gradient, color cycling, and marquee preset modes. However, this traditional approach has the following significant drawbacks: First, lighting effect modes are mostly preset by manufacturers in the firmware, allowing users to switch between only a limited number of fixed effects; second, even though some high-end products offer lighting effect editing functions based on driver software, the operational threshold is high, usually requiring users to manually set the color and time sequence of each LED frame by frame, which is difficult for ordinary users to master and extremely inefficient. Therefore, current traditional peripherals cannot provide users with a high-quality user experience. Summary of the Invention

[0003] The main purpose of this application is to provide a method and electronic device for generating lighting effects, aiming to solve the technical problem that traditional peripheral products cannot provide users with a high level of user experience.

[0004] To achieve the above objectives, this application proposes a method for generating lighting effects, the method comprising: The initial lighting effect text for describing the lighting effect of the peripheral product is determined based on user description text and / or game feature text, wherein the game feature text is determined by the output screen of the target device to which the peripheral product is connected; The initial lighting effect text is optimized using a preset optimization model to obtain the target lighting effect text; Based on the target lighting effect text and the preset prompt word template, a target prompt word is constructed. The target prompt word guides the preset generation model to generate target lighting effect code data. The preset prompt word template includes at least the arrangement information of the light-emitting elements on the peripheral product.

[0005] Optionally, the step of guiding the preset generation model to generate target lighting effect code data through the target prompt word includes: The target prompt word guides the preset generation model to generate candidate lighting effect codes and quantization parameters of the animation corresponding to the candidate lighting effect codes. The quantization parameters include at least an animation sampling constraint that matches the arrangement information. Based on the quantization parameters, the animation corresponding to the candidate lighting effect code is sampled to obtain sampled image data, and lighting effect features are extracted based on the sampled image data. The indicator dimensions of the lighting effect features include at least one of the following: lighting effect animation change amount, lighting effect loop beginning and end difference, lighting effect main body contrast, equivalent brightness coverage, equivalent noise ratio, and lighting effect sampling readability. If the lighting effect features meet the preset lighting effect standards, the candidate lighting effect code will be used as the target lighting effect code data.

[0006] Optionally, after the step of extracting lighting effect features based on the sampled image data, the method includes: If the lighting effect feature does not meet the preset lighting effect standard, the feature difference between the lighting effect feature and the preset lighting effect standard is determined; Based on the feature differences, a new target prompt word is determined, and based on the new target prompt word, the process of guiding the preset generation model to generate candidate lighting effect codes and the quantization parameters of the animations corresponding to the candidate lighting effect codes is returned.

[0007] Optionally, the step of extracting lighting effect features based on the sampled image data includes at least one of the following: When the indicator dimension of the lighting effect feature includes the amount of change in lighting effect animation, the amount of change in lighting effect animation of the sampled image data is determined based on the difference between adjacent frames or adjacent key frames in the sampled image data. When the indicator dimension of the lighting effect feature includes the difference between the beginning and end of the lighting effect cycle, the difference between the first frame image and the last frame image in the sampled image data is extracted to obtain the difference between the beginning and end of the lighting effect cycle in the sampled image data. When the indicator dimension of the lighting effect feature includes the contrast of the main lighting effect, the separation degree between the main pattern and the background in the sampled image data is extracted based on the global brightness information of the sampled image data to obtain the contrast of the main lighting effect in the sampled image data. When the indicator dimension of the lighting effect feature includes equivalent brightness coverage, the proportion of target pixels whose brightness exceeds a preset threshold in the sampled image data is extracted to obtain the equivalent brightness coverage of the sampled image data. When the indicator dimension of the lighting effect feature includes the equivalent noise ratio, the number of isolated pixels in the sampled image data is extracted to obtain the equivalent noise ratio of the sampled image data. The lighting effect variation pattern of the isolated pixel is different from the lighting effect variation pattern of the adjacent pixels of the isolated pixel. When the indicator dimension of the lighting effect feature includes sampling readability, the similarity between the effect pattern and the mapping reconstruction pattern in the sampled image data is extracted to obtain the lighting effect sampling readability of the sampled image data. The mapping reconstruction pattern refers to the pattern obtained by sampling and reconstructing the effect pattern according to the arrangement information.

[0008] Optionally, after the step of guiding the preset generation model to generate target lighting effect code data, the method includes: Generate a lighting effect demonstration animation based on the target lighting effect code data; Based on a lighting effect schematic frame that matches the arrangement of light-emitting elements on the peripheral product, the current lighting display information is extracted from the lighting effect demonstration animation; The system controls the operation of the light-emitting elements on the peripheral product based on the current lighting display information.

[0009] Optionally, after the step of generating a lighting effect demonstration animation based on the target lighting effect code data, the method includes: In response to an interaction with the equivalent schematic box, the position of the equivalent schematic box on the lighting effect demonstration animation is moved, wherein the content covered by the equivalent schematic box at the current position is used to determine the current lighting display information.

[0010] Optionally, the step of generating a lighting effect demonstration animation based on the target lighting effect code data includes: An initial demo animation is generated based on the target lighting effect code data; In response to the adjustment operation of the initial demo animation, the display parameters of the initial demo animation are adjusted to obtain the lighting effect demo animation, wherein the display parameters include at least one of animation speed, background color, and brightness.

[0011] Optionally, the step of determining the initial lighting effect text for describing the lighting effects of peripheral products based on user description text and / or game feature text includes: Obtain the output screen of the target device to which the peripheral product is connected; The current game content information is obtained based on the output screen recognition, wherein the current game content information includes at least one of the following: game character, character status, and game scene; Determine game feature text based on the current game content information; The initial lighting effect text is constructed using the game feature text and / or the received user description text.

[0012] Optionally, the step of optimizing the initial lighting effect text using a preset optimization model to obtain the target lighting effect text includes: The initial lighting effect text and the preset optimization prompt words are input into the preset optimization model, and the initial lighting effect text is optimized by the preset optimization model to obtain candidate lighting effect text; The candidate lighting effect text can be used as the target lighting effect text, or, in response to a user confirmation operation, the candidate lighting effect text can be used as the target lighting effect text, or, in response to a user adjustment operation, the candidate lighting effect text can be adjusted to obtain the target lighting effect text.

[0013] In addition, to achieve the above objectives, this application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the lighting effects generation program is configured to implement the steps of the lighting effects generation method described above.

[0014] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the lighting effect generation method described above.

[0015] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the lighting effects generation method described above.

[0016] One or more technical solutions proposed in this application have at least the following technical effects: In this embodiment, initial lighting effect text for describing the lighting effects of peripheral products is determined based on user description text and / or game feature text. The game feature text is determined by the output screen of the target device to which the peripheral product is connected. The initial lighting effect text is then optimized using a preset optimization model to obtain target lighting effect text. The target prompt word guides a preset generation model to generate target lighting effect code data. The preset prompt word template includes at least the arrangement information of the light-emitting elements on the peripheral product. In other words, this embodiment determines the initial lighting effect text using game feature text and / or user description text, and the game feature text is determined based on the output screen of the target device to which the peripheral product is connected. This allows the initial lighting effect text to include the user's subjective intentions and also includes the usage scenario of the peripheral product. Furthermore, optimizing the initial lighting effect text using a preset optimization model to form the target lighting effect text avoids problems such as inaccurate or incomplete lighting effect text descriptions, ensures the quality of the input content to the preset generation model, and improves the accuracy and stability of the generated code. Finally, the target lighting effect text and preset prompt templates guide the generation model to generate target lighting effect code data. The prompt templates embed the layout information of the peripheral product's light-emitting elements, ensuring the target lighting effect code data matches the peripheral product's hardware structure, i.e., the layout of its light-emitting elements, thus improving the quality of the lighting effects produced by the target lighting effect code data. Therefore, this application achieves high-quality personalized lighting effect generation for peripheral products in a low-barrier manner, significantly improving the user experience of peripheral products. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating the first embodiment of the lighting effects generation method of this application; Figure 2 This is a data flow diagram of a scene in the lighting effects generation method of this application; Figure 3 This is a flowchart illustrating the second embodiment of the lighting effects generation method in this application; Figure 4 This is a flowchart illustrating the third embodiment of the lighting effects generation method in this application; Figure 5 This is a schematic diagram of the layered framework of the lighting effects generation method of this application; Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the lighting effects generation method in this application embodiment.

[0020] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0021] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0022] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0023] With the rapid development of computer hardware performance and graphics processing technology, users' demands for personalized and interactive experiences in computer peripherals are increasing. Currently, mainstream peripherals such as keyboards, mice, headphones, and speakers have generally integrated programmable LED light source systems, capable of presenting basic monochrome backlighting or simple dynamic lighting effects, such as monochrome constant light, breathing gradient, color cycle, and marquee preset modes. However, this traditional approach has the following obvious drawbacks: First, lighting effect modes are mostly preset by manufacturers in the firmware, and users can only switch between a limited number of fixed effects; second, even if some high-end products offer lighting effect editing functions based on driver software, the operation threshold is high, usually requiring users to manually set the color and time sequence of each LED frame by frame, which is difficult for ordinary users to master and extremely inefficient. Therefore, current traditional peripherals cannot provide users with a high-quality user experience.

[0024] The main solution of this application embodiment is as follows: an initial lighting effect text for describing the lighting effect of a peripheral product is determined based on user description text and / or game feature text, and the game feature text is determined through the output screen of the target device to which the peripheral product is connected; the initial lighting effect text is optimized by a preset optimization model to obtain the target lighting effect text; a target prompt word is constructed based on the target lighting effect text and a preset prompt word template, and the target prompt word guides the preset generation model to generate target lighting effect code data, wherein the preset prompt word template includes at least the arrangement information of the light-emitting elements on the peripheral product.

[0025] In this embodiment, the initial lighting effect text is determined through game feature text and / or user description text. The game feature text is further determined based on the output screen of the target device to which the peripheral product is connected. This ensures that the initial lighting effect text includes the user's subjective intentions and also incorporates the usage scenario of the peripheral product. Furthermore, the initial lighting effect text is optimized using a preset optimization model to form the target lighting effect text. This avoids problems such as inaccurate or incomplete lighting effect text descriptions, ensuring the quality of the input content to the preset generation model and improving the accuracy and stability of the generated code. Finally, the target lighting effect text and a preset prompt template guide the generation model to generate target lighting effect code data. The prompt template embeds the arrangement information of the peripheral product's light-emitting elements, ensuring that the target lighting effect code data matches the hardware structure of the peripheral product, i.e., the arrangement of the light-emitting elements, thus improving the quality of the lighting effects produced by the target lighting effect code data. Therefore, this application achieves high-quality personalized lighting effect generation for peripheral products in a low-barrier manner, significantly improving the user experience of peripheral products.

[0026] It should be noted that the executing entity in this embodiment can be a device with data processing, network communication and program execution functions, such as a computer, peripheral products, cloud services, etc., or an electronic device capable of realizing the above functions.

[0027] Reference Figure 1 This is a flowchart illustrating the first embodiment of the lighting effects generation method of this application. In this embodiment, the lighting effects generation method includes steps S10 to S30: Step S10: Determine the initial lighting effect text for describing the lighting effect of the peripheral product based on the user description text and / or game feature text, wherein the game feature text is determined by the output screen of the target device to which the peripheral product is connected; It should be noted that the aforementioned peripheral products typically refer to devices connected to the target device (computer or computer), such as keyboards, mice, headphones, and speakers. Optionally, the lighting effect generation method can be applied to the device to which the peripheral product is connected, or it can be applied to the peripheral product itself. The initial lighting effect text can be determined based on pre-set text or text input by the user in natural language, and is a text used to describe the desired lighting effect style or content. Alternatively, the initial lighting effect text can also be determined through game feature text, which can be obtained through semantic recognition of the output screen of the target device to which the peripheral product is connected, thus making the initial lighting effect text closely related to the usage scenario of the peripheral product.

[0028] For example, in this embodiment, the initial lighting effect text is first obtained. For instance, the natural language description entered or selected by the user can be used as the initial lighting effect text, or it can be obtained from other information sources, such as the text description converted from the game screen content recognition result, i.e., the aforementioned game feature text. When both user description text and game feature text exist simultaneously, the initial lighting effect text can be obtained by concatenating or fusing the user description text and the game feature text.

[0029] Step S20: Optimize the initial lighting effect text using a preset optimization model to obtain the target lighting effect text; It should be noted that the aforementioned pre-optimized model refers to a large-scale language model that has been pre-trained or fine-tuned, possessing capabilities such as text understanding, semantic rewriting, and style transfer.

[0030] For example, after obtaining the initial lighting effect text, the text is input into a preset optimization model. The preset optimization model performs operations such as semantic parsing, keyword extraction, ambiguity resolution, and expression standardization on the initial lighting effect text, and outputs the optimized target lighting effect text. Optionally, the optimization process may involve identifying and supplementing implicit but not explicitly expressed lighting effect elements (such as color, direction of movement, speed, rhythm, etc.) in the user description; it may also involve converting colloquial or vague expressions into lighting effect descriptions that are structurally clear, semantically explicit, and richer in detail.

[0031] Understandably, optimizing the initial lighting effect text through a preset optimization model can enable the subsequent generation model to obtain clearer, more complete, and more structured input, thereby improving the accuracy and stability of lighting effect code generation and reducing generation failures or deviations from expectations due to inaccurate user input.

[0032] Step S30: Construct target prompt words based on target lighting effect text and preset prompt word template, and guide the preset generation model to generate target lighting effect code data through target prompt words. The preset prompt word template includes at least the arrangement information of light-emitting elements on peripheral products.

[0033] It should be noted that, in this embodiment, peripheral products typically have light-emitting elements, which can be LEDs. These LEDs can change color and brightness according to control signals. The aforementioned preset prompt template is mainly used to guide the preset generation model to generate target lighting effect code data that meets expectations. The preset prompt template includes at least the arrangement information of the light-emitting elements on the peripheral product. Arrangement information generally refers to the distribution method of the light-emitting elements on the peripheral product. Taking a keyboard as an example, light-emitting elements can typically be distributed on each key; correspondingly, their arrangement information can include the size of the matrix formed by the light-emitting elements. Optionally, the arrangement information can be stored in the peripheral product, or it can be found by identifying the product model of the peripheral product and then searching for the arrangement information using the product model. The arrangement information can be obtained by reading or searching when constructing the preset prompt template and used for its construction. Furthermore, it should be noted that, to ensure lighting effect quality and code standardization, the preset prompt template may also include a target example image, frame count, duration, code type, and format requirements.

[0034] For example, a target prompt word is constructed based on the optimized target lighting effect text and a prompt word template containing information about the arrangement of light-emitting elements on the peripheral product. This can be achieved by filling the target lighting effect text into the prompt word template or concatenating it with the template. The target prompt word is then input into a preset generation model, which in turn guides the model to output target lighting effect code data that can be used to control the light-emitting elements on the peripheral product. Optionally, the preset generation model can directly generate lighting effect code to form target lighting effect code data. In this case, the number of tokens output by the model can be reduced, thereby lowering the implementation cost of the aforementioned lighting effect generation method. Optionally, the preset generation model can also generate lighting effect code together with a supporting tool to form target lighting effect code data. Correspondingly, the driver software accompanying the peripheral product can drive the light-emitting elements on the peripheral product to emit light according to the target lighting effect code data, thereby producing the corresponding lighting effect. In this way, users can obtain lighting effect animations adapted to specific peripheral hardware characteristics through natural language descriptions without needing programming knowledge or lighting effect editing experience.

[0035] In this embodiment, initial lighting effect text for describing the lighting effects of peripheral products is determined based on user-described text and / or game-feature text. The game-feature text is determined by the output screen of the target device to which the peripheral product is connected. The initial lighting effect text is then optimized using a preset optimization model to obtain target lighting effect text. Target prompts are constructed based on the target lighting effect text and a preset prompt template. These prompts guide a preset generation model to generate target lighting effect code data. The preset prompt template includes at least the arrangement information of the light-emitting elements on the peripheral product. In other words, this embodiment determines the initial lighting effect text using game-feature text and / or user-described text. The game-feature text is determined based on the output screen of the target device to which the peripheral product is connected. This approach ensures that the initial lighting effect text includes the user's subjective intentions and also includes the usage scenario of the peripheral product. Furthermore, optimizing the initial lighting effect text using a preset optimization model to form the target lighting effect text avoids problems such as inaccurate or incomplete lighting effect text descriptions, ensuring the quality of the input content to the preset generation model and improving the accuracy and stability of the generated code. Finally, the target lighting effect text and preset prompt templates guide the generation model to generate target lighting effect code data. The prompt templates embed the layout information of the peripheral product's light-emitting elements, ensuring the target lighting effect code data matches the peripheral product's hardware structure, i.e., the layout of its light-emitting elements, thus improving the quality of the lighting effects produced by the target lighting effect code data. Therefore, this application achieves high-quality personalized lighting effect generation for peripheral products in a low-barrier manner, significantly improving the user experience of peripheral products.

[0036] In addition, it should be noted that in the embodiments of this application, the target lighting effect code data is mainly generated by the model. Compared with the solution of directly generating patterns or animations through the model, this application can significantly reduce the number of tokens output by the model and reduce the application cost of the solution.

[0037] In one feasible implementation, the step of determining the initial lighting effect text for describing the lighting effects of the peripheral product based on user description text and / or game feature text includes steps S111 to S114: Step S111: Obtain the output screen of the target device to which the peripheral product is connected; Step S112: Based on the output screen recognition, obtain the current game content information, wherein the current game content information includes at least one of the following: game character, character status, and game scene; Step S113: Determine game feature text based on the current game content information; Step S114: Determine the initial lighting effect text using game feature text and / or received user description text.

[0038] It should be noted that in practical applications, users often have high demands for lighting effects generated by peripheral devices when playing video games on computers. For example, they may use the lighting effects of peripheral devices to further enhance the immersive experience of the game. Therefore, in this embodiment, the initial lighting effect text can be generated based on the game content to ensure that the lighting effects match the game scene played using peripheral devices.

[0039] For example, the target device refers to a computer host, game console, or other electronic device with screen output capability connected to the peripheral product. The output screen refers to the display content generated by the device during operation, such as game screen or application interface. Optionally, the current output screen frame data of the target device can be obtained through the back buffer read interface or screen capture interface of the graphics API (Application Programming Interface) provided by the operating system (such as the Windows screen capture API or the macOS CGDisplayStream API) at a set sampling frequency (e.g., 30 frames per second), which is the aforementioned output screen.

[0040] For example, current game content information refers to semantic information related to the current game progress identified from the output screen. Optionally, the acquired output screen can be input into a pre-trained game content recognition model. This model can employ an object detection and scene semantic understanding architecture based on convolutional neural networks (CNN) or visual Transformers. After training on a large amount of game screen annotation data, it can identify at least one of the following from the screen: the category and position of the game character (which may also include character skills), the character's current state (such as health, energy, action status, etc.), and the current game scene (such as game loading scene, character selection scene, combat scene, exploration scene, dialogue scene, being attacked scene, death scene, etc.) as current game content information.

[0041] Optionally, based on the output of the current game content information, it can be converted into a natural language description according to a preset text generation template. For example, when the character's status is identified as "low health" and the scene is a "battle scene," game feature text such as "The character is in intense battle with low health" can be generated. Optionally, the current game content information can also be directly mapped to game feature text through a pre-set mapping table.

[0042] For example, the initial lighting effect text can be determined based solely on game feature text, or solely on user description text, or a combination of both. Optionally, when the initial lighting effect text is determined solely based on game feature text, the generated game feature text is directly used as the initial lighting effect text, or it is converted into a lighting effect description according to a preset lighting effect mapping template; when both game feature text and user description text exist, they are merged according to a preset fusion strategy (such as splicing, weighted combination, or semantic fusion through a language model) to generate the final initial lighting effect text.

[0043] Understandably, in this embodiment, by automatically recognizing game content information from the game screen and generating lighting effect text, the linkage between lighting effects and game content is achieved. This allows the lighting effects to dynamically change according to the game progress and character status, enhancing the game's immersion and interactive experience. Simultaneously, allowing users to input additional descriptive text for intervention balances the dual needs of automated generation and user personalization.

[0044] In one feasible implementation, the step of optimizing the initial lighting effect text using a preset optimization model to obtain the target lighting effect text includes steps S21 to S22: Step S21: Input the initial lighting effect text and the preset optimization prompt words into the preset optimization model, and optimize the initial lighting effect text through the preset optimization model to obtain candidate lighting effect text; Step S22: Use the candidate light effect text as the target light effect text, or, in response to the user's confirmation operation, use the candidate light effect text as the target light effect text, or, in response to the user's adjustment operation, adjust the candidate light effect text to obtain the target light effect text.

[0045] It should be noted that the aforementioned preset optimization prompts refer to pre-designed instruction templates used to guide the preset optimization model to perform specific text optimization tasks. For example, the initial lighting effect text and the preset optimization prompts can be combined according to a preset template format to construct a complete model input. For instance, the preset optimization prompts could be designed as: "Please optimize the following lighting effect description into a clearly structured, complete text suitable for generating animation code. During optimization, missing elements such as color, movement mode, and rhythm need to be supplemented: [Initial Lighting Effect Text]". The combined input is then submitted to the preset optimization model, which outputs the optimized candidate lighting effect text.

[0046] Optionally, in this embodiment, the final confirmation method for candidate lighting effect text includes three modes: automatic confirmation mode, user confirmation mode, and user adjustment mode.

[0047] For example, in automatic confirmation mode, the candidate lighting effect text can be directly identified as the target lighting effect text. In user confirmation mode, the candidate lighting effect text can be presented to the user, and the user can confirm the selection through the interactive interface. In response to the user's confirmation, the candidate lighting effect text is identified as the target lighting effect text. In user adjustment mode, the candidate lighting effect text is presented to the user, and the user is allowed to edit it. In response to the user's adjustment, the modified target lighting effect text is obtained.

[0048] It is understood that in this embodiment, the lighting effect text will be structurally optimized by a model guided by preset optimization prompts, so that the optimized text contains more complete lighting effect element information; at the same time, multiple confirmation modes are provided, which takes into account the efficiency of fully automatic processing and the user's control over the generated results, thereby improving the flexibility of the solution and the user experience.

[0049] Reference Figure 2 This diagram illustrates the data flow of a scene within the lighting effects generation method of this application. As shown, the user can input text through a browser (i.e., the front-end webpage) to form initial lighting effect text. The browser can optimize the initial lighting effect text using a preset optimization model (built-in or invoked) to form target lighting effect text, and combine it with a preset prompt word template to form target prompt words. The target prompt words are then sent to the AI ​​server, which, guided by the target prompt words, generates lighting effect code (i.e., target lighting effect code data). The generated lighting effect code is then sent back to the browser for animation rendering and parsing, forming lighting effect data, such as data controlling the operation of light-emitting elements on peripheral products. This lighting effect data is then sent to a lighting service (such as the peripheral product) via a communication interface, ultimately achieving the lighting effect output.

[0050] Reference Figure 3 This is a flowchart illustrating the second embodiment of the lighting effects generation method of this application. In this embodiment, the step of guiding a preset generation model to generate target lighting effect code data through target prompts includes steps S31 to S33: Step S31: Guide the preset generation model to generate candidate lighting effect codes and the quantization parameters of the animations corresponding to the candidate lighting effect codes through the target prompt words. The quantization parameters include at least the animation sampling constraints that match the layout information. Step S32: Sample the animation corresponding to the candidate lighting effect code based on the quantization parameters to obtain sampled image data, and extract lighting effect features based on the sampled image data. The indicator dimensions of the lighting effect features include at least one of the following: lighting effect animation change amount, lighting effect loop beginning and end difference, lighting effect main body contrast, equivalent brightness coverage, equivalent noise ratio, and lighting effect sampling readability. Step S33: If the lighting effect characteristics meet the preset lighting effect standards, the candidate lighting effect code is used as the target lighting effect code data.

[0051] It should be noted that, in this embodiment, the target prompt word refers to the complete instruction obtained by combining the target lighting effect text with the preset prompt word template according to the preset format, which is used to input into the preset generation model.

[0052] For example, the preset prompt template should at least include the layout information of the light-emitting elements on the peripheral product (the layout information may include the matrix size of the light-emitting elements, the number of light-emitting elements, the arrangement of the light-emitting elements, etc.). Optionally, in practical applications, the preset prompt template may also include code format requirements, animation parameter range constraints (e.g., target schematic diagram, frame rate, duration, etc.), output format specifications, etc. Fill in the target lighting effect text according to the placeholder positions in the template to generate the complete target prompt.

[0053] It should be noted that candidate lighting effect code refers to the visual content (which can be a JSON-formatted code file) generated by the preset generation model based on the target prompt words, and can drive the software to generate lighting effect animations. Quantization parameters are parameters that describe the sampling rules of the animation corresponding to the candidate lighting effect code in the spatial and temporal dimensions, and are a key basis for subsequently judging the quality of the candidate lighting effect code or the quality of the animation corresponding to the candidate lighting effect code.

[0054] For example, the constructed target prompt words are input into a preset generation model. This model can be a combination of a text-to-video generation model based on a diffusion architecture and equipped with a code conversion tool, or a code generation model based on a large language model. It is worth noting that the output of the preset generation model can contain two parts: the first part is the candidate lighting effect code; the second part is the quantization parameters, which at least include animation sampling constraints that match the layout information, such as logical grid size (i.e., abstract spatial resolution), derived size (i.e., actual output pixel size), etc., to ensure that the sampling results in subsequent animation sampling steps can be adapted to the light-emitting elements of peripheral products. In addition, the quantization parameters can also include frame rate (frames per second) and loop duration (the duration of a single complete animation cycle), etc.

[0055] It should be noted that the animation corresponding to the candidate lighting effect code refers to the special effects animation presented under the drive of the candidate lighting effect code. Sampling image data refers to the sequence of images extracted from the animation corresponding to the candidate lighting effect code according to the spatial grid and temporal sampling rules defined in the quantization parameters, after sampling processing. Lighting effect features refer to a set of quantization indicators extracted from the sampling image data, used to evaluate the visual quality of the animation in the corresponding lighting effect scenario of the peripheral product. Taking a keyboard as an example, the arrangement of light-emitting elements on a keyboard constitutes a low-resolution light effect output matrix. Therefore, excessively fine text, complex patterns, or random noise are easily lost after sampling according to the key positions (one light-emitting element per key), meaning that such detailed features cannot be displayed on the keyboard. Therefore, it is necessary to sample using quantization parameters and perform visual effect quality checks.

[0056] For example, based on the logical grid size in the quantization parameters (taking a keyboard as an example, the logical grid corresponds to the key matrix of the keyboard, such as 20×6 or 20×8), each frame of the animation corresponding to the candidate lighting effect code can be spatially downsampled according to the grid size to obtain low-resolution sampled image data. Then, lighting effect features are extracted from the sampled image data. Optionally, the indicator dimensions of the lighting effect features include at least one of the following: lighting effect animation variation, lighting effect loop beginning and ending differences, lighting effect main body contrast, equivalent brightness coverage, equivalent noise ratio, and lighting effect sampling readability. These indicator dimensions are mainly used to evaluate the display effect and quality of lighting effects on peripheral products. One or more of the above indicator dimensions can be selected based on actual needs.

[0057] It should be noted that preset lighting effect standards refer to a set of threshold conditions pre-set for various lighting effect characteristic indicators. Target lighting effect code data refers to lighting effect control code that can be directly executed by peripheral products or parsed and executed through driver software.

[0058] For example, the various lighting effect feature indicators extracted from the sampled image data can be compared one by one with the corresponding thresholds in the preset lighting effect standards. If all indicators meet the threshold requirements, the candidate lighting effect code is determined to have passed the quality assessment. Accordingly, the candidate lighting effect codes that have passed the quality assessment can be used as the final output target lighting effect code data.

[0059] Understandably, in this embodiment, by constructing a prompt word template containing hardware layout information, the generation model possesses hardware compatibility awareness during the generation stage. Through a verification mechanism involving generation, sampling, and evaluation, it is ensured that the generated lighting animation maintains a recognizable visual effect even after low-resolution sampling. The verified candidate lighting effect codes are then used as the target lighting effect code data, requiring no manual intervention.

[0060] In one feasible implementation, after the step of extracting lighting effect features based on sampled image data, the method includes steps S35-S36: Step S35: If the lighting effect characteristics do not meet the preset lighting effect standards, determine the feature differences between the lighting effect characteristics and the preset lighting effect standards. Step S36: Determine new target prompt words based on feature differences, and return to the step of guiding the preset generation model to generate candidate lighting effect codes and the quantization parameters of the animations corresponding to the candidate lighting effect codes based on the new target prompt words.

[0061] It should be noted that the above-mentioned feature differences refer to the deviation between the measured values ​​of various lighting effect feature indicators and the preset standard thresholds.

[0062] For example, when any of the extracted lighting effect features fails to meet the threshold requirement of the preset lighting effect standard, the difference between each substandard feature and the standard threshold is calculated one by one to form the feature difference. For instance, if the measured value of "subject contrast ratio" is 0.35 while the standard threshold is 0.50, the feature difference is "subject contrast ratio is 0.15 lower"; if the measured value of "equivalent noise ratio" is 0.25 while the standard threshold is 0.10, the feature difference is "noise ratio is 0.15 higher", and so on.

[0063] It should be noted that the new target prompt words refer to the updated prompt words generated by incorporating feature difference information on the basis of the original target prompt words, and are used to guide the model to make targeted improvements.

[0064] For example, feature differences can be converted into structured repair instructions according to a preset template format, thereby forming new target prompts. For instance, "subject contrast is 0.15 too low" can be converted into "please increase the brightness contrast between the main image and the background"; "noise ratio is 0.15 too high" can be converted into "please reduce random flickering and isolated bright spots in the lighting effect". Optionally, these repair instructions can also be merged with the previously used target prompts to form new target prompts. After obtaining the new target prompts, the generation and evaluation process of steps S32 to S33 is repeated until all indicators meet the standards or the preset maximum number of retries is reached.

[0065] Understandably, in this embodiment, by quantifying the quality assessment results into feature differences and converting them into structured repair instructions, an automatic closed-loop iteration of the generation process is achieved. Unlike simple repetitive generation, this mechanism can perform targeted corrections for specific quality defects, improving iteration efficiency and final generation quality while reducing the number of invalid retries.

[0066] In one feasible implementation, the step of extracting lighting effect features based on sampled image data includes at least one of the following steps S331 to S336: Step S331: When the indicator dimension of the lighting effect feature includes the amount of change in the lighting effect animation, determine the amount of change in the lighting effect animation of the sampled image data based on the difference between adjacent frames or adjacent key frames in the sampled image data. Step S332: When the indicator dimension of the lighting effect feature includes the difference between the beginning and end of the lighting effect cycle, extract the difference between the first frame image and the last frame image in the sampled image data to obtain the difference between the beginning and end of the lighting effect cycle in the sampled image data. Step S333: When the indicator dimension of the lighting effect features includes the contrast of the main lighting effect, the separation degree between the main pattern and the background in the sampled image data is extracted based on the global brightness information of the sampled image data to obtain the contrast of the main lighting effect in the sampled image data. Step S334: When the indicator dimension of the lighting effect features includes the equivalent brightness coverage, extract the proportion of target pixels whose brightness exceeds a preset threshold in the sampled image data to obtain the equivalent brightness coverage of the sampled image data. Step S335: When the indicator dimension of the lighting effect feature includes the equivalent noise ratio, extract the number of isolated pixels in the sampled image data to obtain the equivalent noise ratio of the sampled image data. The lighting effect variation pattern of isolated pixels is different from the lighting effect variation pattern of adjacent pixels of isolated pixels. Step S336: When the indicator dimension of the lighting effect features includes sampling readability, extract the similarity between the effect pattern and the mapping reconstruction pattern in the sampled image data to obtain the lighting effect sampling readability of the sampled image data. Here, the mapping reconstruction pattern refers to the pattern obtained after sampling and reconstructing the effect pattern according to the arrangement information.

[0067] It should be noted that, in this embodiment, the amount of change in lighting effects animation usually refers to a quantitative indicator that measures the dynamic activity of the animation over time.

[0068] For example, when the indicator dimension of the lighting effect features includes the amount of change in the lighting effect animation, for each pair of adjacent frames in the sampled image data (or adjacent keyframes extracted at preset time intervals), the difference in pixel values ​​at corresponding positions between the two frames is calculated. The difference can be measured using methods such as mean absolute error or structural similarity index. The difference values ​​of all adjacent frame pairs (or adjacent keyframes) are accumulated or averaged over time to obtain the total or average change of the animation. Keyframes can be extracted at preset intervals.

[0069] It should be noted that the difference between the beginning and end of the lighting effect loop refers to a quantitative indicator that measures the visual consistency between the first and last frames of an animation.

[0070] For example, when the indicator dimension of the lighting effect features includes the difference between the beginning and end of the lighting effect loop, the first and last frames of the sampled image data are extracted, and the difference in pixel values ​​at corresponding positions between the two is calculated. Similarly, the difference can also be measured using methods such as mean absolute error or structural similarity index. For instance, if the first frame of the sampled image data is entirely red and the last frame is entirely blue, a large difference is calculated, indicating a large difference between the beginning and end. This will produce a noticeable abrupt change during loop playback, which correspondingly means poor lighting effect quality.

[0071] It should be noted that the main contrast ratio of the lighting effect refers to a quantitative indicator that measures the degree of brightness separation between the main image (foreground) and the background in the lighting effect animation.

[0072] For example, when the indicator dimension of the lighting effect includes the contrast of the main subject, brightness information can be extracted from each frame of the sampled image data to obtain a global brightness histogram. Then, the distribution characteristics of the brightness histogram are analyzed, and the kurtosis and dynamic range (the brightness difference between the brightest and darkest areas) are calculated. Higher kurtosis indicates that the brightness distribution is more concentrated in a specific area, and a larger dynamic range indicates a more significant difference in brightness. These two parameters are then used to calculate the separation degree between the main subject and the background. If the separation degree is higher than a preset threshold, the main subject is considered clearly distinguishable in the background; if the separation degree is lower than the threshold, the subject and background are considered "blurred together," indicating poor lighting effect quality.

[0073] It should be noted that equivalent brightness coverage refers to a quantitative indicator that measures the proportion of the effectively lit area to the total area in a lighting animation.

[0074] For example, when the indicator dimension of the lighting effect features includes equivalent brightness coverage, a brightness threshold can be set (e.g., the 30th percentile of pixel brightness value or 128 / 255 of absolute brightness value). For each frame of the sampled image data, a pixel-level judgment is performed: the number of pixels with brightness values ​​exceeding the threshold is counted, and the percentage of these pixels relative to the total number of pixels is calculated. Instantaneous coverage can be calculated for a single frame, or an average coverage can be obtained by averaging across multiple frames.

[0075] It should be noted that the equivalent noise ratio is a quantitative indicator that measures the proportion of random noise or isolated flickering points in lighting animation.

[0076] For example, when the indicator dimension of the lighting effect features includes the equivalent noise ratio, for each frame in the sampled image data, the consistency of each pixel with its neighboring pixels (four-neighborhood or eight-neighborhood) in terms of brightness value and temporal variation pattern is checked. If the difference between the brightness value of a pixel and the average brightness value of its neighboring pixels exceeds a preset threshold, and its temporal variation pattern (such as flicker frequency and direction of change) is inconsistent with its neighborhood, then the pixel is marked as an isolated pixel (i.e., a noise point). The total number of isolated pixels in all frames is counted, and its proportion of all pixels minus the total number of frames is calculated to obtain the equivalent noise ratio.

[0077] It should be noted that sampling readability refers to a quantitative indicator that measures whether the main pattern of the lighting animation can still be identified after low-resolution sampling.

[0078] For example, when the indicator dimension of the lighting effect features includes sample readability, the effect pattern is obtained by extracting the original resolution image from the sampled image data. Then, according to the logical grid size and layout information defined in the quantization parameters, the effect pattern is spatially downsampled (e.g., mapped to the key matrix resolution of the keyboard) to obtain the mapped reconstruction pattern. Finally, the structural similarity index or other image similarity measure between the effect pattern and the mapped reconstruction pattern is calculated to obtain the sample readability index. The higher the similarity, the more details the pattern retains after low-resolution sampling, the easier it is for users to recognize on the keyboard, and correspondingly, the better the lighting effect quality.

[0079] Understandably, in this embodiment, the lighting effect animation can be quantitatively evaluated from six dimensions, achieving a comprehensive, objective, and calculable measurement of the visual quality of the lighting effects. Each indicator is evaluated from the perspectives of dynamism, loop smoothness, subject sharpness, brightness utilization, noise level, and low-resolution adaptability, avoiding the one-sidedness of evaluation by a single indicator. These quantitative quality evaluation results provide a precise data foundation for subsequent automatic repair and iterative generation.

[0080] Reference Figure 4 This is a flowchart illustrating the third embodiment of the lighting effects generation method of this application. After the step of guiding the preset generation model to generate target lighting effect code data, the method includes steps S41 to S43: Step S41: Generate a lighting effect demonstration animation based on the target lighting effect code data; Step S42: Extract the current lighting display information from the lighting effect demonstration animation based on the lighting effect schematic frame that matches the arrangement of the light-emitting elements on the peripheral product; Step S43: Control the operation of the light-emitting elements on the peripheral product based on the current lighting display information.

[0081] It should be noted that a lighting effect demo animation refers to a preview animation that visually displays the lighting effect described by the target lighting effect code on a computer screen.

[0082] For example, a lighting effect demonstration animation can be formed by parsing and rendering the target lighting effect code data. Optionally, the rendering process can use the Canvas 2D drawing API, WebGL, or other graphics rendering technologies to draw frame by frame according to the animation logic (including color changes, motion trajectories, timing control, etc.) defined in the code, generating a complete lighting effect demonstration animation and displaying it on the screen.

[0083] It should be noted that the equivalent schematic frame refers to an interactive selection box overlaid on the lighting effect demonstration animation, whose shape and layout correspond to the actual arrangement of the light-emitting elements of the peripheral product. The current lighting display information refers to the lighting effect data corresponding to the area currently covered by the equivalent schematic frame.

[0084] For example, an equivalent schematic box can be overlaid on the screen of the lighting effect demonstration animation. The grid division of this box is consistent with the actual light-emitting element arrangement of the peripheral product (such as a keyboard). Based on the position and size of the equivalent schematic box on the current screen, the color information of each grid cell (such as taking the average color within the area) is extracted from the corresponding area of ​​the demonstration animation. This color information is the current lighting display information.

[0085] Optionally, the extracted current lighting display information can be encapsulated according to the hardware communication protocol of the peripheral product and sent to the peripheral product via a communication interface such as USB (Universal Serial Bus), Bluetooth, or 2.4GHz wireless. After receiving the data, the peripheral product can drive its light-emitting element to display according to the specified color and brightness.

[0086] It is understandable that in this embodiment, by generating a lighting effect demonstration animation on the screen and previewing it in conjunction with an equivalent schematic box, users can intuitively preview the lighting effect before actually applying it to peripheral products; the equivalent schematic box enables the extraction and distribution of color data from the preview screen to the hardware LEDs, achieving a "what you see is what you get" lighting effect control experience.

[0087] In one feasible implementation, after the step of generating a lighting effect demonstration animation based on the target lighting effect code data, the method includes step S44: Step S44: In response to the interaction with the equivalent schematic box, move the position of the equivalent schematic box on the lighting effect demonstration animation, wherein the content covered by the equivalent schematic box at the current position is used to determine the current lighting display information.

[0088] For example, in this embodiment, the system can provide an interactive interface, allowing users to move the position of the lighting effect indicator frame on the lighting effect demonstration animation by dragging with a mouse, using keyboard arrow keys, or touch gestures. Optionally, whenever the position of the equivalent indicator frame changes, the system recalculates the color information of the area covered by the new position in real time and updates the lighting display data sent to the peripheral product. In this way, users can select different local areas to be mapped onto the peripheral product for display by moving the position of the lighting effect indicator frame on the complete lighting effect demonstration animation.

[0089] Understandably, by interactively moving the lighting effect indicator box, users can freely select the area they want to display on peripherals on the full lighting effect screen without modifying the code or regenerating the lighting effect, greatly enhancing the flexibility and playability of lighting effect applications.

[0090] In one feasible implementation, the step of generating a lighting effect demonstration animation based on the target lighting effect code data includes steps S411 to S412: Step S411: Generate an initial demonstration animation based on the target lighting effect code data; Step S412: In response to the adjustment operation of the initial demonstration animation, the display parameters of the initial demonstration animation are adjusted to obtain the lighting effect demonstration animation, wherein the display parameters include at least one of animation speed, background color and brightness.

[0091] For example, the system can parse the target lighting effect code data and render it according to the animation parameters (color values, motion trajectory, timeline, etc.) defined in the code to generate an initial demo animation that has not been adjusted by the user.

[0092] For example, the system provides display parameter adjustment controls, allowing users to adjust display parameters such as the playback speed, background color, and overall brightness of the initial demo animation. When a user adjusts a parameter, the system updates the rendering effect of the demo animation in real time, and the lighting effect demo animation is obtained after the user completes the adjustment. Optionally, the parameter adjustment controls are distributed around the demo animations (initial demo animation, lighting effect demo animation).

[0093] Understandably, by providing real-time adjustment of display parameters, users can fine-tune the lighting effect demonstration animation according to their personal preferences and usage environment without having to re-execute the entire generation process, thus improving the user experience and the flexibility of the solution.

[0094] Reference Figure 5This diagram illustrates the layered framework of the lighting effects generation method in this application. As shown, this solution adopts a layered distributed architecture: the AI ​​model server on the server side can assume the computing power role of the "preset generation model" and "preset optimization model" in this embodiment; the front-end webpage carries the user interface through the CEF (Chromium Embedded Framework) container and completes communication through JSAPI (JavaScript Application Programming Interface), which can obtain the initial lighting effect text input by the user and other user operations, and communicate with the server through network requests; the HIVE 2.0 UI process on the client side can be responsible for displaying the lighting effect demonstration animation and equivalent schematic boxes, etc. The HIVE CORE SERVICE device core service and the HIVE LIGHTSERVICE device lighting effect process can execute core quality assessment logic. This involves multi-frame sampling of the animation corresponding to candidate lighting effect codes based on quantified parameters, extracting lighting effect features, and converting the animation corresponding to the candidate lighting effect codes into target lighting effect code data once the features meet the standards. At the device layer, peripheral products such as keyboards, mice, headphones, or dongles (small hardware devices that connect to computers or other devices via physical interfaces) receive lighting display information from the client and drive the light-emitting elements to operate according to specified colors and brightness. The entire architecture enables bidirectional data interaction between the front-end and the client, constructing a closed-loop process of "generation, verification, sampling, feedback, and regeneration," ensuring a good balance between visual performance and hardware compatibility in the AI-generated lighting effect animations.

[0095] The following is for reference. Figure 6 It shows a schematic diagram of a structure suitable for implementing an electronic device according to the embodiments of this application. Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0096] like Figure 6As shown, the electronic device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the electronic device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although electronic devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0097] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0098] The electronic device provided in this application, employing the lighting effect generation method described in the above embodiments, can solve the technical problem that traditional peripheral products cannot provide users with a high level of user experience. Compared with the prior art, the beneficial effects of the electronic device provided in this application are the same as those of the lighting effect generation method provided in the above embodiments, and other technical features of this electronic device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0099] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0100] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0101] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the lighting effect generation method in the above embodiments.

[0102] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0103] The aforementioned computer-readable storage medium may be contained within an electronic device or may exist independently without being assembled into an electronic device.

[0104] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by an electronic device, cause the electronic device to: The initial lighting effect text for describing the lighting effect of the peripheral product is determined based on user description text and / or game feature text, wherein the game feature text is determined by the output screen of the target device to which the peripheral product is connected; the initial lighting effect text is optimized by a preset optimization model to obtain the target lighting effect text; target prompts are constructed based on the target lighting effect text and a preset prompt word template, and the target prompts guide the preset generation model to generate target lighting effect code data, wherein the preset prompt word template includes at least the arrangement information of the light-emitting elements on the peripheral product.

[0105] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0106] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0107] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0108] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described lighting effect generation method. This solves the technical problem that traditional peripheral products cannot provide users with a high-quality user experience. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the lighting effect generation method provided in the above embodiments, and will not be repeated here.

[0109] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the lighting effects generation method described above.

[0110] The computer program product provided in this application can solve the technical problem that traditional peripheral products cannot provide users with a high level of user experience. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the lighting effect generation method provided in the above embodiments, and will not be repeated here.

[0111] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for generating lighting effects, characterized in that, The method includes: The initial lighting effect text for describing the lighting effect of the peripheral product is determined based on user description text and / or game feature text, wherein the game feature text is determined by the output screen of the target device to which the peripheral product is connected; The initial lighting effect text is optimized using a preset optimization model to obtain the target lighting effect text; Based on the target lighting effect text and the preset prompt word template, a target prompt word is constructed. The target prompt word guides the preset generation model to generate target lighting effect code data. The preset prompt word template includes at least the arrangement information of the light-emitting elements on the peripheral product. The step of guiding the preset generation model to generate target lighting effect code data through the target prompt word includes: The target prompt word guides the preset generation model to generate candidate lighting effect codes and quantization parameters of the animation corresponding to the candidate lighting effect codes. The quantization parameters include at least an animation sampling constraint that matches the arrangement information. Based on the quantization parameters, the animation corresponding to the candidate lighting effect code is sampled to obtain sampled image data, and lighting effect features are extracted based on the sampled image data. The indicator dimensions of the lighting effect features include at least one of the following: lighting effect animation change amount, lighting effect loop beginning and end difference, lighting effect main body contrast, lighting effect brightness coverage, lighting effect noise ratio, and lighting effect sampling readability. Specifically, when the indicator dimension of the lighting effect feature includes the contrast of the main lighting effect, the separation degree between the main pattern and the background in the sampled image data is extracted based on the global brightness information of the sampled image data to obtain the contrast of the main lighting effect in the sampled image data. When the indicator dimension of the lighting effect feature includes the brightness coverage of the lighting effect, the proportion of target pixels whose brightness exceeds a preset threshold in the sampled image data is extracted to obtain the brightness coverage of the sampled image data. When the indicator dimension of the lighting effect feature includes the readability of the sampled image data, the similarity between the effect pattern and the mapped reconstruction pattern in the sampled image data is extracted to obtain the readability of the lighting effect sampled image data. The mapped reconstruction pattern refers to the pattern obtained by sampling and reconstructing the effect pattern according to the arrangement information. If the lighting effect features meet the preset lighting effect standards, the candidate lighting effect code will be used as the target lighting effect code data.

2. The method for generating lighting effects as described in claim 1, characterized in that, After the step of extracting lighting effect features based on the sampled image data, the method includes: If the lighting effect feature does not meet the preset lighting effect standard, the feature difference between the lighting effect feature and the preset lighting effect standard is determined; Based on the feature differences, a new target prompt word is determined, and based on the new target prompt word, the process of guiding the preset generation model to generate candidate lighting effect codes and the quantization parameters of the animations corresponding to the candidate lighting effect codes is returned.

3. The method for generating lighting effects as described in claim 1, characterized in that, The step of extracting lighting effect features based on the sampled image data includes at least one of the following: When the indicator dimension of the lighting effect feature includes the amount of change in lighting effect animation, the amount of change in lighting effect animation of the sampled image data is determined based on the difference between adjacent frames or adjacent key frames in the sampled image data. When the indicator dimension of the lighting effect feature includes the difference between the beginning and end of the lighting effect cycle, the difference between the first frame image and the last frame image in the sampled image data is extracted to obtain the difference between the beginning and end of the lighting effect cycle in the sampled image data. When the indicator dimension of the lighting effect feature includes the lighting effect noise ratio, the number of isolated pixels in the sampled image data is extracted to obtain the lighting effect noise ratio of the sampled image data. The lighting effect variation pattern of the isolated pixel is different from the lighting effect variation pattern of the adjacent pixels of the isolated pixel.

4. The method for generating lighting effects as described in claim 1, characterized in that, After the step of guiding the preset generation model to generate target lighting effect code data, the method includes: Generate a lighting effect demonstration animation based on the target lighting effect code data; Based on a lighting effect schematic frame that matches the arrangement of light-emitting elements on the peripheral product, the current lighting display information is extracted from the lighting effect demonstration animation; The system controls the operation of the light-emitting elements on the peripheral product based on the current lighting display information.

5. The method for generating lighting effects as described in claim 4, characterized in that, After the step of generating a lighting effect demonstration animation based on the target lighting effect code data, the method includes: In response to an interactive operation with the lighting effect diagram frame, the position of the lighting effect diagram frame on the lighting effect demonstration animation is moved, wherein the content covered by the lighting effect diagram frame at the current position is used to determine the current lighting display information.

6. The method for generating lighting effects as described in claim 4, characterized in that, The step of generating a lighting effect demonstration animation based on the target lighting effect code data includes: An initial demo animation is generated based on the target lighting effect code data; In response to the adjustment operation of the initial demo animation, the display parameters of the initial demo animation are adjusted to obtain the lighting effect demo animation, wherein the display parameters include at least one of animation speed, background color, and brightness.

7. The method for generating lighting effects as described in claim 1, characterized in that, The step of determining the initial lighting effect text for describing the lighting effects of peripheral products based on user description text and / or game feature text includes: Obtain the output screen of the target device to which the peripheral product is connected; The current game content information is obtained based on the output screen recognition, wherein the current game content information includes at least one of the following: game character, character status, and game scene; Determine game feature text based on the current game content information; The initial lighting effect text is constructed using the game feature text and / or the received user description text.

8. The method for generating lighting effects as described in claim 1, characterized in that, The step of optimizing the initial lighting effect text using a preset optimization model to obtain the target lighting effect text includes: The initial lighting effect text and the preset optimization prompt words are input into the preset optimization model, and the initial lighting effect text is optimized by the preset optimization model to obtain candidate lighting effect text; The candidate lighting effect text can be used as the target lighting effect text, or, in response to a user confirmation operation, the candidate lighting effect text can be used as the target lighting effect text, or, in response to a user adjustment operation, the candidate lighting effect text can be adjusted to obtain the target lighting effect text.

9. An electronic device, characterized in that, The electronic device includes: a processor, a memory, and a lighting effects generation program stored in the memory and executable on the processor, wherein the lighting effects generation program, when executed, implements the steps of the lighting effects generation method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Light source assembly control method and device of rendering engine, electronic equipment and storage medium

    CN119516080A