Method and apparatus for generating shader, and device and storage medium
By obtaining description information and specification information and generating input information of the target model, the problem of inefficient generation of shaders in the prior art is solved, and the generation efficiency is realized is improved, and professional capability requirements are reduced.
Patent Information
- Application Number
- PCT/SG2024/050520
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-16
- Filing Date
- 2024-08-15
- Publication Date
- 2025-02-20
AI Technical Summary
The prior art is inefficient in generating shaders and requires high professional capabilities to developers.
By obtaining description information about the shader to be generated, and generating input information of the target model based on the description information and specification information associated with the shader generation, the target shader is finally provided based on the output information.
It realizes automatic generation of shaders, improves the efficiency of shaders generation, and reduces the professional ability requirements for developers.
Smart Images

Figure SG2024050520_20022025_PF_FP_ABST
Abstract
Description
[0001]This application claims priority to Chinese invention patent application number 2023110361058, filed on August 16, 2023, entitled “Method, Apparatus, Device, and Storage Medium for Generating Shaders,” the entire contents of which are incorporated herein by reference. Technical Field: Example embodiments of the present disclosure generally relate to the field of computers, and more particularly to methods, apparatuses, devices, and computer-readable storage media for generating shaders. Background: With the development of computer technology, the Internet has become an important platform for creating and sharing media content. In the process of creating media content, shaders are important tools for media processing. Different shaders can, for example, apply corresponding processing effects to image content or video content. Summary of the Invention: In a first aspect of the present disclosure, a method for generating a shader is provided. The method includes: obtaining description information about a shader to be generated; generating input information of a target model based on the description information and specification information associated with shader generation; obtaining output information generated by the target model based at least on the input information; and providing a target shader based on the output information. In a second aspect of the present disclosure, an apparatus for generating a shader is provided. The apparatus includes: a description acquisition module configured to obtain description information about the shader to be generated; an information generation module configured to generate input information of the target model based on the description information and specification information associated with shader generation; an output acquisition module configured to obtain output information generated by the target model based at least on the input information; and a providing module configured to provide a target shader based on the output information. In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the device to perform the method of the first aspect. In a fourth aspect of the present disclosure, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement the method of the first aspect.It should be understood that the content described in this summary is not intended to define the key features or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS The foregoing and other features, advantages, and aspects of various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, identical or similar reference numerals represent identical or similar elements, wherein: FIG1 illustrates a schematic diagram of an example environment in which embodiments according to the present disclosure may be implemented; FIG2 illustrates a flowchart of an example process for generating a shader according to some embodiments of the present disclosure; FIG3A and FIG3B illustrate example interfaces according to some embodiments of the present disclosure; FIG4 illustrates a schematic block diagram of an apparatus for generating a shader according to some embodiments of the present disclosure; and FIG5 illustrates a block diagram of an electronic device capable of implementing various embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are illustrated in the accompanying drawings, it should be understood that the present disclosure may be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the figures and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure. It should be noted that the headings of any section / subsection provided herein are not intended to be limiting. Various embodiments are described throughout this document, and any type of embodiment may be included under any section / subsection. Furthermore, an embodiment described in any section / subsection may be combined in any manner with any other embodiment described in the same section / subsection and / or in different sections / subsections. In the description of the embodiments of the present disclosure, the terms "including" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to." The term "based on" should be understood as "based, at least in part, on." The terms "one embodiment" or "the embodiment" should be understood as "at least one embodiment." The term "some embodiments" should be understood as "at least some embodiments." Other explicit and implicit definitions may be included below. The terms "first," "second," etc. may refer to different or the same objects. Other explicit and implicit definitions may be included below.The embodiments of this disclosure may involve user data, data acquisition, and / or use. These aspects comply with applicable laws, regulations, and relevant provisions. In the embodiments of this disclosure, all data collection, acquisition, processing, processing, forwarding, and use are conducted with the user's knowledge and confirmation. Accordingly, when implementing each embodiment of this disclosure, the user should be informed of the type, scope, and usage scenarios of the data or information involved and their authorization should be obtained through appropriate means in accordance with relevant laws and regulations. The specific notification and / or authorization methods may vary depending on actual circumstances and application scenarios, and the scope of this disclosure is not limited in this respect. Where personal information is processed in this specification and embodiments, it will be processed only with a legitimate basis (e.g., with the consent of the personal information subject or as necessary for contract performance) and only within the prescribed or agreed scope. A user's refusal to process personal information beyond that required for basic functions will not affect the user's use of basic functions. As mentioned above, shaders are important tools for media processing. Different shaders can, for example, apply corresponding processing effects to image or video content. Some special effects development platforms, for example, support developers generating corresponding shaders through code. However, this approach is often inefficient and requires high developer expertise. Embodiments of the present disclosure propose a shader generation scheme. This scheme involves obtaining description information about the shader to be generated; generating input information for a target model based on the description information and specification information associated with shader generation; obtaining output information generated by the target model based at least on the input information; and providing a target shader based on the output information. Based on the above approach, embodiments of the present disclosure can automatically generate corresponding shaders using description information, thereby improving shader generation efficiency. Various example implementations of this scheme are described in detail below with reference to the accompanying figures. Example Environment: Figure 1 illustrates a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. As shown in Figure 1, example environment 100 may include a generation device 120.As described in detail below, the generation device 120 may obtain the description information 110 input by the user and accordingly generate a shader 140 corresponding to the description information 110. In some embodiments, the generation device 120 may provide a corresponding shader 140 based on the description information 110 and utilizing a target model 130. It should be understood that such a target model 130 may include an appropriate machine learning model, such as a language model. In some embodiments, the target model 130 may be deployed locally on the generation device 120 or at a different remote location. In some embodiments, the generating device 120 may be any type of mobile terminal, fixed terminal, or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a PDA, a portable game terminal, a VR / AR device, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device, or any combination thereof, including accessories and peripherals of these devices or any combination thereof. In some embodiments, generation device 120 can also support any type of user interface (such as a "wearable" circuit). In yet other examples, generation device 120 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks, and big data and artificial intelligence platforms. It should be understood that the structure and functionality of the various elements in environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of the present disclosure. Some example embodiments of the present disclosure will be described below with reference to the accompanying drawings. Example Process FIG2 shows a flowchart of an example process 200 for generating a shader according to some embodiments of the present disclosure. Process 300 can be implemented at generation device 120.The following describes process 200 with reference to FIG1 . As shown in FIG2 , at block 210 , the generation device 120 obtains description information 110 regarding the shader to be generated. In some embodiments, the generation device 120 may, for example, provide a shader development tool to a user (e.g., a developer). Such a shader development tool may be a standalone application or integrated into some development platform (e.g., a special effects development platform). For example, the generation device 120 may provide an input entry for the user to enter the description information 110. It should be understood that the description information 110 may be entered in any appropriate manner, including but not limited to text input, voice input, and input via a selection control. It should be understood that the description information 110 may be text content based on a natural language and may be used to describe the purpose of the shader to be generated. Additionally, the description information 110 may also include at least one constraint information regarding the shader to be generated. For example, such preset information may include the number of parameters of the shader to be generated, the number of nodes corresponding to the shader to be generated, and so on. Continuing with FIG. 2 , at block 220 , the generation device 120 generates input information for the target model 130 based on the description information 110 and specification information associated with shader generation. In some embodiments, the generation device 120 may construct the input information for the target model 130 based on a preset template. For example, such a template may indicate the description information 110 to be filled in and the corresponding specification information. In some embodiments, the specification information may include appropriate information for guiding the target model to generate the code representation corresponding to the shader according to preset requirements. For example, the specification information may include descriptive information regarding the programming language used to generate the shader. For example, the specification information may specify the identifier of the programming language used to generate the shader. For example, the specification information may indicate that the programming language used to generate the shader is GLSL (OpenGL Shading Language). Additionally or alternatively, such descriptive information may also include version information, syntax information, and so on of the programming language. In some embodiments, such a programming language may be a custom language. Accordingly, such specification information may include a natural language description of such a custom language. For example, such specification information may indicate that the syntax of the custom language is consistent with GLSL syntax.In some embodiments, the specification information may also include a set of built-in variables associated with shader generation, also known as builtin uniforms. Such built-in variables may, for example, be variables that can be directly used by the shader to be generated. In some embodiments, the specification information may also include a code template associated with shader generation. This code template may include a preset code portion and a code portion to be generated by the target model. In some embodiments, other examples of specification information may include: Application Programming Interface (API) definition information associated with node generation, relevant API documentation, API code representation, API usage instructions, API usage examples, etc. In some embodiments, the generation device 120 may also utilize a language model to generate input information for the target model 130. In some scenarios, the description information 110 entered by the user may be too concise, making it difficult to effectively determine the target model 130 to generate the corresponding shader. In some embodiments, the generation device 120 may, for example, generate input information for the language model based on the received description information 110. For example, such input information can be used to instruct the language model to generate guidance information (also known as prompts) for generating a shader for the target model 130 based on the description information 110. It should be understood that the language model can be the same as or different from the target model 130, and this disclosure is not intended to be limiting. Furthermore, the generation device 120 can obtain guidance information generated by the language model based on the received input information. This guidance information corresponds to the generated shader and is used to guide the target model 130 in generating the corresponding shader. In this way, when the received description information 110 is relatively concise, more effective prompts can be generated by the language model, thereby improving the efficiency of shader generation. Furthermore, the generation device 120 can generate input information for the target model 130 based on the guidance information output by the language model and the specification information discussed above. In block 230, the generation device 120 obtains output information generated by the target model 130 based at least on the input information. In some embodiments, the generation device 120 can receive the output information generated by the target model 130 based on the input information. Such output information may include, for example, a code representation written in a specified programming language.Furthermore, at block 240, the generation device 120 provides a target shader 140 based on the output information. In some embodiments, the generation device 120 may provide a corresponding target shader 140 based on the code representation in the output information. In some embodiments, considering that the output result of the target model 130 may contain errors, the generation device 120 may also perform target processing on the output information to obtain target code. Furthermore, the generation device 120 may provide a target shader 140 generated based on the target code. In some embodiments, the generation device 120 may locally perform appropriate target processing, such as error checking, on the code representation in the output information to obtain optimized target code. For example, the generation device 120 may perform error correction processing on the code representation according to a preset error correction strategy. In yet other embodiments, the generation device 120 may also utilize the target model 130 to perform the target processing. Specifically, the generation device 120 may provide guidance information to the target model 130 to instruct the target model to perform the target processing, and may obtain the target code generated by the target model 130 based on the guidance information. In some examples, the guidance information provided to target model 130 may include first guidance information for instructing the target model to perform a specified type of processing on the input information. For example, generation device 120 may send guidance information to target model 130 regarding further checking the generated input information for errors and optimizing it. In other examples, the guidance information provided to target model 130 may also include reference information for the target model to generate target code. For example, generation device 120 may send guidance information to target model 130 regarding how to perform target processing, such as error handling. Exemplarily, such reference information may include first descriptive information associated with a set of preset errors. For example, such a set of preset errors may include historical errors detected from historical output information automatically generated by target model 130. Such first descriptive information may include descriptions of such historical errors, such as which code snippets may contain such errors. As another example, such reference information may include second descriptive information regarding how to correct the preset errors.For example, the generation device 120 may also provide the target model 130 with descriptive text or examples on how to correct corresponding errors, thereby guiding the target model 130 in optimizing the output information, such as error handling. In this way, embodiments of the present disclosure can further improve the quality of the final results output by the target model 130, thereby enhancing the efficiency and quality of shader generation. As described above, the output information provided by the target model 130 (before or after optimization) may include a code representation written in a specified programming language. In some embodiments, to improve the accuracy of target model 130 generation, this output information may correspond to a first code representation written in a first language. This first language may be, for example, a programming language known to the target model 130. Furthermore, the generation device 120 may convert this first code representation into a second code representation written in a second language. This second language may, for example, correspond to the target development platform for which the shader is intended to be applied. For example, in some scenarios, the target development platform may be developed using a custom language, which may be unfamiliar or unknown to the target model 130. Directly generating a code representation in a second language using the target model 130 may be inefficient and prone to errors. Generating a code representation in an intermediate language and further performing code conversion can improve the quality of shader generation. Furthermore, after completing the generation of the shader's code representation, the generation device 120 can provide a corresponding target shader 140. In some embodiments, the generation device 120 can display a configuration interface associated with the target shader 140. FIG3A illustrates an example configuration interface 300A according to some embodiments of the present disclosure. As shown in FIG3A , the configuration interface 300A can, for example, display a preview of the target shader 140. Additionally, the configuration interface 300A can include a set of parameter adjustment controls 305 for controlling a set of parameters of the target shader 140. In some embodiments, the number and / or type of such parameters can be determined based on descriptive information input by a user. It should be understood that such parameter adjustment controls 305 can be of any appropriate control type, and this disclosure is not intended to be limiting in this regard. As another example, the generation device 120 may also display an editing interface associated with the target shader 140 .FIG3B illustrates an example editing interface 300B according to some embodiments of the present disclosure. As shown in FIG3B , in editing interface 300B, the generation device 120 may display at least one node corresponding to the generated target shader 140, for example, node 310, node 320, node 330, node 340, and node 350. These multiple nodes may constitute a material graph. The material graph may allow users to define the corresponding shader by creating and editing nodes. Furthermore, the generation device 120 may modify the target shader 140 based on editing operations received in editing interface 300B. Exemplarily, such editing operations may include modifying parameters of at least one node. For example, a user may adjust parameters of one or more nodes corresponding to the shader through interface 300B. Additionally or alternatively, such editing operations may also include modifying the code representation of at least one node. For example, a user may click a corresponding node to view the corresponding code representation and modify the node's code representation at the code level. Additionally or alternatively, such an editing operation may also include modifying the connection relationship of at least one node. For example, a user may modify the connection relationship between nodes by dragging a node connection in interface 300B, thereby completing the editing of the target shader 140. Based on the above, the generation device 120 may provide the corresponding target shader 140 in different ways (e.g., parameter configuration or node configuration). In some embodiments, the method used to provide the target shader 140 may depend on user configuration information. For example, if the user currently configures the first mode (e.g., novice mode), the generation device 120 may provide the target shader 140 through parameter configuration. As another example, if the user currently configures the second mode (e.g., advanced mode), the generation device 120 may provide the target shader 140 through a node configuration. In some embodiments, the method used to provide the target shader 140 may depend on the method for obtaining the description information 110.For example, if the user inputs description information 110 through a first-type entry, the generation device 120 may provide a target shader 140 through parameter configuration. Such a first-type entry may be provided, for example, at the asset library level of a target development platform. As another example, if the user inputs description information 110 through a second-type entry, the generation device 120 may provide a target shader 140 through a node-based approach. oSuch a second type of entry can, for example, be provided at the material graph level. Based on the approach discussed above, embodiments of the present disclosure can support users automatically generating corresponding shaders by inputting descriptive information, thereby improving shader generation efficiency. Example Apparatus and Devices: Embodiments of the present disclosure also provide corresponding apparatuses for implementing the aforementioned methods or processes. Figure 4 shows a schematic block diagram of a special effects production apparatus 400 according to certain embodiments of the present disclosure. Apparatus 400 can be implemented as or included in a generation device 120. The various modules / components within apparatus 400 can be implemented using hardware, software, firmware, or any combination thereof. As shown in Figure 4, apparatus 400 includes a description acquisition module 410 configured to acquire descriptive information regarding the shader to be generated; an information generation module 420 configured to generate input information for a target model based on the descriptive information and specification information associated with shader generation; an output acquisition module 430 configured to acquire output information generated by the target model based at least on the input information; and a provision module 440 configured to provide a target shader based on the output information. In some embodiments, the specification information indicates at least one of the following: descriptive information regarding the programming language used to generate the shader; a set of built-in variables associated with shader generation; or a code template associated with shader generation. In some embodiments, the providing module 440 is further configured to: perform target processing on the output information to obtain target code; and provide a target shader generated based on the target code. In some embodiments, the providing module 440 is further configured to: provide guidance information to the target model; and obtain target code generated by the target model based on the guidance information and the output information. In some embodiments, the guidance information includes at least one of the following: first guidance information instructing the target model to perform a specified type of processing on the input information; and second guidance information including reference information for the target model to generate the target code. In some embodiments, the reference information includes at least one of the following: first descriptive information associated with a set of predefined errors; and second descriptive information regarding how to correct the predefined errors.In some embodiments, the output information includes a first code representation written in a first language, and the providing module 440 is further configured to convert the first code representation written in the first language into a second code representation written in a second language corresponding to a target development platform; and provide a target shader generated based on the second code representation in the target development platform. In some embodiments, the input information is first input information, and the information generation module 420 is further configured to generate second input information for the language model based on the description information; obtain guidance information corresponding to the generated shader generated by the language model based on the second input information; and generate the first input information for the target model based on the guidance information and the specification information. In some embodiments, the providing module 440 is further configured to display a configuration interface associated with the target shader, the configuration interface including a set of parameter adjustment controls for controlling a set of parameters of the target shader. In some embodiments, the providing module 440 is further configured to display an editing interface associated with the target shader, the editing interface including at least one node corresponding to the target shader. In some embodiments, the providing module 440 is further configured to modify the target shader based on an editing operation received in the editing interface. In some embodiments, the editing operation includes at least one of the following: modifying parameters of at least one node; modifying the code representation of at least one node; or modifying the connection relationship of at least one node. Figure 5 illustrates a block diagram of an electronic device 500 in which one or more embodiments of the present disclosure may be implemented. It should be understood that the electronic device 500 shown in Figure 5 is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. The electronic device 500 shown in Figure 5 can be used to implement the generation device 120 of Figure 1. As shown in Figure 5, the electronic device 500 is in the form of a general-purpose electronic device. Components of the electronic device 500 may include, but are not limited to, one or more processors or processing units 510, memory 520, storage device 530, one or more communication units 540, one or more input devices 550, and one or more output devices 560. The processing unit 510 may be a real or virtual processor and is capable of performing various processes according to a program stored in the memory 520.In a multi-processor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capabilities of electronic device 500. Electronic device 500 typically includes multiple computer storage media. Such media can be any removable media accessible to electronic device 500, including but not limited to volatile and non-volatile media, and removable and non-removable media. Memory 520 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 530 can be removable or non-removable and can include machine-readable media such as a flash drive, a magnetic disk, or any other media that can be used to store information and / or data (e.g., training data used for training) and can be accessed within electronic device 500. Electronic device 500 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown in FIG. 5 , a disk drive for reading from or writing to a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading from or writing to a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to a bus (not shown) via one or more data media interfaces. Memory 520 may include a computer program product 525 having one or more program modules configured to perform the various methods or actions of various embodiments of the present disclosure. Communication unit 540 enables communication with other electronic devices via a communication medium. Additionally, the functionality of the components of electronic device 500 may be implemented in a single computing cluster or multiple computing machines capable of communicating via a communication connection. Thus, electronic device 500 may operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or other network nodes. Input device 550 may be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 560 may be one or more output devices, such as a display, speaker, printer, etc.The electronic device 500 can also communicate with one or more external devices (not shown) via the communication unit 540 as needed. These external devices, such as storage devices, display devices, or other devices that enable user interaction with the electronic device 500, or any device that enables the electronic device 500 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication can be performed via an input / output (I / O) interface (not shown). According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, having computer-executable instructions stored thereon. The computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided. The computer program product is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions. The computer-executable instructions are executed by a processor to implement the method described above. Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to the present disclosure. It should be understood that each block in the flowcharts and / or block diagrams, as well as combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions. These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine. When these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowcharts and / or block diagrams. These computer-readable program instructions can also be stored in a computer-readable storage medium. These instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowcharts and / or block diagrams.Computer-readable program instructions can be loaded onto a computer, other programmable data processing device, or other device, causing the computer, other programmable data processing device, or other device to execute a series of operational steps to produce a computer-implemented process. Consequently, the instructions executed on the computer, other programmable data processing device, or other device implement the functions / actions specified in one or more blocks in the flowcharts and / or block diagrams. The flowcharts and block diagrams in the accompanying drawings illustrate possible architectures, functions, and operations of systems, methods, and computer program products according to various implementations of the present disclosure. In this regard, each block in the flowcharts or block diagrams may represent a module, program segment, or portion of an instruction, each of which contains one or more executable instructions for implementing the specified logical functions. In some alternative implementations, the functions noted in the blocks may occur in a different order than that noted in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, or 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 flow charts, as well as combinations of blocks in the block diagrams and / or flow charts, can be implemented using a dedicated hardware-based system that performs the specified functions or actions, or can be implemented using a combination of dedicated hardware and computer instructions. Various implementations of the present disclosure have been described above. The above description is illustrative, not exhaustive, and is not intended to limit the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is selected to best explain the principles, practical applications, or improvements to existing technologies of the various implementations, or to enable others skilled in the art to understand the various implementations disclosed herein.
Claims
Claims 1. A method for generating a shader, comprising: Get the description information about the shader to be generated; Generating input information of a target model based on the description information and specification information associated with shader generation; Acquire output information generated by the target model at least based on the input information; And based on the output information, a target shader is provided.
2. The method according to claim 1, wherein the specification information indicates at least one of the following: descriptive information about a programming language used to generate the shader; a set of built-in variables associated with shader generation; a code template associated with shader generation.
3. The method of claim 1 , wherein providing a target shader based on the output information comprises: Performing target processing on the output information to obtain target code; And providing the target shader generated based on the target code.
4. The method according to claim 3, wherein performing target processing on the output information comprises: providing guidance information to the target model; and obtaining the target code generated by the target model based on the guidance information and in accordance with the output information.
5. The method according to claim 4, wherein the guidance information includes at least one of the following: first guidance information, wherein the first guidance information is used to instruct the target model to perform a specified type of processing on the input information; second guidance information, wherein the second guidance information includes reference information for the target model to generate the target code.
6. The method according to claim 5, wherein the reference information includes at least the following: One: first descriptive information associated with a set of predetermined errors; second descriptive information on how to correct the predetermined errors.
7. The method of claim 1, wherein the output information comprises a first code representation written in a first language, and providing a target shader comprises: converting the first code representation written in the first language into a second code representation written in a second language, the second language corresponding to a target development platform; And providing the target shader generated based on the second code representation in the target development platform.
8. The method according to claim 1, wherein the input information is first input information, and generating the input information of the target model based on the description information and specification information associated with shader generation comprises: Based on the description information, generating second input information to a language model; Obtaining guidance information corresponding to generating the shader, which is generated by the language model based on the second input information; and generating the first input information to the target model based on the guidance information and the specification information.
9. The method according to claim 1, wherein providing a target shader comprises: displaying a configuration interface associated with the target shader, the configuration interface comprising a set of parameter adjustment controls for controlling a set of parameters of the target shader.
10. The method of claim 1, wherein providing a target shader comprises: An editing interface associated with the target shader is displayed, wherein the editing interface includes at least one node corresponding to the target shader.
11. The method according to claim 10, further comprising: Based on the editing operation received in the editing interface, the target shader is modified.
12. The method according to claim 11, wherein the editing operation comprises at least one of the following: modifying a parameter of the at least one node; modifying a code representation of the at least one node; Modify the connection relationship of the at least one node.
13. A device for generating a shader, comprising: A description acquisition module, configured to acquire description information about a shader to be generated; An information generation module configured to generate input information of a target model based on the description information and specification information associated with shader generation; an output acquisition module, configured to acquire output information generated by the target model at least based on the input information; And a providing module is configured to provide a target shader based on the output information.
14. An electronic device, comprising: at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to execute the method according to any one of claims 1 to 12 when executed by the at least one processing unit.
15. A computer-readable storage medium having a computer program stored thereon, wherein the computer program can be executed by a processor to implement the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Method and device for rendering material effect
CN115018964A
Shader code generation method and device, equipment and storage medium
CN116088814A
Shader script generation method and device, electronic equipment and storage medium
CN116416355A
System, method and computer program product for generating a shader program
US20030179220A1
System and method for implementing graphics processing unit shader programs using snippets
US7750913B1