Method and device for generating shader, equipment and storage medium
By obtaining description 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 of shaders is realized automatically, and efficiency is improved.
Patent Information
- Application Number
- CN202311036105.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-16
- Publication Date
- 2025-02-21
AI Technical Summary
The prior art is inefficient when 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 through description information, improving the efficiency of shaders generation.
Smart Images

Figure CN119493553A_ABST
Abstract
Description
Technical Field
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to methods, devices, apparatuses, and computer-readable storage media for generating shaders. Background Art
[0002] 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 people to process media. Different shaders can, for example, apply corresponding processing effects to image content or video content. Summary of the invention
[0003] In a first aspect of the present disclosure, a method for generating a shader is provided. The method comprises: 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.
[0004] In a second aspect of the present disclosure, a device for generating a shader is provided. The device includes: 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 based at least on the input information; and a providing module configured to provide a target shader based on the output information.
[0005] 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, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. When the instructions are executed by the at least one processing unit, the device executes the method of the first aspect.
[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect.
[0007] It should be understood that the contents described in this content section are not intended to limit the key features or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] The above and other features, advantages and aspects of the 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, the same or similar reference numerals represent the same or similar elements, wherein:
[0009] Figure 1 A schematic diagram showing an example environment in which embodiments according to the present disclosure may be implemented;
[0010] Figure 2 A flowchart showing an example process for generating a shader in accordance with some embodiments of the present disclosure is shown;
[0011] Figure 3A and Figure 3B shows an example interface according to some embodiments of the present disclosure;
[0012] Figure 4 A schematic structural block diagram of an apparatus for generating a shader according to some embodiments of the present disclosure is shown; and
[0013] Figure 5 A block diagram of an electronic device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0014] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0015] It should be noted that the titles of any sections / subsections provided herein are not restrictive. Various embodiments are described throughout this article, and any type of embodiment may be included under any section / subsection. In addition, the embodiments described in any section / subsection may be combined in any manner with any other embodiments described in the same section / subsection and / or different sections / subsections.
[0016] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "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.
[0017] The embodiments of the present disclosure may involve user data, data acquisition and / or use, etc. These aspects are subject to the corresponding laws, regulations and relevant provisions. In the embodiments of the present disclosure, all data collection, acquisition, processing, processing, forwarding, use, etc. are carried out on the premise that the user knows and confirms. Accordingly, when implementing each embodiment of the present disclosure, the type, scope of use, usage scenario, etc. of the data or information that may be involved should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with the relevant laws and regulations. The specific notification and / or authorization method can vary according to the actual situation and application scenario, and the scope of the present disclosure is not limited in this respect.
[0018] In this specification and the embodiments, if personal information processing is involved, it will be processed on the premise of having a legal basis (such as obtaining the consent of the subject of personal information, or it is necessary to perform a contract, etc.), and will only be processed within the scope of regulations or agreements. If a user refuses to process personal information other than the necessary information for basic functions, it will not affect the user's use of basic functions.
[0019] As mentioned above, shaders are important tools for people to process media. Different shaders can, for example, apply corresponding processing effects to image content or video content. Some special effects development platforms, for example, support developers to generate corresponding shaders through code. However, such efficiency is usually low and has high requirements on the professional ability of developers.
[0020] The embodiment of the present disclosure proposes a scheme for generating a shader. According to the scheme, description information about the shader to be generated is obtained; input information of a target model is generated based on the description information and specification information associated with shader generation; output information generated by the target model based on at least the input information is obtained; and a target shader is provided based on the output information.
[0021] Based on the above approach, the embodiments of the present disclosure can support automatic generation of corresponding shaders through description information, thereby improving the generation efficiency of shaders.
[0022] Various example implementations of the solution are described in detail below in conjunction with the accompanying drawings.
[0023] Example Environment
[0024] Figure 1 1 is a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. Figure 1As shown, the example environment 100 may include a generation device 120. As will be described in detail below, the generation device 120 may obtain description information 110 input by a user, and generate a shader 140 corresponding to the description information 110 accordingly.
[0025] In some embodiments, the generation device 120 may provide a corresponding shader 140 based on the description information 110 and using the target model 130. It should be understood that such a target model 130 may include an appropriate machine learning model, which may include a language model, for example. In some embodiments, the target model 130 may be deployed locally on the generation device 120, or deployed at a different remote location.
[0026] In some embodiments, the generating device 120 can be any type of mobile terminal, fixed terminal or portable terminal, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, handheld computers, portable game terminals, VR / AR devices, personal communication systems (PCS) devices, personal navigation devices, personal digital assistants (PDA), audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio broadcast receivers, e-book devices, game devices, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. In some embodiments, the generating device 120 can also support any type of interface for the user (such as "wearable" circuits, etc.).
[0027] In some other examples, the generating device 120 may be, for example, an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, as well as big data and artificial intelligence platforms.
[0028] It should be understood that the structure and function of the various elements in the environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure.
[0029] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.
[0030] Example Process
[0031] Figure 2FIG. 3 is a flowchart showing an example process 200 for generating a shader according to some embodiments of the present disclosure. The process 300 may be implemented at the generating device 120. Figure 1 The process 200 is described below.
[0032] like Figure 2 As shown, in block 210 , the generating device 120 obtains description information 110 about the shader to be generated.
[0033] In some embodiments, the generation device 120 may provide a shader development tool to a user (eg, a developer), for example. Such a shader development tool may be an independent application or may be integrated into some development platforms (eg, a special effects development platform).
[0034] Exemplarily, the generating device 120 may provide the user with an input entry for inputting the description information 110. It should be understood that the description information 110 may be input in any suitable manner, examples of which may include but are not limited to: text input, voice input, input based on selection controls, and the like.
[0035] It should be understood that such description information 110 may be text content based on natural language, which may be used to describe the purpose of the shader to be generated.
[0036] Additionally, such description information 110 may also include, for example, at least one constraint information about 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 the like.
[0037] Continue to refer Figure 2 , in block 220 , the generation device 120 generates input information of the target model 130 based on the description information 110 and specification information associated with shader generation.
[0038] In some embodiments, the generating device 120 may construct input information of 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.
[0039] In some embodiments, the specification information may include appropriate information for guiding the target model to generate a code representation corresponding to the shader according to preset requirements.
[0040] Exemplarily, the specification information may include descriptive information about the programming language used to generate the shader. For example, the specification information may be used to 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, etc. of the programming language.
[0041] In some embodiments, such a programming language may also be a custom language, for example. 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 the GLSL syntax.
[0042] In some embodiments, the specification information may also include a set of built-in variables associated with shader generation, also referred to as builtin uniforms. Such a set of built-in variables may be, for example, variables that can be directly used by the shader to be generated.
[0043] In some embodiments, the specification information may further include a code template associated with shader generation. The code template may include a preset code portion and a code portion to be generated by the target model.
[0044] In some embodiments, other examples of specification information may also include: definition information of the application programming interface (API) associated with node generation, relevant documentation of the API, code representation of the API, instructions for using the API, examples of using the API, etc.
[0045] In some embodiments, the generating device 120 may also use a language model to generate input information of the target model 130. In some scenarios, the description information 110 input by the user may be too concise, which may make it difficult to effectively know the target model 130 to generate a corresponding shader.
[0046] In some embodiments, the generating device 120 may generate input information to the language model based on the received description information 110. For example, such input information may be used to instruct the language model to generate guidance information for generating a shader of the target model 130 according to the description information 110, also referred to as a prompt.
[0047] It should be understood that the language model may be the same as or different from the target model 130 , and the present disclosure is not intended to be limited in this regard.
[0048] Furthermore, the generation device 120 may obtain the guidance information generated by the language model based on the received input information. Such guidance information corresponds to the generated shader, and is used to guide the target model 130 to generate the corresponding shader. In this way, when the received description information 110 has less content, more effective guidance words can be generated by the language model, thereby improving the efficiency of shader generation.
[0049] Further, the generating device 120 may generate input information of the target model 130 based on the guide information output by the language model and the specification information discussed above.
[0050] In block 230 , the generating device 120 obtains output information generated by the target model 130 based on at least the input information.
[0051] In some embodiments, the generating device 120 may receive output information generated by the target model 130 based on the input information. Such output information may include, for example, code representation written in a specified programming language.
[0052] Further, at block 240 , the generation device 120 provides a target shader 140 based on the output information.
[0053] In some embodiments, the generation device 120 may provide a corresponding target shader 140 based on the code representation in the output information.
[0054] In some embodiments, considering that the output result of the target model 130 may have some errors, the generation device 120 may also perform target processing on the output information to obtain the target code. Further, the generation device 120 may provide a target shader 140 generated based on the target code.
[0055] In some embodiments, the generating device 120 may perform appropriate target processing such as error checking on the code representation in the output information locally to obtain optimized target code. For example, the generating device 120 may perform error correction processing on the code representation according to a preset error correction strategy.
[0056] In some other embodiments, the generating device 120 may also perform target processing using the target model 130. Specifically, the generating device 120 may provide the target model 130 with guidance information for instructing 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.
[0057] In some examples, the guidance information provided to the 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, the generating device 120 may send a guide word to the target model 130 for further checking whether the generated input information has errors and optimizing it.
[0058] In other examples, the guidance information provided to the target model 130 may also include reference information for the target model to generate target code. For example, the generating device 120 may send guidance information to the target model 130 on how to perform target processing such as error processing.
[0059] Exemplarily, such reference information may include first description information associated with a set of preset errors. For example, such a set of preset errors may include historical errors checked from historical output information automatically generated by the target model 130. Such first description information may include descriptions of such historical errors, for example, what code snippets may have such errors.
[0060] As another example, such reference information may include second description information on how to correct a preset error. For example, the generating device 120 may also provide the target model 130 with a description text or example on how to correct the corresponding error, thereby guiding the target model 130 to perform an optimization process such as error handling on the output information.
[0061] In this way, the embodiments of the present disclosure can further improve the quality of the final result output by the target model 130 , thereby improving the generation efficiency and quality of the shader.
[0062] As described above, the output information (before or after optimization) provided by the target model 130 may include a code representation written in a specified programming language. In some embodiments, in order to improve the accuracy of the target model 130 generation, such output information may correspond to a first code representation written in a first language, for example. Such a first language may be, for example, a programming language known to the target model 130.
[0063] Further, the generating device 120 can convert such a first code representation into a second code representation written in a second language. Such a second language can, for example, correspond to a target development platform to be applied to the shader. For example, in some scenarios, the target development platform may be developed using a custom language, and such a custom language may be unfamiliar or unknown to the target model 130. Directly generating a code representation in the second language using the target model 130 may be inefficient and prone to errors. By generating a code representation in an intermediate language and further performing code conversion, the generation quality of the shader can be improved.
[0064] Further, after completing the generation of the code representation of the shader, the generation device 120 may provide a corresponding target shader 140 . In some embodiments, the generation device 120 may display a configuration interface associated with the target shader 140 . Figure 3A An example configuration interface 300A is shown in accordance with some embodiments of the present disclosure.
[0065] like Figure 3A As shown, the configuration interface 300A may, for example, display a preview screen of such a target shader 140. Additionally, the configuration interface 300A may 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 a set of parameters may be determined based on the description information input by the user.
[0066] It should be understood that such parameter adjustment controls 305 may be of any appropriate control type, and the present disclosure is not intended to be limited in this regard.
[0067] As another example, the generation device 120 may also display an editing interface associated with the target shader 140 . Figure 3B An example editing interface 300B is shown in accordance with some embodiments of the present disclosure.
[0068] like Figure 3B As shown, in the editing interface 300B, the generating 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. Such multiple nodes may constitute a material graph. The material graph may support the user to define the corresponding shader by creating and editing nodes.
[0069] Further, the generating device 120 can also modify the target shader 140 based on the editing operation received in the editing interface 300B. Exemplarily, such editing operation includes modifying the parameters of at least one node. For example, the user can adjust the parameters of one or more nodes corresponding to the shader through the interface 300B.
[0070] Additionally or alternatively, such an editing operation may also include modifying the code representation of at least one node. As an example, a user may view the code representation corresponding to the node by clicking on the corresponding node, and may modify the code representation of the node at the code level.
[0071] Additionally or alternatively, such an editing operation may also include modifying the connection relationship of at least one node. For example, the user may modify the connection relationship between nodes by dragging the node connection line in the interface 300B, thereby completing the editing of the target shader 140.
[0072] Based on the above, the generation device 120 may provide the corresponding target shader 140 in different ways (eg, parameter configuration way or node way). In some embodiments, the way to provide the target shader 140 may depend on the configuration information of the user.
[0073] For example, if the user configures the current mode to be the first mode (e.g., the novice mode), the generation device 120 may provide the target shader 140 through parameter configuration. As another example, if the user configures the current mode to be the second mode (e.g., the advanced mode), the generation device 120 may provide the target shader 140 through a node method.
[0074] In some embodiments, the method by which the target shader 140 is provided may depend on, for example, the way in which the description information 110 is obtained. Exemplarily, if the user inputs the description information 110 through a first type of entry, the generation device 120 may provide the target shader 140 through parameter configuration. Such a first type of entry may be provided, for example, at the asset library level of the target development platform.
[0075] As another example, if the user inputs the description information 110 through the second type of entry, the generation device 120 may provide the target shader 140 in a node manner. Such a second type of entry may be provided at the material graph level, for example.
[0076] Based on the approach discussed above, the embodiments of the present disclosure can support users to automatically generate corresponding shaders by inputting description information, thereby improving the efficiency of generating shaders.
[0077] Example devices and equipment
[0078] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes. Figure 4 A schematic structural block diagram of a special effect production apparatus 400 according to some embodiments of the present disclosure is shown. The apparatus 400 may be implemented as or included in the generation device 120. Each module / component in the apparatus 400 may be implemented by hardware, software, firmware or any combination thereof.
[0079] like Figure 4As shown, the device 400 includes a description acquisition module 410, which is configured to obtain description information about the shader to be generated; an information generation module 420, which is configured to generate input information of the target model based on the description information and specification information associated with the shader generation; an output acquisition module 430, which is configured to obtain output information generated by the target model at least based on the input information; and a providing module 440, which is configured to provide a target shader based on the output information.
[0080] In some embodiments, the specification information indicates at least one of: description information about a programming language used to generate a shader; a set of built-in variables associated with shader generation; a code template associated with shader generation.
[0081] In some embodiments, the providing module 440 is further configured to: perform target processing on the output information to obtain a target code; and provide a target shader generated based on the target code.
[0082] 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 according to the output information.
[0083] In some embodiments, the guidance information includes at least one of the following: first guidance information, 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, the second guidance information includes reference information for the target model to generate target code.
[0084] In some embodiments, the reference information includes at least one of the following: first description information associated with a set of preset errors; and second description information on how to correct the preset errors.
[0085] In some embodiments, the output information includes a first code representation written in a first language, and the providing module 440 is also configured to: convert 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 provide a target shader generated based on the second code representation in the target development platform.
[0086] In some embodiments, the input information is first input information, and the information generation module 420 is further configured to: generate second input information to 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 first input information of the target model based on the guidance information and the specification information.
[0087] In some embodiments, the providing module 440 is further configured to: display 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.
[0088] In some embodiments, the providing module 440 is further configured to: display an editing interface associated with the target shader, where the editing interface includes at least one node corresponding to the target shader.
[0089] In some embodiments, the providing module 440 is further configured to modify the target shader based on the editing operation received in the editing interface.
[0090] In some embodiments, the editing operation includes at least one of the following: modifying a parameter of at least one node; modifying a code representation of at least one node; and modifying a connection relationship of at least one node.
[0091] Figure 5 1 shows 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 Figure 5 The electronic device 500 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. Figure 5 The electronic device 500 shown can be used to implement Figure 1 Generating device 120.
[0092] like Figure 5 As shown, the electronic device 500 is in the form of a general electronic device. The components of the electronic device 500 may include, but are not limited to, one or more processors or processing units 510, a memory 520, a 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 an actual 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 capability of the electronic device 500.
[0093] The electronic device 500 typically includes a plurality of computer storage media. Such media may be any accessible media that is accessible to the electronic device 500, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 520 may be a volatile memory (e.g., a register, a cache, a random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 530 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data (e.g., training data for training) and may be accessed within the electronic device 500.
[0094] The electronic device 500 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 5 As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. The memory 520 may include a computer program product 525 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.
[0095] The communication unit 540 implements communication with other electronic devices through a communication medium. Additionally, the functions of the components of the electronic device 500 can be implemented in a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 500 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0096] The input device 550 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 560 may be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 500 may also communicate with one or more external devices (not shown) through the communication unit 540 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 500, or communicate with any device that allows the electronic device 500 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).
[0097] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein 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, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
[0098] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0099] 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, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0100] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0101] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0102] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.
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; as well as 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; Code templates 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; as well as The target shader generated based on the target code is provided.
4. The method of claim 3, wherein performing target processing on the output information comprises: providing guidance information to the target model; as well as The target code generated by the target model based on the guidance information and according to the output information is obtained.
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 used by the target model to generate the target code.
6. The method according to claim 5, wherein the reference information comprises at least one of the following: first description information associated with a set of predetermined errors; Second description of how to correct the preset error.
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 corresponding to a target development platform; as well as The target shader generated based on the second code representation is provided 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 generated by the language model based on the second input information and corresponding to generating the shader; as well as Based on the guidance information and the specification information, the first input information to the target model is generated.
9. The method of claim 1 , wherein providing a target shader comprises: A configuration interface associated with the target shader is displayed, wherein the configuration interface includes 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: The target shader is modified based on the editing operation received in the editing interface.
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; as well as 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; as well as At least one memory, the at least one memory being 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 perform 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.