Display effect output method and device, product and electronic equipment
By parsing and mapping engine shader code to Autodesk Maya, the method and device facilitate direct viewing of engine display effects within Maya, enhancing efficiency by eliminating the need for software switching.
Patent Information
- Application Number
- CN202411244909.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-24
AI Technical Summary
The inefficiency in viewing engine display effects due to the need to switch between Autodesk Maya and other software for visual effects production, leading to increased operational complexity.
A method and device that parse shader code and graphics code from the engine source code, map relevant information to the Maya environment, and run the target Maya environment to output the engine display effect, utilizing mapping plug-ins and HLSL language conversion for seamless integration.
Enables users to view engine display effects directly within Maya without software switching, thereby improving efficiency and reducing operational steps.
Smart Images

Figure CN119180893A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a display effect output method, a display effect output device, a computer program product, and an electronic device. Background Art
[0002] Autodesk Maya is a 3D animation software that includes functions for 3D and visual effects production, modeling, digital cloth simulation, hair rendering, motion matching, etc. It can be used to produce film and television advertisements, character animation, movie stunts, etc.
[0003] There is a big difference between the display effect in Maya and the engine display effect. Relevant personnel usually need to make the required visual effects in Maya and then switch software to obtain the engine display effect. This leads to the problem of low efficiency in viewing the engine display effect.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute an existing solution known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the present application is to provide a display effect output method, a display effect output device, a computer-readable storage medium, and an electronic device, which can parse the shader code and the shader graphics code in the engine source code, and then map the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code to the Maya environment, obtain the target Maya environment, and run the target Maya environment to obtain the engine display effect. This can save user operations, and the user can obtain the required engine display effect through the target Maya environment without switching software to software that can view the engine display effect, which improves the viewing efficiency of the engine display effect.
[0006] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0007] According to one aspect of the present application, a display effect output method is provided, the method comprising:
[0008] Parse the shader code and shader graphics code in the engine source code;
[0009] Mapping first target information related to modeling in the shader code and second target information related to modeling in the shader graphics code to the Maya environment to obtain a target Maya environment;
[0010] Run the target Maya environment to enable the target Maya environment output engine to display the effect.
[0011] In an exemplary embodiment of the present application, it further includes:
[0012] An interactive interface is generated for a target Maya environment, and the interactive interface is applied to the target Maya environment; wherein the interactive interface includes an engine display effect output function.
[0013] In an exemplary embodiment of the present application, mapping first target information related to modeling in the shader code to the Maya environment includes:
[0014] Get the mapping plug-in corresponding to the Maya environment;
[0015] The first target information related to modeling in the shader code is mapped to the Maya environment through the mapping plug-in.
[0016] In an exemplary embodiment of the present application, it further includes:
[0017] At least one of a shader attribute, a function method corresponding to the shader, model vertex information, and model pixel information is obtained from the shader code as the first target information.
[0018] In an exemplary embodiment of the present application, it further includes:
[0019] At least one of material information, color information, lighting model, and texture map is obtained from the shader graphics code as the second target information.
[0020] In an exemplary embodiment of the present application, mapping the second target information related to modeling in the shader graphics code to the Maya environment includes:
[0021] Converting the second target information related to modeling in the shader graphics code into the target code of the hlsl language;
[0022] Map the target code into the Maya environment.
[0023] In an exemplary embodiment of the present application, mapping the target code to the Maya environment includes:
[0024] Identify shader information in the Maya environment;
[0025] Adapt the target code and shader information to obtain the adaptation result;
[0026] The adaptation result is generated as a mapping result.
[0027] According to one aspect of the present application, a display effect output device is provided, comprising:
[0028] Parsing unit, used to parse the shader code and shader graphics code in the engine source code;
[0029] A mapping unit, used for mapping first target information related to modeling in the shader code and second target information related to modeling in the shader graphics code to a Maya environment to obtain a target Maya environment;
[0030] The running unit is used to run the target Maya environment so that the target Maya environment outputs the engine display effect.
[0031] In an exemplary embodiment of the present application, it further includes:
[0032] The interface generation unit is used to generate an interactive interface for a target Maya environment and apply the interactive interface to the target Maya environment; wherein the interactive interface includes an engine display effect output function.
[0033] In an exemplary embodiment of the present application, the mapping unit maps the first target information related to modeling in the shader code to the Maya environment, including:
[0034] Get the mapping plug-in corresponding to the Maya environment;
[0035] The first target information related to modeling in the shader code is mapped to the Maya environment through the mapping plug-in.
[0036] In an exemplary embodiment of the present application, it further includes:
[0037] The information determination unit is used to obtain at least one of shader attributes, function methods corresponding to the shader, model vertex information, and model pixel information from the shader code as the first target information.
[0038] In an exemplary embodiment of the present application, wherein:
[0039] The information determination unit is further used to obtain at least one of material information, color information, lighting model, and texture map from the shader graphics code as the second target information.
[0040] In an exemplary embodiment of the present application, the mapping unit maps the second target information related to modeling in the shader graphics code to the Maya environment, including:
[0041] Converting the second target information related to modeling in the shader graphics code into the target code of the hlsl language;
[0042] Map the target code into the Maya environment.
[0043] In an exemplary embodiment of the present application, the mapping unit maps the target code to the Maya environment, including:
[0044] Identify shader information in the Maya environment;
[0045] Adapt the target code and shader information to obtain the adaptation result;
[0046] The adaptation result is generated as a mapping result.
[0047] According to one aspect of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, any one of the above methods is implemented.
[0048] According to one aspect of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any one of the above methods by executing the executable instructions.
[0049] The exemplary embodiments of the present application may have some or all of the following beneficial effects:
[0050] In the display effect output method provided in an example implementation of the present application, the shader code and the shader graphics code in the engine source code can be parsed, and then the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code can be mapped to the Maya environment to obtain the target Maya environment, and the engine display effect can be obtained by running the target Maya environment. This can save user operations, and the user can obtain the required engine display effect through the target Maya environment without switching software to software that can view the engine display effect, thereby improving the viewing efficiency of the engine display effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0052] Figure 1 A flowchart of a display effect output method according to an embodiment of the present application is schematically shown;
[0053] Figure 2 A schematic diagram of an interactive interface according to an embodiment of the present application is shown schematically;
[0054] Figure 3A flowchart of a display effect output method according to another embodiment of the present application is schematically shown;
[0055] Figure 4 The structure block diagram of the display effect output device according to one embodiment of the present application is schematically shown;
[0056] Figure 5 The structure diagram of a computer system suitable for implementing an electronic device of an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0057] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present application will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical solutions of the present application may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present application.
[0058] In addition, the accompanying drawings are only schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0059] See also Figure 1 , Figure 1 The flowchart of the display effect output method according to an embodiment of the present application is schematically shown. Figure 1 As shown, the display effect output method may include: steps S110 to S130.
[0060] Step S110: parsing the shader code and shader graphics code in the engine source code.
[0061] Step S120: Mapping the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code to the Maya environment to obtain a target Maya environment.
[0062] Step S130: running the target Maya environment so that the target Maya environment outputs the engine display effect.
[0063] Implementation Figure 1 The method shown can parse the shader code and shader graphics code in the engine source code, and then map the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code to the Maya environment, obtain the target Maya environment, and run the target Maya environment to obtain the engine display effect. This can save user operations, and the user can obtain the required engine display effect through the target Maya environment without switching software to software that can view the engine display effect, which improves the viewing efficiency of the engine display effect.
[0064] Next, the above steps of this exemplary embodiment are described in more detail.
[0065] In step S110 , the shader code and the shader graphics code in the engine source code are parsed.
[0066] Specifically, in order to enable users to directly view the engine display effect in the Maya environment, the engine source code can be parsed first to obtain the parsing results, and then the shader code (MayaShader code) can be identified from the parsing results through static analysis tools and the shader graphics code (Shadergraph code) can be identified through image processing technology (such as OpenCV, etc.).
[0067] The process of identifying shader code from the parsing results through static analysis tools can be implemented as follows: import the ast module, which is used to parse and process the Python source code tree; define the ShaderAnalyzer class, specifically initialize an empty shaders list to store the shader class names found, visit all class definition nodes, and if the class name contains "Shader", add it to the shaders list, and then call the generic_visit method to continue traversing other nodes; read the Python source file, specifically open the file engine_shader_code.py and read its content, use ast.parse to parse the file content, generate AST, instantiate ShaderAnalyzer** and visit AST, extract all class names containing "Shader", and print the traversed shader class names. In this way, the class definitions in the Python source code can be analyzed and all class names containing "Shader" can be extracted.
[0068] The process of identifying the shader graphics code through image processing technology can be implemented as follows: import the cv2 module, which is the Python interface of OpenCV for image processing; define the extract_shadergraph_attributes function, specifically use cv2.imread to read the image of the specified path, convert it into a grayscale image, use the cv2.Canny method to perform edge detection, obtain the edge map of the image, and return the processed edge image; call the extract_shadergraph_attributes function and pass in the image path shadergraph.png to obtain the edge image; use cv2.imshow to display the edge image, wait for the user to press a button to close the display window, and then destroy all windows. In this way, the image can be read and edge detection can be performed, and the edges in the image can be extracted to identify the shader graphics code.
[0069] In step S120, first target information related to modeling in the shader code and second target information related to modeling in the shader graphics code are mapped to the Maya environment to obtain a target Maya environment.
[0070] Specifically, the first target information refers to the information in the shader code that needs to be mapped to the Maya environment, which is related to the display effect of the generation engine; the second target information refers to the information in the shader graphics code that needs to be mapped to the Maya environment, which is also related to the display effect of the generation engine. In addition, the target Maya environment is the environment after information mapping.
[0071] As an optional embodiment, it also includes:
[0072] At least one of a shader attribute, a function method corresponding to the shader, model vertex information, and model pixel information is obtained from the shader code as the first target information.
[0073] It can be seen that by implementing this optional embodiment, key information mapping at the shader code level can be achieved.
[0074] Specifically, the first target information can be dynamically acquired through reflection technology, wherein the shader attributes are used to indicate the attributes corresponding to the shader; the function method corresponding to the shader indicates the function method used to construct the shader; the model vertex information is used to indicate vertex information such as the positions of each vertex of the model to be rendered; and the model pixel information is used to indicate the information of each pixel corresponding to the model to be rendered. Among them, the shader attributes, the function method corresponding to the shader, the model vertex information, and the model pixel information in the first target information are used as part of the modeling software running code. When the modeling is completed, the above information can be directly read from the above code.
[0075] The process of obtaining the first target information through reflection technology can be implemented as follows: import the inspect module, which provides a variety of useful functions to obtain object information; define the Shader class, specifically the constructor, which accepts name, vertex_shader and pixel_shader, and assigns them to instance variables; define the get_shader_details function, specifically accepting a class as a parameter shader_class, creating an empty dictionary details to store method names and their signatures, and using inspect.getmembers to obtain all function members in shader_class. Predicate = inspect.isfunction ensures that only functions are obtained, where name is the name of the method and method is the method object. Use inspect.signature to obtain the signature of each method and store it in the details dictionary. The key is the method name and the value is the method signature. Then, return the details dictionary; call the get_shader_details function and pass in the Shader class. The returned method signature is stored in the shader_details variable; use the print function to output the shader_details dictionary to display the signature of the method in the Shader class.
[0076] The import module is used to use the inspect module to detect the object information; the class Shader is defined to contain a constructor __init__ to initialize the object attributes; the function get_shader_details is defined to traverse all function members of a given class, obtain their signatures, store them in a dictionary and return them. In this way, the data of the shader graph can be read and parsed from a JSON file, and its node and connection information can be extracted, and all methods and their parameter signatures of any class can be dynamically obtained and displayed.
[0077] As an optional embodiment, it also includes:
[0078] At least one of material information, color information, lighting model, and texture map is obtained from the shader graphics code as the second target information.
[0079] It can be seen that by implementing this optional embodiment, key information mapping at the shader graphics code level can be achieved.
[0080] Specifically, the second target information can be obtained through a script, wherein material information is used to represent the model material; color information is used to represent the model color; the lighting model is used to represent the lighting model acting on the model to be rendered; and the texture map is used to represent the texture map acting on the model to be rendered.
[0081] The process of obtaining the second target information through the script can be implemented as follows: import the json module, which provides functions for processing JSON data, including loading and saving JSON data; define the parse_shadergraph function, specifically, the function accepts a parameter file_path, which represents the path of the JSON file to be read, uses the withopen(file_path,"r")asfile statement to open the JSON file in read-only mode ("r"), and the with statement ensures that the file is automatically closed after the operation is completed, and uses json.load(file) to parse the file content into a Python dictionary data, which contains a JSON data structure, extracts nodes and connections from the parsed data dictionary data, stores them in two variables respectively, and returns nodes and connections for use after calling the function; calls the parse_shadergraph function, specifically, passes in the file path "shadergraph.json", parses the file and returns the node and connection information therein, and assigns them to the nodes and connections variables respectively; prints the node and connection information, specifically, uses print(nodes,connections) to output the contents of the nodes and connections variables, which are the shader graph data parsed from the JSON file.
[0082] Among them, the import module is used to use the json module to process JSON data; the function parse_shadergraph is used to open the specified JSON file and parse the node and connection information in it; reading and parsing the file means using the withopen statement inside the function to open the file, and the json.load function parses the file content into a Python dictionary; extracting and returning data means extracting nodes and connections information from the dictionary and returning them; calling the function and printing the result means parsing data from the specified file and printing the node and connection information. In this way, a JSON file storing a shader graph can be read and the node and connection information in it can be obtained for subsequent processing or analysis.
[0083] As an optional embodiment of step S120, mapping the first target information related to modeling in the shader code to the Maya environment includes:
[0084] Step S1201: Obtain a mapping plug-in corresponding to the Maya environment;
[0085] Step S1202: Mapping the first target information related to modeling in the shader code to the Maya environment through a mapping plug-in.
[0086] It can be seen that by implementing this optional embodiment, the mapping of the Maya environment can be achieved through the mapping plug-in, which is conducive to improving the mapping efficiency of the first target information.
[0087] Specifically, the mapping plug-in is used as a medium to map the first target information to the Maya environment. The mapping plug-in can be implemented by defining a Maya plug-in with a custom command applyShader added. When applyShader is executed, the specified shader will be assigned to all currently selected objects to implement the mapping process. The specific process is as follows:
[0088]
[0089]
[0090]
[0091] Among them, you can create a custom command applyShader, which is used to assign the specified shader to the currently selected scene object; make the class definition ApplyShaderCommand inherit OpenMayaMPx.MPxCommand, so that the __init__ method calls the initialization method of the parent class MPxCommand. In addition, the doIt method is the main logic of command execution, shader_node obtains the specified shader from the command parameters, selection_list is used to store the currently selected object list, and OpenMaya.MGlobal.getActiveSelectionList (selection_list) is used to obtain the currently active selection list. Use OpenMaya.MItSelectionList to traverse each object in selection_list. For each object, use cmds.hyperShade (assign = shader_node) to assign the specified shader to the current DagPath (object path). In addition, you can also create a function cmdCreator. The cmdCreator function is used to create an instance of the ApplyShaderCommand class and convert it to an MPx pointer. Then, the plug-in is initialized and deinitialized, specifically, initializePlugin and uninitializePlugin are defined. initializePlugin is used to register the applyShader command when the plug-in is loaded, and uninitializePlugin is used to unregister the applyShader command when the plug-in is uninstalled.
[0092] Furthermore, the first target information related to modeling in the shader code can be mapped to the Maya environment through a mapping plug-in. The process of mapping the first target information to the Maya environment can be implemented as follows: define a dictionary named maya_shader_mapping, add key-value pairs to the dictionary, each key-value pair represents a mapping between a custom term and a Maya node name, so as to map custom shader terms (such as "vertex_shader", "pixel_shader") to specific node names in Maya. Among them, maya_shader_mapping includes the following mapping relationships: "vertex_shader" maps to "maya_vertex_shader_node": indicating that the custom term "vertex_shader" corresponds to the vertex shader node in Maya; "pixel_shader" maps to "maya_pixel_shader_node": indicating that the custom term "pixel_shader" corresponds to the pixel shader node in Maya; "material_property" maps to "maya_material_property_node": indicating that the custom term "material_property" corresponds to the material attribute node in Maya.
[0093] As an optional embodiment of step S120, mapping the second target information related to modeling in the shader graphics code to the Maya environment includes:
[0094] Step S1203: converting the second target information related to modeling in the shader graphics code into a target code in the hlsl language;
[0095] Step S1204: Map the target code to the Maya environment.
[0096] It can be seen that by implementing this optional embodiment, the mapping between the Maya environment and the engine can be achieved, so as to realize the engine display effect in the Maya environment.
[0097] Specifically, the second target information can be converted into a target code of the HLSL language, namely, the HLSL code (High-Level Shader Language Code) through the template technology. Furthermore, optionally, the logical correctness of the HLSL code can also be verified. The specific process is: define the HLSL (High-Level Shader Language) code template hlsl_template:
[0098]
[0099] Furthermore, the function generate_hlsl_code is defined to generate the final HLSL code based on the input node and connection data:
[0100]
[0101] Among them, template is the HLSL code template, which contains placeholders; nodes and connections are node and connection data respectively, which will be used to replace the placeholders in the template; code is the HLSL code generated after replacing the placeholders with actual data.
[0102] Then, you can call the generate_hlsl_code function to generate and print the HLSL code. Then, verify the logical correctness of the generated HLSL code by compiling it. Specifically, define the function validate_hlsl_code:
[0103]
[0104] Among them, subprocess.run is used to run external commands, fxc is the HLSL compiler, ["fxc", " / T", "vs_5_0", " / E", "main", "shader.hlsl"] is the compilation command, fxc is the HLSL compiler command, / Tvs_5_0 is the target shader model, / Emain is the entry point function name, shader.hlsl is the HLSL code file to be compiled, capture_output = True, text = True is used to capture the output and return it in text form, result.returncode is used to check the compiler return code, if it is 0, it means the compilation is successful, otherwise it means failure. Then, the compilation result information can be printed.
[0105] As an optional embodiment of step S1204, mapping the target code to the Maya environment includes:
[0106] Step S12041: Identify shader information in the Maya environment;
[0107] Step S12042: adapting the target code and shader information to obtain an adaptation result;
[0108] Step S12043: Generate the adaptation result as a mapping result.
[0109] It can be seen that by implementing this optional embodiment, the mapping between the Maya environment and the engine can be achieved, so as to realize the engine display effect in the Maya environment.
[0110] Specifically, the shader information in the Maya environment can be identified first, and the target code and shader information can be adapted to obtain the adaptation result; wherein, generating the adaptation result as a mapping result means adjusting the non-standardized adaptation result to a standardized mapping result that can be directly called. The difference between the adaptation result and the mapping result lies in the difference in format and form, and the essence of the two is the same.
[0111] In step S130, the target Maya environment is run so that the target Maya environment outputs an engine display effect.
[0112] Specifically, as an example, the engine display effect output by the target Maya environment can be found in Figure 2 .
[0113] As an optional embodiment, it also includes:
[0114] An interactive interface is generated for a target Maya environment, and the interactive interface is applied to the target Maya environment; wherein the interactive interface includes an engine display effect output function.
[0115] It can be seen that implementing this optional embodiment can improve the efficiency of obtaining engine display effects, which is helpful in shortening the visual effects production cycle.
[0116] Specifically, in order to enable the target Maya environment to display the engine display effect, an interactive interface can be developed so that the user can obtain the engine display effect in the target Maya environment by operating the engine display effect output function in the interactive interface. Figure 3 , Figure 3 The flowchart of the display effect output method according to another embodiment of the present application is schematically shown. Figure 3 As shown, the display effect output method includes: steps S310 to S370.
[0117] Step S310: Parsing the shader code and shader graphics code in the engine source code.
[0118] Step S320: obtaining at least one of shader attributes, function methods corresponding to the shader, model vertex information, and model pixel information from the shader code as first target information.
[0119] Step S330: Obtain at least one of material information, color information, lighting model, and texture map from the shader graphics code as second target information.
[0120] Step S340: Obtain a mapping plug-in corresponding to the Maya environment, and map the first target information related to modeling in the shader code to the Maya environment through the mapping plug-in.
[0121] Step S350: converting the second target information related to modeling in the shader graphics code into a target code of the hlsl language, and mapping the target code to the Maya environment.
[0122] Step S360: Generate an interactive interface for the target Maya environment, and apply the interactive interface to the target Maya environment; wherein the interactive interface includes an engine display effect output function.
[0123] Step S370: running the target Maya environment so that the target Maya environment outputs the engine display effect.
[0124] It should be noted that steps S310 to S370 are Figure 1 The steps and their embodiments shown correspond to each other. For the specific implementation of steps S310 to S370, please refer to Figure 1 The steps and embodiments shown are not described in detail here.
[0125] It can be seen that the implementation Figure 3 The method shown can parse the shader code and shader graphics code in the engine source code, and then map the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code to the Maya environment, obtain the target Maya environment, and run the target Maya environment to obtain the engine display effect. This can save user operations, and the user can obtain the required engine display effect through the target Maya environment without switching software to software that can view the engine display effect, which improves the viewing efficiency of the engine display effect.
[0126] See also Figure 4 , Figure 4 The structure block diagram of the display effect output device according to an embodiment of the present application is schematically shown. Figure 1 The method shown corresponds to Figure 4 As shown, the display effect output device 400 includes:
[0127] A parsing unit 401, used for parsing shader code and shader graphics code in the engine source code;
[0128] A mapping unit 402 is used to map the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code to the Maya environment to obtain a target Maya environment;
[0129] The running unit 403 is used to run the target Maya environment so that the target Maya environment outputs the engine display effect.
[0130] It can be seen that the implementation Figure 4 The device shown can parse the shader code and shader graphics code in the engine source code, and then map the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code to the Maya environment, obtain the target Maya environment, and run the target Maya environment to obtain the engine display effect. This can save user operations, and the user can obtain the required engine display effect through the target Maya environment without switching software to software that can view the engine display effect, thereby improving the viewing efficiency of the engine display effect.
[0131] In an exemplary embodiment of the present application, it further includes:
[0132] The interface generation unit is used to generate an interactive interface for a target Maya environment and apply the interactive interface to the target Maya environment; wherein the interactive interface includes an engine display effect output function.
[0133] It can be seen that implementing this optional embodiment can improve the efficiency of obtaining engine display effects, which is helpful in shortening the visual effects production cycle.
[0134] In an exemplary embodiment of the present application, the mapping unit 402 maps the first target information related to modeling in the shader code to the Maya environment, including:
[0135] Get the mapping plug-in corresponding to the Maya environment;
[0136] The first target information related to modeling in the shader code is mapped to the Maya environment through the mapping plug-in.
[0137] It can be seen that by implementing this optional embodiment, the mapping of the Maya environment can be achieved through the mapping plug-in, which is conducive to improving the mapping efficiency of the first target information.
[0138] In an exemplary embodiment of the present application, it further includes:
[0139] The information determination unit is used to obtain at least one of shader attributes, function methods corresponding to the shader, model vertex information, and model pixel information from the shader code as the first target information.
[0140] It can be seen that by implementing this optional embodiment, key information mapping at the shader code level can be achieved.
[0141] In an exemplary embodiment of the present application, wherein:
[0142] The information determination unit is further used to obtain at least one of material information, color information, lighting model, and texture map from the shader graphics code as the second target information.
[0143] It can be seen that by implementing this optional embodiment, key information mapping at the shader graphics code level can be achieved.
[0144] In an exemplary embodiment of the present application, the mapping unit 402 maps the second target information related to modeling in the shader graphics code to the Maya environment, including:
[0145] Converting the second target information related to modeling in the shader graphics code into the target code of the hlsl language;
[0146] Map the target code into the Maya environment.
[0147] It can be seen that by implementing this optional embodiment, the mapping between the Maya environment and the engine can be achieved, so as to realize the engine display effect in the Maya environment.
[0148] In an exemplary embodiment of the present application, the mapping unit 402 maps the target code to the Maya environment, including:
[0149] Identify shader information in the Maya environment;
[0150] Adapt the target code and shader information to obtain the adaptation result;
[0151] The adaptation result is generated as a mapping result.
[0152] It can be seen that by implementing this optional embodiment, the mapping between the Maya environment and the engine can be achieved, so as to realize the engine display effect in the Maya environment.
[0153] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0154] Since the various functional modules of the display effect output device of the example embodiment of the present application correspond to the steps of the example embodiment of the display effect output method described above, for details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the display effect output method described above in the present application.
[0155] See also Figure 5 , Figure 5 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0156] It should be noted that Figure 5 The computer system 500 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0157] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. Various programs and data required for system operation are also stored in the RAM 503. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0158] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0159] In particular, according to an embodiment of the present application, the process described with reference to the flowchart above can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 509, and / or installed from a removable medium 511. When the computer program is executed by a central processing unit (CPU) 501, various functions defined in the method and apparatus of the present application are executed.
[0160] The exemplary embodiments of the present disclosure also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the display effect output method described above is implemented.
[0161] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.
[0162] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.
[0163] The code of the computer program can be written in one or more programming languages. Programming languages such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).
[0164] Computer programs can be carried or transmitted through electrical, magnetic, optical, electromagnetic, infrared and other signals. Electronic devices can convert signals carrying computer programs into digital signals to run computer programs. When a computer program runs on an electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device can execute) the method steps of various exemplary embodiments of the present disclosure, such as the above-mentioned display effect output method, which includes the following steps: parsing the shader code and shader graphics code in the engine source code; mapping the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code to the Maya environment to obtain the target Maya environment; running the target Maya environment so that the target Maya environment outputs the engine display effect.
[0165] By executing the above method steps through a computer program, the shader code and the shader graphics code in the engine source code can be parsed, and then the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code can be mapped to the Maya environment to obtain the target Maya environment, and the engine display effect can be obtained by running the target Maya environment. This can save user operations, and the user does not need to switch software to software that can view the engine display effect, and can obtain the required engine display effect through the target Maya environment, thereby improving the viewing efficiency of the engine display effect.
[0166] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0167] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0168] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
Claims
1. A display effect output method, characterized in that: include: Parse the shader code and shader graphics code in the engine source code; Mapping first target information related to modeling in the shader code and second target information related to modeling in the shader graphics code to a Maya environment to obtain a target Maya environment; The target Maya environment is run so that the target Maya environment outputs an engine display effect.
2. The method according to claim 1, characterized in that Also includes: An interactive interface is generated for the target Maya environment, and the interactive interface is applied to the target Maya environment; wherein the interactive interface includes an engine display effect output function.
3. The method according to claim 1, characterized in that Mapping first target information related to modeling in the shader code to a Maya environment includes: Obtaining a mapping plug-in corresponding to the Maya environment; The first target information related to modeling in the shader code is mapped to the Maya environment through the mapping plug-in.
4. The method according to claim 1, characterized in that: Also includes: At least one of shader attributes, function methods corresponding to the shader, model vertex information, and model pixel information is obtained from the shader code as the first target information.
5. The method according to claim 1, characterized in that Also includes: At least one of material information, color information, lighting model, and texture map is obtained from the shader graphics code as the second target information.
6. The method according to claim 1, characterized in that Mapping the second target information related to modeling in the shader graphics code to the Maya environment includes: Converting the second target information related to modeling in the shader graphics code into a target code in hlsl language; The object code is mapped into the Maya environment.
7. The method according to claim 6, characterized in that Mapping the target code to the Maya environment includes: Identify shader information in the Maya environment; Adapting the target code and the shader information to obtain an adaptation result; The adaptation result is generated as a mapping result.
8. A display effect output device, characterized in that: include: Parsing unit, used to parse the shader code and shader graphics code in the engine source code; A mapping unit, used for mapping the first target information related to modeling in the shader code and the second target information related to modeling in the shader graphics code to a Maya environment to obtain a target Maya environment; The running unit is used to run the target Maya environment so that the target Maya environment outputs an engine display effect.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.
