A templated method and terminal for visual shader editing

Split the shader into modules through the template method, which reduces the learning cost of editing complex shaders, improves development efficiency, and simplifies parameter adjustment and repeated development process.

CN116342723BActive Publication Date: 2025-08-01FUJIAN TQ ONLINE INTERACTIVE INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111589446.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-23
Publication Date
2025-08-01
Estimated Expiration
2041-12-23

AI Technical Summary

Technical Problem

The existing visual shader editing process is too complex when restoring real scenes, resulting in high editing costs and low efficiency.

Method used

Using the template method, the shader template is created by selecting the parameters and modules required by the shader, and making it into the main node input interface for visual editing, receiving and generating a custom calculation process to obtain the templated shader file.

Benefits of technology

It reduces the learning cost of shader resource editing, improves development efficiency, makes the modular calculation of complex shaders easier to perform, and simplifies parameter adjustment and repeated development process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116342723B_ABST
    Figure CN116342723B_ABST
Patent Text Reader

Abstract

A templating method and a terminal for visual shader editing disclose that, according to editing requirements, parameters required by a shader and corresponding shader modules are selected, and a shader template is made according to the logical relationship between the required shader modules; each shader module in the shader template is made into an input interface of a main node for visual editing; the calculation process of each custom shader template is received and generated to obtain a templated shader file. Therefore, complex shaders are made into templates, and each module is split out for separate calculation. Developers do not need to additionally understand how the modules calculate the influence on each other, and only need to focus on defining the calculation process inside each module, reducing the learning cost of shader resource editing and improving the development efficiency. On the other hand, separate calculation of different modules is also easier in terms of repeated development and adjusting rendering effects by switching shader parameters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer graphics technology, and particularly relates to a templating method and a terminal for visual shader editing. Background Art

[0002] A shader is a programmable part in an image rendering pipeline. By editing the shader, various image effects can be achieved without being restricted by the fixed rendering pipeline of the graphics card. The emergence of visual shader editing enables editors to edit shaders without having to learn the corresponding programming language. Instead, by connecting the shader-related attributes and calculations provided by the GUI interface into a connection graph and providing it to the shader code editing module, the program reads the connections made by the editor and finally generates shader code in a certain language.

[0003] Although visual shader editing can relieve editors from learning shader programming languages, when it comes to editing shaders for restoring real-world scenes, such as using shaders to describe certain materials and needing to restore the influence of light on the materials in the real world through attributes such as the smoothness and metallicity of the materials, it is very difficult to edit shaders with a rather complex visual editing process. Summary of the Invention

[0004] The technical problem to be solved by the present invention is: to provide a templating method and a terminal for visual shader editing, which can reduce the learning cost of shader resource editing and improve development efficiency.

[0005] To solve the above technical problem, the technical solution adopted by the present invention is:

[0006] A templating method for visual shader editing, comprising the steps of:

[0007] Select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and make a shader template according to the logical relationship between the required shader modules;

[0008] Make each of the shader modules in the shader template into an input interface of the main node for visual editing;

[0009] Receive and generate the calculation process of each of the shader modules customized to obtain a templated shader file.

[0010] To solve the above technical problem, another technical solution adopted by the present invention is:

[0011] A templating terminal for visual shader editing, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0012] Select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and create a shader template based on the logical relationship between the required shader modules;

[0013] Make each of the shader modules in the shader template into an input interface of the main node for visual editing;

[0014] Receive and generate the calculation process of each customized shader module to obtain a templated shader file.

[0015] The beneficial effects of the present invention are as follows: Select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and create a shader template based on the logical relationship between the required shader modules; Make each shader module in the shader template into an input interface of the main node for visual editing; Receive and generate the calculation process of each customized shader template to obtain a templated shader file. Therefore, complex shaders are made into templates, and each module is split out for separate calculation. Developers do not need to additionally understand how the modules calculate the mutual influence between them, and only need to focus on defining the calculation process inside each module, reducing the learning cost of shader resource editing and improving the development efficiency. On the other hand, different modules are calculated separately, which is also easier in terms of repeated development and adjusting the rendering effect by switching shader parameters. Description of the Drawings

[0016] Figure 1 It is a flowchart of a templating method for visual shader editing according to an embodiment of the present invention;

[0017] Figure 2 It is a schematic diagram of a templating terminal for visual shader editing according to an embodiment of the present invention;

[0018] Figure 3 It is a main node structure diagram of a templating method for visual shader editing according to an embodiment of the present invention;

[0019] Figure 4 It is a schematic diagram of the main node of a templating method for visual shader editing according to an embodiment of the present invention;

[0020] <G Figure 5 It is a schematic diagram of the connection diagram of each module of a templating method for visual shader editing according to an embodiment of the present invention being connected to the main node;

[0021] Label Description:

[0022] 1. A templating terminal for visual shader editing; 2. Memory; 3. Processor. Detailed Embodiment

[0023] To illustrate the technical content, achieved objectives, and effects of the present invention in detail, the following is described in conjunction with embodiments and with reference to the accompanying drawings.

[0024] Please refer to Figure 1 、 Figures 3 to 5 , an embodiment of the present invention provides a templating method for visual shader editing, including the steps of:

[0025] Select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and create a shader template according to the logical relationship between the required shader modules;

[0026] Make each of the shader modules in the shader template into an input interface of the main node for visual editing;

[0027] Receive and generate the calculation process of each of the custom shader modules to obtain a templated shader file.

[0028] As can be seen from the above description, the beneficial effects of the present invention are as follows: Select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and create a shader template according to the logical relationship between the required shader modules; Make each of the shader modules in the shader template into an input interface of the main node for visual editing; Receive and generate the calculation process of each of the custom shader templates to obtain a templated shader file. Therefore, complex shaders are made into templates, and each module is split out for separate calculation. Developers do not need to additionally understand how the modules calculate the influence on each other, and only need to focus on defining the calculation process inside each module, reducing the learning cost of shader resource editing and improving development efficiency. On the other hand, different modules are calculated separately, which is also easier in terms of repeated development and adjusting the rendering effect by switching shader parameters.

[0029] Further, the selecting the parameters required for the shader and the corresponding shader modules according to the editing requirements includes:

[0030] Select the shader to be templated, and select the parameters required for calculating and editing the shader;

[0031] Find the corresponding shader modules according to the required parameters.

[0032] As can be seen from the above description, after selecting the shader to be templated, select the parameters required for calculating and editing the shader, and find the corresponding shader modules according to the required parameters. Therefore, the required shader modules can be determined according to the actual editing requirements, and complex shaders can be simplified according to the actual needs.

[0033] Further, the creating a shader template according to the logical relationship between the required shader modules includes:

[0034] Extract and retain the calculation order and parameter interaction method between the required shader modules;

[0035] Create a shader template based on the required shader modules and their calculation order and parameter interaction method.

[0036] As can be seen from the above description, extract and retain the calculation order and parameter interaction method between the required shader modules, and create a shader template in combination with the shader modules. Therefore, the shader template contains the logical relationship between the shader modules. Therefore, developers do not need to additionally understand how each module calculates the influence on each other, and only need to focus on defining the calculation process inside each module subsequently, improving the development efficiency.

[0037] Furthermore, making each of the shader modules in the shader template into an input interface of a main node for visual editing includes:

[0038] Create a main node for visual editing according to each required shader module in the shader template;

[0039] Make each required shader module into an input interface of the main node.

[0040] As can be seen from the above description, create a main node for visual editing according to each required shader module, that is, the main node is composed of each required shader module, and make each required shader module into an input interface of the main node. Therefore, the shader template can be used in the main node.

[0041] Furthermore, the receiving and generating the calculation process of each of the custom shader modules to obtain a templated shader file includes:

[0042] Receive the connection graph customarily obtained by the user in each of the shader modules by selecting and connecting calculation nodes or parameter nodes;

[0043] Generate the calculation process and required custom parameters of each of the shader modules according to the shader template and the connection graph to obtain a templated shader file.

[0044] As can be seen from the above description, receive the connection graph customarily obtained by the user for each shader module by selecting and connecting calculation nodes or parameter nodes, and generate the calculation process and required custom parameters of the shader module according to the shader template and the connection graph. Therefore, developers only need to perform visual editing on the calculation nodes and parameter nodes inside the module to obtain a shader file, further improving the development efficiency.

[0045] Please refer to Figure 2, an embodiment of the present invention provides a templated terminal for visual shader editing, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:

[0046] Select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and create a shader template according to the logical relationship between the required shader modules;

[0047] Make each of the shader modules in the shader template into an input interface of the main node for visual editing;

[0048] Receive and generate the calculation process of each of the custom shader modules to obtain a templated shader file.

[0049] As can be seen from the above description, select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and create a shader template according to the logical relationship between the required shader modules; make each of the shader modules in the shader template into an input interface of the main node for visual editing; receive and generate the calculation process of each of the custom shader templates to obtain a templated shader file. Therefore, complex shaders are made into templates, and each module is split out for separate calculation. Developers do not need to additionally understand how the modules calculate the influence on each other, and only need to focus on defining the calculation process inside each module, reducing the learning cost of shader resource editing and improving the development efficiency. On the other hand, different modules are calculated separately, and it is also easier to repeat development and adjust the rendering effect by switching shader parameters.

[0050] Further, the selecting the parameters required for the shader and the corresponding shader modules according to the editing requirements includes:

[0051] Select the shader to be templated, and select the parameters required for calculating and editing the shader;

[0052] Find the corresponding shader modules according to the required parameters.

[0053] As can be seen from the above description, after selecting the shader to be templated, select the parameters required for calculating and editing the shader, and find the corresponding shader modules according to the required parameters. Therefore, the required shader modules can be determined according to the actual editing requirements, and complex shaders can be simplified according to the actual needs.

[0054] Further, the creating a shader template according to the logical relationship between the required shader modules includes:

[0055] Extract and retain the calculation order and parameter interaction method between the required shader modules;

[0056] Create a shader template according to the required shader modules, their calculation order, and parameter interaction methods.

[0057] As can be seen from the above description, extract and retain the calculation order and parameter interaction methods between the required shader modules, and create a shader template in combination with the shader modules. Therefore, the shader template contains the logical relationships between the shader modules. Thus, developers do not need to additionally understand how the modules calculate the mutual influence, and only need to focus on defining the calculation process inside each module subsequently, improving the development efficiency.

[0058] Furthermore, making each of the shader modules in the shader template into an input interface of the main node for visual editing includes:

[0059] Create a main node for visual editing according to each required shader module in the shader template;

[0060] Make each required shader module into an input interface of the main node.

[0061] As can be seen from the above description, create a main node for visual editing according to each required shader module, that is, the main node is composed of each required shader module, and make each required shader module into an input interface of the main node. Therefore, the shader template can be used in the main node.

[0062] Furthermore, the receiving and generating the calculation process of each of the custom shader modules to obtain a templated shader file includes:

[0063] Receive the connection graph customarily obtained by the user for each shader module by selecting and connecting calculation nodes or parameter nodes;

[0064] Generate the calculation process and required custom parameters of each shader module according to the shader template and the connection graph to obtain a templated shader file.

[0065] As can be seen from the above description, receive the connection graph customarily obtained by the user for each shader module by selecting and connecting calculation nodes or parameter nodes, and generate the calculation process and required custom parameters of the shader module according to the shader template and the connection graph. Therefore, developers only need to perform visual editing on the calculation nodes and parameter nodes inside the module to obtain the shader file, further improving the development efficiency.

[0066] The present invention discloses a templating method and a terminal for visual shader editing, which are applicable to templating complex shaders. Therefore, complex shaders are made into templates, and each module is split out for separate calculation. Developers do not need to additionally understand how the modules calculate the mutual influence, but only need to focus on defining the parameters and calculation processes required for each module, reducing the learning cost of shader resource editing and improving the development efficiency. The following is an illustration through specific implementation manners:

[0067] Embodiment 1

[0068] Please refer to Figure 1 、 Figures 3 to 5 , a templating method for visual shader editing, comprising the steps of:

[0069] S1. Select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and make a shader template according to the logical relationship between the required shader modules.

[0070] S11. Select the shader to be templated and select the parameters required for calculating and editing the shader.

[0071] Specifically, taking a physically based surface shader as an example, this shader is used to define the surface material and determine how to combine texture and lighting information to generate the pixels of the rendered object on the screen. The basis of a surface material shader is the vertex position, diffuse color, and self-illumination of the object. The physically based lighting part requires setting parameters such as the vertex normal, metallicity, smoothness, and ambient light influence rate of the object.

[0072] S12. Find the corresponding shader modules according to the required parameters.

[0073] Specifically, according to parameters such as vertex position, diffuse color, self-illumination, vertex normal, metallicity, smoothness, and ambient light influence rate, find the shader modules corresponding to each parameter.

[0074] S13. Extract and retain the calculation order and parameter interaction mode between the required shader modules, and make a shader template according to the required shader modules and their calculation order and parameter interaction mode.

[0075] Specifically, extract the calculation logic between the above-found shader modules, and the shader code provides a function for saving the results of these module calculation processes. Use the modified shader as the template for the surface lighting shader.

[0076] S2. Make each of the shader modules in the shader template into an input interface of the main node for visual editing.

[0077] Specifically, step S2 includes:

[0078] Create a main node for visual editing according to each required shader module in the shader template, and make each required shader module into an input interface of the main node.

[0079] In this embodiment, please refer to Figure 3 and Figure 4 to create a main node for visual editing of a surface lighting shader. The vertex position module is used to define the rendering position of the object or create vertex animations. The vertex normal module is used to calculate the reflection direction of light, etc. The diffuse color module is used to define the color of the object itself. The self-illumination module is used to define the color of the object that is not affected by light. The metallicity and smoothness jointly control the reflectivity of the object's surface and the degree of light reflection.

[0080] S3. Receive and generate the calculation process of each of the custom shader modules to obtain a templated shader file.

[0081] S31. Receive the connection graph customarily obtained by the user according to the selection and connection of calculation nodes or parameter nodes in each of the shader modules.

[0082] Specifically, please refer to Figure 5 . The editor provides a series of input parameter nodes and calculation nodes through the visual shader editor, connects the custom calculations of each module in sequence and finally connects them into the corresponding module interfaces to form a node graph, and continuously adjusts the parameters and calculations according to the preview to achieve the expected effect.

[0083] Among them, parameter nodes and nodes that directly obtain partial results in the rendering process only have output interfaces. Calculation nodes include input interfaces and output interfaces. The main node only has input interfaces. When the editor drags an interface, a connection line will appear. Therefore, a node graph is formed by dragging the interface to the required interface. Among them, input interfaces cannot be connected to input interfaces, output interfaces cannot be connected to output interfaces, and the output data type will be automatically converted according to the user's connection.

[0084] S32. Generate the calculation process and required custom parameters of each of the shader modules according to the shader template and the connection graph to obtain a templated shader file.

[0085] Specifically, after the editor finishes editing, it sequentially obtains the node graph connected to each module input interface of the main node, and generates the corresponding parameters and calculation codes and fills them into the corresponding parts of each module of the shader template to generate a custom complex physically based surface material shader file.

[0086] Embodiment 2

[0087] Please refer to Figure 2, A templated terminal for visual shader editing, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements each step of a templated method for visual shader editing in Embodiment 1.

[0088] In summary, for a templated method and terminal for visual shader editing provided by the present invention, after selecting the shader to be templated, select the parameters required for shader calculation and editing requirements, and find the corresponding shader modules according to the required parameters, so as to determine the required shader modules according to the actual editing requirements, thus simplifying complex shaders; make a shader template according to the logical relationship between the required shader modules; make each shader module in the shader template into the input interface of the main node for visual editing; receive and generate the calculation process of each custom shader template to obtain a templated shader file, where it is necessary to receive the connection diagram customized by the user for each shader module by selecting and connecting calculation nodes or parameter nodes, and generate the shader module calculation process and the required custom parameters according to the shader template and the connection diagram. Therefore, developers only need to perform visual editing on the calculation nodes and parameter nodes inside the module to obtain the shader file. It can be seen that the present invention makes complex shaders into templates, and each module is split out for separate calculation. Developers do not need to additionally understand how the modules calculate the influence on each other. They only need to focus on defining the calculation process inside each module, reducing the learning cost of shader resource editing and improving the development efficiency. On the other hand, different modules are calculated separately, which is also easier in terms of repeated development and adjusting the rendering effect by switching shader parameters.

[0089] The above are only the embodiments of the present invention, and do not limit the patent scope of the present invention. Any equivalent transformation made using the content of the specification and drawings of the present invention, or directly or indirectly applied in the relevant technical fields, shall be equally included in the patent protection scope of the present invention.

Claims

1. A templated method for visual shader editing, characterized in that, Including the steps: Select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and create a shader template based on the logical relationship between the required shader modules: Extract and retain the calculation order and parameter interaction method between the required shader modules, and create a shader template according to the required shader modules and their calculation order and parameter interaction method; Make each of the shader modules in the shader template into an input interface of the main node for visual editing: Create a main node for visual editing according to each required shader module in the shader template, and make each required shader module into the input interface of the main node; Receive and generate the calculation process of each customized shader module to obtain a templated shader file: Receive the connection graph customized by the user according to the selection and connection of calculation nodes or parameter nodes in each shader module, and generate the calculation process and required customized parameters of each shader module according to the shader template and the connection graph to obtain a templated shader file.

2. A templating method for visual shader editing according to claim 1, characterized in that The selection of the parameters required for the shader and the corresponding shader modules according to the editing requirements includes: Select the shader to be templated and select the parameters required for the calculation editing of the shader; Find the corresponding shader module according to the required parameters.

3. A templated terminal for visual shader editing, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, the following steps are implemented: Select the parameters required for the shader and the corresponding shader modules according to the editing requirements, and create a shader template based on the logical relationship between the required shader modules: Extract and retain the calculation order and parameter interaction method between the required shader modules, and create a shader template according to the required shader modules and their calculation order and parameter interaction method; Make each of the shader modules in the shader template into an input interface of the main node for visual editing: Create a main node for visual editing according to each required shader module in the shader template, and make each required shader module into the input interface of the main node; Receive and generate the calculation process of each customized shader module to obtain a templated shader file: Receive the connection graph customized by the user according to the selection and connection of calculation nodes or parameter nodes in each shader module, and generate the calculation process and required customized parameters of each shader module according to the shader template and the connection graph to obtain a templated shader file.

4. A templated terminal for visual shader editing according to claim 3, characterized in that, The selection of the parameters required for the shader and the corresponding shader modules according to the editing requirements includes: Select the shader to be templated and select the parameters required for the calculation editing of the shader; Find the corresponding shader module according to the required parameters.

Citation Information

Patent Citations

  • Advanced material synthetic system and method based on visualization edition

    CN102760304A

  • Visual programming-based cross-platform rendering effect edition system

    CN108597014A