Material generation method, apparatus, and storage medium

By generating the input-output relationship between texture nodes and material nodes, the problem of limited material library is solved, enabling users to edit materials independently, meeting diverse needs, and improving the efficiency and scalability of material editing.

CN116702260BActive Publication Date: 2026-11-27HANGZHOU QUNHE INFORMATION TECHNOLOGIES CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310042078.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-12-20
Filing Date
2023-01-12
Publication Date
2026-11-27
Estimated Expiration
2043-01-12

AI Technical Summary

Technical Problem

The types of materials in the existing material library are relatively limited, which cannot meet the diverse needs of customers, making it difficult for designers to select suitable materials for decoration design.

Method used

By displaying material information, receiving editing instructions, generating the input-output relationship between texture nodes and material nodes, generating first and second shaders, and finally generating the target material, the system provides a material generation method, apparatus, and storage medium.

Benefits of technology

Users can freely edit and create materials to meet practical needs, reduce the difficulty of material editing, improve editing efficiency, and support material scalability and preview functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116702260B_ABST
    Figure CN116702260B_ABST
Patent Text Reader

Abstract

The application discloses a material generation method and device and a storage medium, relates to the technical field of simulation design, and comprises the following steps: displaying material information, wherein the material information comprises at least one of a map node, a material node and an adjustable variable; receiving an editing instruction for the material information, wherein the editing instruction is used for editing input and output of n map nodes and input and output of m material nodes, m and n are integers greater than or equal to 0; generating a first shader according to the input and output relationship of the n map nodes; generating a second shader according to the input and output relationship of the m material nodes; and generating a target material according to the n map nodes, the m material nodes, the first shader and the second shader. The problem that materials in a material library in the prior art cannot meet use requirements is solved, and the effect that users can freely edit and create materials to meet actual requirements is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a material generation method, apparatus, and storage medium, belonging to the field of simulation design technology. Background Technology

[0002] When designing interiors, designers typically need to select components made of different materials to simulate the design based on the needs of different clients.

[0003] In existing solutions, designers select materials from a material library that closely match the client's needs for interior design. However, the types of materials in the library are relatively limited, which may differ significantly from the client's requirements, leading to a failure to meet those needs. Summary of the Invention

[0004] The purpose of this invention is to provide a material generation method, apparatus, and storage medium to solve the problems existing in the prior art.

[0005] To achieve the above objectives, the present invention provides the following technical solution:

[0006] According to a first aspect, embodiments of the present invention provide a material generation method, the method comprising:

[0007] Display material information, which includes at least one of texture nodes, material nodes, and adjustable variables;

[0008] Receive editing instructions for the material information, the editing instructions are used to edit the input and output of n texture nodes and m material nodes, where m and n are integers greater than or equal to 0;

[0009] Based on the input-output relationship of the n texture nodes, a first shader is generated;

[0010] Based on the input-output relationship of the m material nodes, a second shader is generated;

[0011] The target material is generated based on the n texture nodes, the m material nodes, the first shader, and the second shader.

[0012] Optionally, generating the first shader based on the input-output relationship of the n texture nodes includes:

[0013] For each of the n texture nodes, generate a texture node class corresponding to the texture node. The texture node class includes the input, output, adjustable variables and shading information of the texture node. The shading information includes shader variables, shader reference code and shader fragments.

[0014] A texture node pipeline is generated based on the texture node classes of the n texture nodes, and the texture node pipeline includes the first shader generated based on the n texture node classes.

[0015] Optionally, generating the texture node pipeline based on the texture node classes of the n texture nodes includes:

[0016] Generate a first relationship graph of the n texture node classes based on the input-output relationship of the n texture nodes;

[0017] The first shader is generated based on the first relationship graph and the shading information in each texture node class. The shader is used to generate the rendering buffer for the texture nodes.

[0018] Optionally, generating the first shader based on the first relationship graph and the shading information in each texture node class includes:

[0019] Based on the first relationship graph, the shader reference code and shader variables in the n texture node classes are concatenated using a deduplication method;

[0020] The n texture node classes are sorted according to the breadth-first search method;

[0021] The first shader is obtained by concatenating the shader fragments of the n texture node classes according to the sorting.

[0022] Optionally, the method further includes:

[0023] The rendering buffer is obtained by compiling the first shader;

[0024] The rendering buffer displays intermediate texture nodes obtained by editing the n texture nodes.

[0025] Optionally, generating the second shader based on the input-output relationship of the m material nodes includes:

[0026] For each of the m material nodes, generate a material node class corresponding to the material node, wherein the material node class includes the input, output, configuration parameters and material model of the material node;

[0027] A material node pipeline is generated based on the material node classes of the m material nodes, and the material node pipeline includes the second shader generated based on the m material node classes.

[0028] Optionally, a material node pipeline is generated based on the material node classes of the m material nodes, including:

[0029] A second relationship graph is generated based on the input-output relationships of the m material node classes;

[0030] Based on the second relationship graph, the connection relationship between the material model shading template, the rendering buffer of the target texture node, and the output of the first shader in the m material node classes is constructed, thereby obtaining the second shader. The target texture node is the node among the n texture nodes whose input does not include the output of the texture node and whose output is used as the input of the material node.

[0031] Optionally, the method further includes:

[0032] The target material is saved according to preset rules, which include at least one of the following methods:

[0033] Save the node type, node identifier, input / output, and adjustable variables of the n texture nodes, and the node type, node identifier, input / output, and adjustable variables of the m material nodes;

[0034] or,

[0035] Save the material texture, material type, and material identifier of the target material.

[0036] In a second aspect, a material generation apparatus is provided, the apparatus including a memory and a processor, the memory storing at least one program instruction, the processor loading and executing the at least one program instruction to implement the method as described in the first aspect.

[0037] Thirdly, a computer storage medium is provided, wherein at least one program instruction is stored therein, the at least one program instruction being loaded and executed by a processor to implement the method as described in the first aspect.

[0038] By displaying material information, including at least one of texture nodes, material nodes, and adjustable variables; receiving editing instructions for the material information, the editing instructions are used to edit the input and output of n texture nodes and m material nodes, where m and n are integers greater than or equal to 0; generating a first shader based on the input and output relationship of the n texture nodes; generating a second shader based on the input and output relationship of the m material nodes; and generating a target material based on the n texture nodes, the m material nodes, the first shader, and the second shader. This solves the problem in existing technologies where the materials in the material library may not meet the usage requirements, achieving the effect that users can freely edit and create materials to meet actual needs.

[0039] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, the preferred embodiments of the present invention are described in detail below with reference to the accompanying drawings. Attached Figure Description

[0040] Figure 1 This is a flowchart of a material generation method provided in one embodiment of the present invention;

[0041] Figure 2 This is a schematic diagram illustrating a possible connection relationship between texture nodes according to an embodiment of the present invention;

[0042] Figure 3 This is a schematic diagram of a possible hybrid texture node provided in one embodiment of the present invention;

[0043] Figure 4 This is a schematic diagram of a possible material node provided in one embodiment of the present invention;

[0044] Figure 5 This is a possible schematic diagram of a material node for a PBR material provided in one embodiment of the present invention;

[0045] Figure 6 This is a possible principle block diagram of a material generation method provided in one embodiment of the present invention. Detailed Implementation

[0046] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0047] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0048] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0049] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0050] Please refer to Figure 1 It illustrates a flowchart of a material generation method provided in one embodiment of this application, such as... Figure 1 As shown, the method includes:

[0051] Step 101: Display material information, which includes at least one of texture nodes, material nodes, and adjustable variables;

[0052] The front-end interface can display material information. This material information includes at least one of texture nodes, material nodes, and adjustable variables. Both texture nodes and material nodes can have adjustable variables set, and these adjustable variables may be the same or different. Users can configure the adjustable variables according to their individual design needs.

[0053] Texture nodes are used for editing texture assets, consisting of inputs, outputs, and adjustable variables. Each texture node has zero or more inputs and at least one or more outputs. An input to a texture node can be connected to the output of another texture node, and an output can be connected to the inputs of multiple other texture nodes. Please refer to [reference needed]. Figure 2 This illustrates one possible input-output relationship between two texture nodes.

[0054] In one possible implementation, the connections between texture nodes cannot form a loop graph (for example, if the output of texture node A is connected to the input of texture node B, and the output of texture node B is connected to the input of texture node A, then a loop graph of texture node A and texture node B is formed). Adjustable variables can be any variables used by the shader, such as Boolean values, floating-point numbers, integers, vectors, and at least one of the textures.

[0055] Taking the texture node as a hybrid node as an example, its reference... Figure 3 The blending texture node contains two inputs, input A and input B, one output, and an adjustable variable, namely the blending ratio, which is a floating-point number with a value range of 0-1.

[0056] A material node represents a specific material. The output of a material node corresponds to the final procedural material. A material node can be any basic material, such as a self-illuminating material, a Blinn-Phong material, or a physically based material (PBR) material. In practice, it can also be a composite material, meaning it incorporates modifications to other materials, such as a hybrid material. Figure 4 As shown, a material node can contain zero or more inputs, which can be the output of a texture node or a material node. It contains one output, which is the final procedural material result. It can also contain zero or more adjustable variables.

[0057] Taking PBR material nodes as an example, please refer to... Figure 5 Its input can include a series of texture nodes such as diffuse, reflection, reflection glossiness, transparency, and displacement maps, but it does not include material nodes. It can also include adjustable variables such as Fresnel maps. Similar to texture nodes, material nodes cannot form loop graphs.

[0058] Step 102: Receive editing instructions for the material information. The editing instructions are used to edit the input and output of n texture nodes and m material nodes, where m and n are integers greater than or equal to 0.

[0059] After displaying material information on the front-end interface, if the currently displayed material does not include the material the user needs, the user can edit it according to their personal needs to create a material that meets their personal requirements. Correspondingly, the terminal can receive editing instructions through the front-end interface.

[0060] Optionally, this step includes receiving editing instructions for the material information. These editing instructions are user-triggered instructions to generate a target material based on n texture nodes and m material nodes.

[0061] Optionally, the editing instructions may include allowing the user to edit the input-output relationships between n texture nodes and m material nodes. Of course, users can configure adjustable variables for texture nodes or material nodes according to their individual needs. This application does not limit the specific editing method; users can configure them according to their own requirements.

[0062] Furthermore, in this step, there is only one final output, which is the target material obtained through editing.

[0063] Step 103: Generate the first shader based on the input-output relationship of the n texture nodes;

[0064] Optionally, this step includes:

[0065] First, for each of the n texture nodes, generate a texture node class corresponding to the texture node. The texture node class includes the input, output, adjustable variables and shading information of the texture node. The shading information includes shader variables, shader reference code and shader fragments.

[0066] After receiving the editing command, the terminal can generate the texture node class corresponding to each texture node in the engine. Optionally, each texture node class contains a unique identifier (ID), and each texture node class includes the same inputs, outputs, and adjustable variables as the texture node. Furthermore, the texture node class also includes shading information passed to the shader. Shading information includes shader variable `uniform`, shader reference code, and shader fragments.

[0067] Second, a texture node pipeline is generated based on the texture node classes of the n texture nodes, and the texture node pipeline includes the first shader generated based on the n texture node classes.

[0068] The engine also includes a texture node pipeline. Optionally, the steps for generating the texture node pipeline include:

[0069] (1) Generate a first relationship graph of the n texture node classes based on the input-output relationship of the n texture nodes;

[0070] The texture node pipeline uses one output of a texture node as the root node. Based on the connection relationships between texture nodes, it generates a directed acyclic graph with texture node classes as nodes. This directed acyclic graph is the first relationship graph.

[0071] (2) Generate the first shader based on the first relationship graph and the shading information in each texture node class. The shader is used to generate the rendering buffer for the texture node.

[0072] A. Based on the first relationship graph, the shader reference code and shader variables in the n texture node classes are concatenated using a deduplication method;

[0073] B. Sort the n texture node classes according to the breadth-first search method;

[0074] C. According to the sorting, the shader fragments of the n texture node classes are concatenated to obtain the first shader.

[0075] It should be noted that after the first shader is generated, the rendering buffer can be compiled through the first shader, and then the intermediate texture nodes edited according to the n texture nodes can be displayed based on the rendering buffer. In other words, the front end can preview the intermediate texture nodes.

[0076] Another point to note is that the above example only illustrates the generation of the first shader. In actual implementation, a shader corresponding to each texture node can be generated based on each texture node class, and then the shader can be used to preview the corresponding texture node. This approach allows users to view the effect of each node, reducing the difficulty of editing and improving the efficiency of material editing.

[0077] Step 104: Generate a second shader based on the input-output relationship of the m material nodes;

[0078] Optionally, this step includes:

[0079] First, for each of the m material nodes, generate a material node class corresponding to the material node, wherein the material node class includes the input, output, configuration parameters and material model of the material node;

[0080] Similar to step 103, the engine can also include material node classes and material node pipelines. The generation process for material node classes is similar to that for texture node classes; please refer to the steps above for details, which will not be repeated here.

[0081] Unlike the above, material node classes are based on material lighting models and have their own rendering equations. For example, PBR materials use the Cook Torrance BRDF (Bidirectional Reflectance Distribution Function) as their rendering equation, and the specific rendering equation can be predefined by the developer. Therefore, the generated material node class can include the material model used by that material node.

[0082] Second, a material node pipeline is generated based on the material node classes of the m material nodes, and the material node pipeline includes the second shader generated based on the m material node classes.

[0083] (1) Generate a second relationship graph based on the input-output relationship of the m material node classes;

[0084] Similar to the texture node pipeline, the material pipeline generates a directed acyclic graph (DAG) with the selected material node output as the root node, and connected material nodes and directly connected texture nodes as nodes. The specific node types in the DAG are determined by the actual input-output relationships set by the user, and their specific content is not limited.

[0085] (2) Based on the second relationship diagram, construct the connection relationship between the material model shading template, the rendering buffer of the target texture node and the output of the first shader in the m material node classes, and then obtain the second shader. The target texture node is the node among the n texture nodes whose input does not include the output of the texture node and whose output is used as the input of the material node.

[0086] This step compiles each input node based on the second relationship graph. When the input node is a texture node, its render buffer (i.e., texture map) is obtained by compiling the texture node's shader. When the input node is a material node, it is directly compiled using the material node's material model shading template; that is, a shader is generated based on the material node's material model and input state, and the render buffer is generated using this shader. After obtaining the render buffer, it is bound to the second shader via a shader sampler.

[0087] Optionally, all nodes in the second relationship graph are sorted using a breadth-first search method. The shader for each connected texture node class is generated by the texture node pipeline, and then the shaders are sorted in reverse order to form the rendering pipeline. The input to the material node is obtained by passing the render buffers of the texture node and the material node to the shader through the shading sampler.

[0088] Step 105: Generate the target material based on the n texture nodes, the m material nodes, the first shader, and the second shader.

[0089] After the target material is generated, it can be exported for preview. The generated target material will be saved after the user triggers the save function.

[0090] Optionally, the step of saving the target material includes: saving the target material according to a preset rule, wherein the preset rule includes at least one of the following methods:

[0091] (1) Save the node type, node identifier, input / output, and adjustable variables of the n texture nodes, and the node type, node identifier, input / output, and adjustable variables of the m material nodes;

[0092] The terminal can save various inputs on which the target material is based, namely the aforementioned information for n texture nodes and the aforementioned information for m material nodes. Users can subsequently modify one or more of the saved information according to their individual needs, without any limitation.

[0093] (2) Save the material texture, material type and material identifier of the target material.

[0094] In another possible implementation, the terminal may include a material map, material type, and material identifier for the target material, which can be used or modified by the user as needed.

[0095] It should be noted that, please refer to [the relevant documentation / reference]. Figure 6It illustrates a possible principle block diagram of a material generation method according to an embodiment of this application, such as... Figure 6 As shown, the above method comprises three parts: front-end display, engine, and export. The front-end displays texture nodes, material nodes, and adjustable variables (not shown in the figure). The engine includes texture node classes, texture node pipelines, material node classes, and material node pipelines. Specifically, during actual design, after selecting a texture node in the front-end, the user can generate the corresponding texture node class in the engine, such as... Figure 6 As shown, each texture node class includes a texture node, variables (i.e., the adjustable variables mentioned above), and shading information (shader fragments, shader variables, and shader references). A texture node pipeline (including shaders and the rendered render buffer) is generated based on the texture node class. Similarly, after selecting a material node on the front end, a corresponding material node class is generated in the engine. This material node class includes the input texture node, material node, variables (adjustable variables), and material model. The material node pipeline includes a shader sampler, the shading pipeline, and the rendered render buffer. For example... Figure 6 As shown, the texture node pipeline can output texture node previews, and the material node pipeline can output material node previews. They can be exported and saved separately, which will not be elaborated on in this application.

[0096] In summary, by displaying material information, including at least one of texture nodes, material nodes, and adjustable variables; receiving editing instructions for the material information, whereby the editing instructions are used to edit the input and output of n texture nodes and m material nodes, where m and n are integers greater than or equal to 0; generating a first shader based on the input and output relationship of the n texture nodes; generating a second shader based on the input and output relationship of the m material nodes; and generating a target material based on the n texture nodes, the m material nodes, the first shader, and the second shader. This solves the problem in existing technologies where the materials in the material library may not meet the usage requirements, achieving the effect that users can freely edit and create materials to meet actual needs.

[0097] The node-based editing method significantly lowers the barrier to entry for procedural material creation, allowing users unfamiliar with shader programming to quickly get started and achieve the same complex material creation functionality as shader programming through node connections. Furthermore, during the material creation process, users can preview each node, enabling them to observe the effect of each node in real time and more intuitively display every detail, allowing users to complete node connections more easily and efficiently.

[0098] Furthermore, when new texture nodes and material nodes appear, only the material information needs to be updated, which improves the scalability of the above method.

[0099] Once the target material is generated, it can be saved and then used in other scenarios.

[0100] This application also provides a material generation apparatus, the apparatus including a memory and a processor, the memory storing at least one program instruction, the processor loading and executing the at least one program instruction to implement the method described above.

[0101] This application also provides a computer storage medium storing at least one program instruction, which is loaded and executed by a processor to implement the method described above.

[0102] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0103] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A method for generating a material, characterized in that, The method includes: Display material information, which includes at least one of texture nodes, material nodes, and adjustable variables; Receive editing instructions for the material information, the editing instructions are used to edit the input and output of n texture nodes and m material nodes, where m and n are integers greater than or equal to 0; Based on the input-output relationship of the n texture nodes, a first shader is generated; Based on the input-output relationship of the m material nodes, a second shader is generated, including: for each of the m material nodes, generating a material node class corresponding to the material node, wherein the material node class includes the input, output, configuration parameters and material model of the material node; and generating a material node pipeline based on the material node classes of the m material nodes, wherein the material node pipeline includes the second shader generated based on the m material node classes. The target material is generated based on the n texture nodes, the m material nodes, the first shader, and the second shader; A second relationship graph is generated based on the input-output relationships of the m material node classes; Based on the second relationship graph, the connection relationship between the material model shading template, the rendering buffer of the target texture node, and the output of the first shader in the m material node classes is constructed, thereby obtaining the second shader. The target texture node is the node among the n texture nodes whose input does not include the output of the texture node and whose output is used as the input of the material node.

2. The method according to claim 1, characterized in that, The step of generating the first shader based on the input-output relationship of the n texture nodes includes: For each of the n texture nodes, generate a texture node class corresponding to the texture node. The texture node class includes the input, output, adjustable variables and shading information of the texture node. The shading information includes shader variables, shader reference code and shader fragments. A texture node pipeline is generated based on the texture node classes of the n texture nodes, and the texture node pipeline includes the first shader generated based on the n texture node classes.

3. The method according to claim 2, characterized in that, The step of generating the texture node pipeline based on the texture node classes of the n texture nodes includes: Generate a first relationship graph of the n texture node classes based on the input-output relationship of the n texture nodes; The first shader is generated based on the first relationship graph and the shading information in each texture node class. The shader is used to generate the rendering buffer for the texture nodes.

4. The method according to claim 3, characterized in that, The step of generating the first shader based on the first relationship graph and the shading information in each texture node class includes: Based on the first relationship graph, the shader reference code and shader variables in the n texture node classes are concatenated using a deduplication method; The n texture node classes are sorted according to the breadth-first search method; The first shader is obtained by concatenating the shader fragments of the n texture node classes according to the sorting.

5. The method according to claim 2, characterized in that, The method further includes: The rendering buffer is obtained by compiling the first shader; The rendering buffer displays intermediate texture nodes obtained by editing the n texture nodes.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: The target material is saved according to preset rules, which include at least one of the following methods: Save the node type, node identifier, input / output, and adjustable variables of the n texture nodes, and the node type, node identifier, input / output, and adjustable variables of the m material nodes; or, Save the material texture, material type, and material identifier of the target material.

7. A material generating apparatus, characterized in that, The apparatus includes a memory and a processor, the memory storing at least one program instruction, and the processor loading and executing the at least one program instruction to implement the method as described in any one of claims 1 to 6.

8. A computer storage medium, characterized in that, The computer storage medium stores at least one program instruction, which is loaded and executed by a processor to implement the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Advanced material synthetic system and method based on visualization edition

    CN102760304A