A rendering method, apparatus, electronic device, and storage medium

By establishing a mapping relationship between the attribute names of the target shader and the non-target shader, the problem of rendering errors of user-defined materials in the application was solved, and the correct conversion and rendering of material objects were achieved, ensuring the consistency and efficiency of the rendering effect.

CN116206038BActive Publication Date: 2026-05-29BEIJING ZITIAO NETWORK TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING ZITIAO NETWORK TECH CO LTD
Filing Date
2023-03-13
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

When user-created materials are uploaded to the application, rendering errors or failure to achieve the expected results may occur because the shader types do not meet the official requirements. There is a lack of effective solutions in the existing technology.

Method used

A mapping relationship between the attribute names of the target shader and the non-target shader is established in advance. The attribute names of the shader to be converted are matched with the target attribute names through the mapping relationship, and the values ​​are assigned to the target attribute names to realize the conversion of the shader to be converted into the target shader. The material object is then regenerated and rendered.

Benefits of technology

This ensures that the rendered effect of the material object is basically the same as the original effect, avoids rendering errors, improves the accuracy and efficiency of rendering, and reduces the difficulty of user creation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116206038B_ABST
    Figure CN116206038B_ABST
Patent Text Reader

Abstract

The present disclosure provides a rendering method and device, electronic equipment and storage medium, the method comprises: in response to a conversion operation, obtaining a first material object to be converted shader and a target shader, wherein the first material object is generated based on the to-be-converted shader; according to the mapping relationship between the target attribute name in the pre-established target shader and the non-target attribute name in the non-target shader, the target attribute name matched with the to-be-converted attribute name in the to-be-converted shader is determined, and the value of the to-be-converted attribute name is assigned to the matched target attribute name; according to the target shader after assignment, a second material object is regenerated and rendered for the first material object, so that the conversion between different kinds of material objects can be realized, and the rendering effect is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a rendering method, apparatus, electronic device, and storage medium. Background Technology

[0002] Unity is a real-time 3D interactive content creation and development platform that allows users to create materials and generate user-generated content (UGC). Users can then upload these materials to their desired applications (APPs) or platforms for use. However, the shaders used for user-defined materials vary widely and may not meet the requirements of the APP's official shaders, leading to rendering errors or failure to achieve the expected rendering effect after uploading. There is currently no solution to this problem in the relevant technologies. Summary of the Invention

[0003] This disclosure provides at least one rendering method, apparatus, electronic device, and storage medium.

[0004] In a first aspect, embodiments of this disclosure provide a rendering method, including:

[0005] In response to the conversion operation, a shader to be converted and a target shader of a first material object are obtained, wherein the first material object is generated based on the shader to be converted;

[0006] Based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, the target attribute name that matches the attribute name to be converted in the shader to be converted is determined, and the value of the attribute name to be converted is assigned to the matched target attribute name.

[0007] Based on the assigned target shader, a second material object is regenerated and rendered for the first material object.

[0008] In an optional embodiment, the method further includes:

[0009] Obtain the names of each target attribute included in the target shader;

[0010] Obtain the names of the non-target attributes included in each of the non-target shaders;

[0011] Based on the functions represented by each target attribute name and each non-target attribute name, a mapping relationship is established between each target attribute name and each non-target attribute name.

[0012] In one optional embodiment, the step of determining the target attribute name matching the attribute name to be converted in the shader to be converted based on a pre-established mapping relationship between target attribute names in the target shader and non-target attribute names in the non-target shader, and assigning the value of the attribute name to be converted to the matched target attribute name, includes:

[0013] The first material object is deserialized and parsed to obtain the names of the attributes to be converted included in the shader to be converted;

[0014] Based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, determine the target attribute name that matches the attribute name to be converted.

[0015] The shader to be converted is converted into the target shader, and the value of the attribute name to be converted is assigned to the matched target attribute name.

[0016] In an optional embodiment, the method further includes: in the absence of a recorded mapping relationship between the attribute name to be converted and the target attribute name, determining the target attribute name that matches the attribute name to be converted based on the write order of the target attribute name in the program file of the target shader and the write order of the attribute name to be converted in the program file of the shader to be converted.

[0017] In one optional embodiment, determining the target attribute name that matches the attribute name to be converted based on the write order of the target attribute name in the program file of the target shader and the write order of the attribute name to be converted in the program file of the shader to be converted includes:

[0018] Determine the writing order of the target attribute names in the program file of the target shader, and the writing order of the attribute names to be converted in the program file of the shader to be converted;

[0019] Match the attribute name to be converted with the target attribute name that has the same writing order.

[0020] In an optional embodiment, the method further includes:

[0021] For the shader to be converted of the first material object currently displayed, in response to the shader configuration operation, a shader configuration interface is displayed, wherein the shader configuration interface displays the shader to be converted and the shader conversion function, and the shader conversion function is used to receive the conversion operation;

[0022] The target shader is selected from the provided candidate shaders in the shader configuration interface.

[0023] In one optional embodiment, the method further includes: displaying a message indicating successful material object conversion, and displaying the rendered second material object.

[0024] Secondly, embodiments of this disclosure also provide a rendering apparatus, comprising:

[0025] A module for obtaining, in response to a conversion operation, a shader to be converted and a target shader of a first material object, wherein the first material object is generated based on the shader to be converted;

[0026] The conversion module is used to determine the target attribute name that matches the attribute name to be converted in the shader to be converted based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, and to assign the value of the attribute name to be converted to the matched target attribute name.

[0027] The rendering module is used to regenerate and render a second material object based on the assigned target shader for the first material object.

[0028] Thirdly, an optional implementation of this disclosure also provides an electronic device, including a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor performs the steps of the first aspect above, or any possible implementation of the first aspect.

[0029] Fourthly, an optional implementation of this disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the first aspect above, or any possible implementation of the first aspect.

[0030] In this embodiment, a mapping relationship between target attribute names in the target shader and non-target attribute names in the non-target shader is established in advance. This allows for the acquisition of the shader to be converted and the target shader of the first material object in response to a conversion operation. Based on the pre-established mapping relationship, the target attribute name matching the target attribute name in the shader to be converted is determined, and the value of the target attribute name is assigned to the matched target attribute name. Based on the assigned target shader, the first material object is regenerated and rendered to obtain the second material object. Thus, by pre-establishing the mapping relationship between non-target attribute names and target attribute names, the target attribute name of the non-target shader to be converted can be automatically matched to the target attribute name of the target shader, converting the shader to be converted into the target shader. This avoids rendering errors due to incompatibility of the shader to be converted, ensuring rendering accuracy.

[0031] For a description of the effects of the above-mentioned rendering device, electronic device, and computer-readable storage medium, please refer to the description of the rendering method above, which will not be repeated here.

[0032] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this disclosure.

[0033] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0034] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0035] Figure 1 A flowchart of a rendering method provided by an embodiment of this disclosure is shown;

[0036] Figure 2 This diagram illustrates the rendering effect of the first material object in an embodiment of the present disclosure.

[0037] Figure 3 A schematic diagram of the shader configuration interface in an embodiment of this disclosure is shown;

[0038] Figure 4 A schematic diagram illustrating the rendering effect of the second material object in an embodiment of this disclosure is shown;

[0039] Figure 5 A schematic diagram of a rendering apparatus provided in an embodiment of this disclosure is shown;

[0040] Figure 6 A schematic diagram of an electronic device provided in an embodiment of this disclosure is shown. Detailed Implementation

[0041] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0042] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown herein can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0043] To facilitate understanding of the technical solutions disclosed herein, the technical terms used in the embodiments of this disclosure will first be explained:

[0044] Shader: A shader is a short program segment that runs on a graphics processing unit (GPU) to process image information. It tells the graphics software how to calculate and output the image. Shaders can be divided into vertex shaders and fragment shaders, etc.

[0045] Texture: Texture can be understood as the attribute parameter in Shader. Shader is responsible for combining the input vertex data with the input texture or color in a specified way and then outputting it. The drawing unit can then draw the image on the screen based on this output.

[0046] Material: Input textures or colors, along with corresponding shaders and specific shader parameter settings, are packaged and stored together to form a material. The packaged material will also include other parameters. The material can then be applied to a 3D model for rendering and output. For ease of understanding, you can think of the material as the final product used by the engine, the shader as the processing method for producing this product, and the texture as the raw material.

[0047] Research has revealed that users typically use a wide variety of shaders when creating custom materials, which may not meet the requirements of the application (APP) software or platform for official shaders. As a result, when user-created materials are uploaded to the APP's server and loaded onto the APP terminal, rendering errors or failure to achieve the expected rendering effect may occur, and there is currently no relevant solution in the technology.

[0048] Based on the above research, this disclosure provides a rendering method that pre-establishes a mapping relationship between target attribute names in the target shader and non-target attribute names in the non-target shader. This enables one-click conversion of different types of material objects. Specifically, in response to the conversion operation, the shader to be converted and the target shader of the first material object are obtained. Based on this mapping relationship, the target attribute name matching the attribute name to be converted in the shader to be converted is determined, and the value of the attribute name to be converted is assigned to the matching target attribute name. Then, based on the assigned target shader, the first material object is regenerated and rendered to obtain the second material object. Thus, by pre-establishing a mapping relationship between other non-target attribute names and target attribute names, the shader to be converted can be associated with the target shader. This allows the use of the target shader, and based on the value of the attribute name to be converted, the material object can be regenerated and rendered, avoiding rendering errors of the first material object due to incompatibility of the shader to be converted. Furthermore, the conversion assignment ensures that the rendering effect of the converted second material object is essentially similar to the original rendering effect of the first material object.

[0049] The shortcomings of the above solutions are the result of the inventor's practical experience and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.

[0050] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0051] To facilitate understanding of this embodiment, a rendering method disclosed in this disclosure will first be described in detail. The rendering method provided in this disclosure generally executes an electronic device with a certain computing capability. This electronic device may include, for example, a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), a mobile device, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, an in-vehicle device, a wearable device, etc. Among them, a personal digital assistant is a handheld electronic device that has some functions of a computer. It can be used to manage personal information, browse the Internet, send and receive emails, etc. It is generally not equipped with a keyboard and can also be called a handheld computer. In some possible implementations, this rendering method can be implemented by the processor calling computer-readable instructions stored in memory.

[0052] The rendering method provided in this embodiment will be described below using a terminal device as the execution subject as an example.

[0053] See Figure 1 The diagram shows a flowchart of a rendering method provided in an embodiment of this disclosure. The method includes:

[0054] S101: In response to the transformation operation, obtain the shader to be transformed and the target shader of the first material object, wherein the first material object is generated based on the shader to be transformed.

[0055] The rendering method in this embodiment can be applied to 3D applications or 3D games. Users can create 3D resources on the Unity platform or other UGC platforms. The created 3D resources can be uploaded to the software server or platform of the required application for sale or use. The process of creating 3D resources can be simply understood as using shaders and some textures, parameter settings, etc., to process and generate material objects, and then assigning the material objects to the 3D model for rendering output. In the application process, such as in a game scene, when the game is running, an interface is called to render the material objects and display them on the screen through the GPU. During the GPU processing calculation, shaders are used to perform calculations, and finally output pixel information that can be displayed on the screen, realizing the display of 3D resources such as 3D virtual images, virtual scenes, etc.

[0056] In this embodiment, the main issue addressed is that the shaders used by users when creating 3D resources and the software or platform they are using do not meet the requirements of the official shaders. This can lead to the application software or platform being unable to recognize or misrecognizing the shaders used by users during rendering, resulting in rendering errors. Therefore, this embodiment provides a function that can convert any other shader to the official shader with one click.

[0057] Specifically, in this embodiment of the disclosure, the user can input a conversion operation for the customized first material object, for example, by clicking the conversion button to input the conversion operation, thereby realizing the Shader conversion.

[0058] The first material object is generated based on the shader to be converted, which can be any other non-official shader used by the user. Regarding the method of determining the shader to be converted and the target shader of the first material object, this disclosure provides a possible implementation:

[0059] 1) For the shader to be converted of the first material object currently displayed, in response to the shader configuration operation, the shader configuration interface is displayed. The shader configuration interface displays the shader to be converted and the shader conversion function. The shader conversion function is used to receive conversion operations.

[0060] For example, the rendering method disclosed herein, i.e. the conversion function, can be integrated into a UGC platform. Users can import the first material object they have created into the UGC platform. Through the UGC platform, the shader to be converted used by the first material object can be obtained. Then, users can select shader configuration on the UGC platform, and the shader configuration interface can be displayed. Conversion-related configurations can be made on the shader configuration interface.

[0061] 2) Receive the input target shader from the provided candidate shaders in the shader configuration interface.

[0062] In this embodiment of the disclosure, users can also be provided with a selection of candidate shaders. The candidate shaders can be understood as official shaders that can be correctly identified and rendered. For example, multiple official shaders for cartoon types are provided. Users can select any candidate shader as the target shader according to their needs. After selecting the target shader, users can click the shader conversion function to convert the shader to be converted into the target shader.

[0063] S102: Based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, determine the target attribute name that matches the attribute name to be converted in the shader to be converted, and assign the value of the attribute name to be converted to the matched target attribute name.

[0064] Regarding step S102, this disclosure provides possible implementation methods:

[0065] 1) Deserialize and parse the first material object to obtain the names of the attributes to be converted included in the shader to be converted.

[0066] In this embodiment of the disclosure, after obtaining the first material object, deserialization parsing can be performed to obtain information such as the shader to be converted used by the first material object, the names of each attribute to be converted included in the shader to be converted, and the values ​​of each attribute name to be converted.

[0067] 2) Based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, determine the target attribute name that the attribute name to be converted matches.

[0068] In this embodiment of the disclosure, a mapping relationship between other non-target attribute names and target attribute names is established in advance. That is, the non-target attribute names that any other non-official shader may use, and the target attribute names are the attribute names used by the official target shader. The definition of attribute names in any other non-official shader is also diverse. The functions or types implemented may be similar, but the names are not the same. The mapping relationship can be used to establish a match between other non-target attribute names and target attribute names.

[0069] In addition, the shader includes multiple different types of attributes, such as vectors and textures. The required attributes can be defined in the shader. In this embodiment, the attribute name to be converted is mainly for texture attributes, but other attributes can also be converted. This embodiment does not impose any restrictions.

[0070] 3) Convert the shader to be converted into the target shader, and assign the value of the attribute name to be converted to the matched target attribute name.

[0071] For example, if the shader to be converted is a general Lit, the attribute name to be converted is _MainTex, and the target shader is AN_HD under the cartoon type, according to the pre-established mapping relationship, it is found that the target attribute name matched by the attribute name _MainTex is _BaseTex. Then, the value of _MainTex, i.e. the texture to be used, can be assigned to _BaseTex. In this way, the _BaseTex in the target shader AN_HD can also use the texture for rendering.

[0072] Furthermore, the pre-established mapping relationship between target attribute names and non-target attribute names in the embodiments of this disclosure can basically cover the attribute names that may be used by other mainstream non-official shaders, satisfying the shader conversion requirements. However, since there are many different non-target shaders, there may be cases where the mapping relationship is not recorded. In such cases, the matching target attribute name cannot be found based on the pre-established mapping relationship. To ensure the conversion and rendering effect, this disclosure also provides a possible implementation method: in the case where the mapping relationship between the attribute name to be converted and the target attribute name is not recorded, the target attribute name matched by the attribute name to be converted is determined according to the writing order of the target attribute name in the program file of the target shader and the writing order of the attribute name to be converted in the program file of the shader to be converted.

[0073] A shader is a piece of program code. When writing each property or variable in the program code, there will be a certain order. If the mapping relationship is not recorded, the matching can be performed according to the order by default. Specifically, the writing order of the target property name in the program file of the target shader and the writing order of the property name to be converted in the program file of the shader to be converted are determined; the property name to be converted is matched with the target property name with the same writing order.

[0074] For example, if the attribute to be converted is a texture attribute, and the shader to be converted uses four textures, such as abcd in order, and the target shader uses six textures, such as 123456 in order, and none of them match in the mapping relationship, then according to the order written in the program file, i.e., the program code, abcd can be matched to 1234 in order, that is, a matches 1, b matches 2, c matches 3, and d matches 4.

[0075] In response to the situation where the mapping relationship is not recorded, this disclosure also provides a possible implementation method. Typically, there may be multiple attribute names to be converted in the shader to be converted. During matching, each attribute name to be converted is traversed and matched according to the mapping relationship. Some attribute names to be converted may be matched with the target attribute name, while others may not be matched. In the case where some attribute names to be converted have recorded mapping relationships, this disclosure can determine the writing order of the attribute names to be converted that have been matched with the target attribute name, as well as the writing order relationship between the attribute names to be converted that have not recorded mapping relationships and the matched attribute names. Then, the attribute names to be converted that have not recorded mapping relationships are matched sequentially to the next target attribute name in the writing order of the corresponding matched target attribute names.

[0076] For example, if the attribute names to be converted are abcd in the order they are written, and the target attribute names are 1234 in the order they are written, then according to the pre-established mapping relationship, abc will match 123 respectively, while there is no recorded mapping relationship for d, so d can be matched to 4 according to the order they are written.

[0077] Thus, in this embodiment of the disclosure, the attribute names of various other non-official shaders can be automatically matched to the attribute names of official shaders based on the pre-established mapping relationship between target attribute names and non-target attribute names, thereby realizing the transformation of shaders. Furthermore, for attribute names to be transformed that have not recorded mapping relationships, matching can also be performed according to the writing order rule, which can ensure that the transformation of target shaders can be performed and improve reliability.

[0078] S103: Based on the assigned target shader, regenerate and render the second material object for the first material object.

[0079] In this embodiment of the disclosure, after the shader to be converted is converted into the target shader, and the target shader has been assigned the value of the attribute name to be converted, the material can be regenerated and rendered based on the target shader and the value of the target attribute name. It can be understood that the official target shader is used to generate the second material object, but the second material object also uses the texture and other attribute parameters of the first material object, so as to ensure that the rendering effect of the second material object is basically the same as the rendering effect of the first material object expected by the user.

[0080] Furthermore, to improve user experience and interaction efficiency, this embodiment of the disclosure may also display a message indicating successful material object conversion and display the rendered second material object.

[0081] For example, when a user clicks the conversion button, the background executes the shader conversion logic. Once completed, a message indicating that the material object conversion was successful is displayed, along with the rendered second material object. In this way, the user can clearly understand the rendering effect after the conversion.

[0082] In this embodiment of the disclosure, in response to the conversion operation, the shader to be converted and the target shader of the first material object are obtained. According to the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, the target attribute name that matches the attribute name to be converted in the shader to be converted is determined, and the value of the attribute name to be converted is assigned to the matched target attribute name. Then, based on the assigned target shader, the first material object is regenerated and rendered to obtain the second material object. In this way, the mapping relationship between the non-target attribute name and the target attribute name can be pre-established, and the attribute name to be converted of the non-target shader to be converted can be automatically matched to the target attribute name of the target shader, realizing the conversion from the shader to the target shader. Thus, the material object can be regenerated and rendered based on the target shader, avoiding the problem of rendering errors of the first material object due to the incompatibility of the shader to be converted. Furthermore, users can freely use any shader to create material objects, only needing to convert them before uploading, which can also reduce the difficulty of user resource creation.

[0083] Furthermore, in this embodiment of the disclosure, it is necessary to pre-establish a mapping relationship between the target attribute name and the non-target attribute name. A possible implementation method for establishing this mapping relationship is provided, specifically, the mapping relationship can be established in the following way:

[0084] 1) Obtain the names of each target attribute included in the target shader.

[0085] In this embodiment of the disclosure, the target shader is a shader provided and supported by the official platform. It is usually limited and can enumerate all target shaders and the names of each target attribute included in all target shaders.

[0086] 2) Obtain the names of the non-target attributes included in each non-target shader.

[0087] For example, data mining can be used to collect the names of various non-target attributes used by any other non-target shaders. There may be many non-target shaders, and the names of various non-target attributes used by non-target shaders are also diverse. We can collect as many mainstream non-target attribute names as possible to basically meet the conversion requirements.

[0088] 3) Based on the functions represented by each target attribute name and each non-target attribute name, establish the mapping relationship between each target attribute name and each non-target attribute name.

[0089] Different users use different names for the attributes in the shader when writing shaders. In this embodiment, the mapping relationship can be determined based on the function or meaning expressed by the attribute name. Attribute names with the same function have a corresponding mapping relationship. Of course, it is also possible that the non-target attribute name used by the non-target shader is the same as the target attribute name used by the target shader. It can be considered that the attribute names with the same function have a mapping relationship. Alternatively, the mapping relationship can be determined by the function it represents. A mapping relationship table can be established to record the mapping relationship between each non-target attribute name and each target attribute name. In addition, the mapping relationship table can be continuously updated to meet the needs of more different non-target attribute names.

[0090] For example, if the target attribute name is _BaseTex, there may be multiple corresponding non-target attribute names, such as _MainTex, BaseMap, etc.

[0091] Thus, in this embodiment of the disclosure, non-target attribute names that any non-target shader may use can be collected, and a mapping relationship can be established between the non-target attribute names of non-target shaders and the target attribute names of official target shaders, so that various non-target shaders can be matched and converted to target shaders.

[0092] Additionally, it should be noted that the rendering method in this embodiment can be developed into a corresponding Software Development Kit (SDK) for release. This SDK can be integrated into existing UGC platforms, such as the Unity platform, as a functional plugin for the Unity platform, and provides a list of official target shaders available for conversion. In this way, before uploading their own material objects, users can first convert them based on this function to the official target shaders, and then upload the converted material objects. The converted material objects can then be guaranteed to render correctly.

[0093] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0094] The following uses a specific application scenario for illustration. In this embodiment of the disclosure, the rendering method in this embodiment can be integrated into the UGC platform as a functional plugin to facilitate user conversion operations. The interface operation in the UGC platform will be used as an example for illustration.

[0095] For example, when a user imports a first material object into a UGC platform, an error occurs during rendering because the first material object is generated based on a non-official, non-target shader. This could be because the non-target shader actually uses a texture, but the texture is not recognized during rendering. (See [link to relevant documentation]). Figure 2 As shown, this is a schematic diagram of the rendering effect of the first material object in an embodiment of this disclosure. Figure 2 It is clear that the texture used was not rendered.

[0096] Users can then select shader configuration options, which will display the shader configuration interface for reference. Figure 3 The diagram shown is a schematic of the shader configuration interface in an embodiment of this disclosure. Figure 3 As shown, the target shader to be converted is "*** / A". Users can select the target shader to be converted, such as "*** / B". By clicking the conversion button of the shader conversion function, the target shader to be converted can be converted to the target shader. According to the pre-established mapping relationship between target attribute names and non-target attribute names, the values ​​of the attribute names to be converted in the shader to be converted are assigned to the matching target attribute names.

[0097] After the conversion is complete, a second material object can be regenerated and rendered based on the target shader, for example, as shown below. Figure 4 The diagram shown illustrates the rendering effect of the second material object in this embodiment. Through conversion, the texture used by the shader to be converted can be assigned to the corresponding matching target attribute name of the target shader. Compared to... Figure 2 , Figure 4 The system can render the texture to ensure correct rendering, which is understandable. Figure 4 and Figure 2 This is just one possible example image; no color image is shown. In reality, Figure 4 After rendering, the second material object will display the actual style of the texture in color, but from... Figure 4 and Figure 2 In comparison, we can also learn Figure 4 and Figure 2 The rendering effects are different; the main difference lies in... Figure 4 It can identify and correctly render the textures used.

[0098] It should be noted that the interface operation diagram in this embodiment is only an example and should not be used to limit the embodiments of this disclosure.

[0099] In this embodiment of the disclosure, the non-target attribute name of any unofficial non-target shader can be matched and associated with the target attribute name of the target shader, so as to realize one-click conversion between different types of material objects, ensure rendering correctness, and improve reliability and efficiency.

[0100] Based on the same inventive concept, this disclosure also provides a rendering device corresponding to the rendering method. Since the principle of the device in this disclosure for solving the problem is similar to the rendering method described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0101] Reference Figure 5 The diagram shown is a schematic representation of a rendering apparatus provided in an embodiment of this disclosure. The apparatus includes:

[0102] The module 51 is configured to obtain, in response to the conversion operation, the shader to be converted and the target shader of the first material object, wherein the first material object is generated based on the shader to be converted;

[0103] The conversion module 52 is used to determine the target attribute name that matches the attribute name to be converted in the shader to be converted according to the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, and to assign the value of the attribute name to be converted to the matched target attribute name.

[0104] The rendering module 53 is used to regenerate and render the second material object based on the assigned target shader for the first material object.

[0105] In an optional embodiment, it further includes a building module 54, configured to:

[0106] Obtain the names of each target attribute included in the target shader;

[0107] Obtain the names of the non-target attributes included in each of the non-target shaders;

[0108] Based on the functions represented by each target attribute name and each non-target attribute name, a mapping relationship is established between each target attribute name and each non-target attribute name.

[0109] In an optional embodiment, when determining the target attribute name matching the attribute name to be converted in the shader to be converted based on a pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, and assigning the value of the attribute name to be converted to the matched target attribute name, the conversion module 52 is used to:

[0110] The first material object is deserialized and parsed to obtain the names of the attributes to be converted included in the shader to be converted;

[0111] Based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, determine the target attribute name that matches the attribute name to be converted.

[0112] The shader to be converted is converted into the target shader, and the value of the attribute name to be converted is assigned to the matched target attribute name.

[0113] In an optional embodiment, the conversion module 52 is further configured to: determine the target attribute name that matches the attribute name to be converted, based on the writing order of the target attribute name in the program file of the target shader and the writing order of the attribute name to be converted in the program file of the shader to be converted, when no mapping relationship between the attribute name to be converted and the target attribute name is recorded.

[0114] In an optional embodiment, when determining the target attribute name that matches the target attribute name based on the write order of the target attribute name in the program file of the target shader and the write order of the attribute name to be converted in the program file of the shader to be converted, the conversion module 52 is configured to:

[0115] Determine the writing order of the target attribute names in the program file of the target shader, and the writing order of the attribute names to be converted in the program file of the shader to be converted;

[0116] Match the attribute name to be converted with the target attribute name that has the same writing order.

[0117] In an optional embodiment, a configuration module 55 is further included, for:

[0118] For the shader to be converted of the first material object currently displayed, in response to the shader configuration operation, a shader configuration interface is displayed, wherein the shader configuration interface displays the shader to be converted and the shader conversion function, and the shader conversion function is used to receive the conversion operation;

[0119] The target shader is selected from the provided candidate shaders in the shader configuration interface.

[0120] In one optional embodiment, a display module 56 is further included, which is used to display a message indicating that the material object has been successfully converted, and to display the rendered second material object.

[0121] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0122] This disclosure also provides an electronic device, such as... Figure 6 The diagram shown is a schematic representation of the structure of an electronic device provided in an embodiment of this disclosure, including:

[0123] A processor 61 and a memory 62; the memory 62 stores machine-readable instructions executable by the processor 61, and the processor 61 executes the machine-readable instructions stored in the memory 62. When the machine-readable instructions are executed by the processor 61, the processor 61 performs the following steps:

[0124] In response to the conversion operation, a shader to be converted and a target shader of a first material object are obtained, wherein the first material object is generated based on the shader to be converted;

[0125] Based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, the target attribute name that matches the attribute name to be converted in the shader to be converted is determined, and the value of the attribute name to be converted is assigned to the matched target attribute name.

[0126] Based on the assigned target shader, a second material object is regenerated and rendered for the first material object.

[0127] In an optional embodiment, the processor 61 is further configured to:

[0128] Obtain the names of each target attribute included in the target shader;

[0129] Obtain the names of the non-target attributes included in each of the non-target shaders;

[0130] Based on the functions represented by each target attribute name and each non-target attribute name, a mapping relationship is established between each target attribute name and each non-target attribute name.

[0131] In an optional embodiment, when determining the target attribute name matching the attribute name to be converted in the shader to be converted based on a pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, and assigning the value of the attribute name to be converted to the matched target attribute name, the processor 61 is configured to:

[0132] The first material object is deserialized and parsed to obtain the names of the attributes to be converted included in the shader to be converted;

[0133] Based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, determine the target attribute name that matches the attribute name to be converted.

[0134] The shader to be converted is converted into the target shader, and the value of the attribute name to be converted is assigned to the matched target attribute name.

[0135] In an optional embodiment, the processor 61 is further configured to: determine the target attribute name that matches the attribute name to be converted, based on the write order of the target attribute name in the program file of the target shader and the write order of the attribute name to be converted in the program file of the shader to be converted, when no mapping relationship between the attribute name to be converted and the target attribute name is recorded.

[0136] In an optional embodiment, when determining the target attribute name that matches the target attribute name based on the write order of the target attribute name in the program file of the target shader and the write order of the attribute name to be converted in the program file of the shader to be converted, the processor 61 is configured to:

[0137] Determine the writing order of the target attribute names in the program file of the target shader, and the writing order of the attribute names to be converted in the program file of the shader to be converted;

[0138] Match the attribute name to be converted with the target attribute name that has the same writing order.

[0139] In an optional embodiment, the processor 61 is further configured to:

[0140] For the shader to be converted of the first material object currently displayed, in response to the shader configuration operation, a shader configuration interface is displayed, wherein the shader configuration interface displays the shader to be converted and the shader conversion function, and the shader conversion function is used to receive the conversion operation;

[0141] The target shader is selected from the provided candidate shaders in the shader configuration interface.

[0142] In an optional embodiment, the processor 61 is further configured to display a message indicating successful material object conversion and to display the rendered second material object.

[0143] The aforementioned memory 62 includes a main memory 621 and an external memory 622. The main memory 621, also known as internal memory, is used to temporarily store the computational data in the processor 61, as well as the data exchanged with external memory such as a hard disk. The processor 61 exchanges data with the external memory 622 through the main memory 621.

[0144] The specific execution process of the above instructions can be referred to the steps of the rendering method described in the embodiments of this disclosure, and will not be repeated here.

[0145] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the rendering method described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.

[0146] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the rendering method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0147] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0148] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0149] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0150] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0151] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0152] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A rendering method, characterized in that, include: In response to the conversion operation, a shader to be converted and a target shader of a first material object are obtained, wherein the first material object is generated based on the shader to be converted; Based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, the target attribute name that matches the attribute name to be converted in the shader to be converted is determined, and the value of the attribute name to be converted is assigned to the matched target attribute name. Based on the assigned target shader, a second material object is regenerated and rendered for the first material object to obtain the second material object; The step of regenerating and rendering a second material object based on the assigned target shader for the first material object includes: Based on the first material object, a second material object is regenerated and rendered according to the assigned target shader; The rendering method further includes: Obtain the names of each target attribute included in the target shader; Obtain the names of the non-target attributes included in each of the non-target shaders; and Based on the functions represented by each target attribute name and each non-target attribute name, establish a mapping relationship between each target attribute name and each non-target attribute name; Specifically, the target shader and each target attribute name included in the target shader are enumerated; each non-target attribute name included in the non-target shader is collected through data mining; and there is a mapping relationship between each target attribute name and each non-target attribute name with the same function or name.

2. The method according to claim 1, characterized in that, The step of determining the target attribute name matching the attribute name to be converted in the shader to be converted, based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, and assigning the value of the attribute name to be converted to the matched target attribute name, includes: The first material object is deserialized and parsed to obtain the names of the attributes to be converted included in the shader to be converted; Based on the pre-established mapping relationship between the target attribute name in the target shader and the non-target attribute name in the non-target shader, determine the target attribute name that matches the attribute name to be converted. The shader to be converted is converted into the target shader, and the value of the attribute name to be converted is assigned to the matched target attribute name.

3. The method according to claim 2, characterized in that, The method further includes: In the absence of a recorded mapping relationship between the attribute name to be converted and the target attribute name, the target attribute name that matches the attribute name to be converted is determined based on the writing order of the target attribute name in the program file of the target shader and the writing order of the attribute name to be converted in the program file of the shader to be converted.

4. The method according to claim 3, characterized in that, Determining the target attribute name that matches the target attribute name based on the write order of the target attribute name in the target shader's program file and the write order of the attribute name to be converted in the shader's program file includes: Determine the writing order of the target attribute names in the program file of the target shader, and the writing order of the attribute names to be converted in the program file of the shader to be converted; Match the attribute name to be converted with the target attribute name that has the same writing order.

5. The method according to claim 1, characterized in that, The method further includes: For the shader to be converted of the first material object currently displayed, in response to the shader configuration operation, a shader configuration interface is displayed, wherein the shader configuration interface displays the shader to be converted and the shader conversion function, and the shader conversion function is used to receive the conversion operation; The target shader is selected from the provided candidate shaders in the shader configuration interface.

6. The method according to claim 1, characterized in that, The method further includes: Display a message indicating successful material object conversion, and then display the rendered second material object.

7. A rendering apparatus, characterized in that, include: A module for obtaining a first material object in response to a conversion operation, wherein the first material object is generated based on the first material object; The conversion module is used to determine the target attribute name that matches the attribute name to be converted in the shader to be converted, based on a pre-established mapping relationship between target attribute names in the target shader and non-target attribute names in the non-target shader, and to assign the value of the attribute name to be converted to the matched target attribute name; and The rendering module is used to regenerate and render the second material object based on the assigned target shader for the first material object; The rendering module is further configured to regenerate and render a second material object based on the first material object and the assigned target shader. The rendering device further includes: a creation module, The establishment module is configured as follows: Obtain the names of each target attribute included in the target shader; Obtain the names of the non-target attributes included in each of the non-target shaders; and Based on the functions represented by each target attribute name and each non-target attribute name, a mapping relationship is established between each target attribute name and each non-target attribute name. Specifically, the target shader and each target attribute name included in the target shader are enumerated; each non-target attribute name included in the non-target shader is collected through data mining; and there is a mapping relationship between each target attribute name and each non-target attribute name with the same function or name.

8. An electronic device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, the processor executing the machine-readable instructions stored in the memory, wherein when the machine-readable instructions are executed by the processor, the processor performs the steps of the method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-6.