A material processing method of a virtual object and related products
Patent Information
- Application Number
- CN202510186915.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2026-08-21
AI Technical Summary
然而,相同的着色器在渲染不同的虚拟对象的材质时,或者,相同的着色器在渲染同一虚拟对象的不同材质时,可以采用相同的参数名称和参数类型,采用不同的参数值,但每次生成虚拟对象的材质时,针对所创建的渲染参数需要为其分配存储空间,在销毁材质时,针对渲染参数也需回收为其分配的存储空间,表明会频繁调用内存,容易导致浪费资源
[0023] In this application's technical solution, the identification information of the target shader used to render the virtual object is first obtained. The virtual object may include objects in the game scene. Then, based on the correspondence between the shader's identification information and the storage space of the rendering parameter set, the target storage space of the target rendering parameter set corresponding to the target shader's identification information is determined. The rendering parameter set is used to store the attribute information of the rendering parameters, indicating that the target rendering parameter set stored in the target storage space can be used to store the attribute information of the target rendering parameters. The attribute information of the target rendering parameters can then be read from the target rendering parameter set stored in the target storage space. Subsequently, based on the attribute information of the target shader and the target rendering parameters, the virtual object is rendered to generate the virtual object's material, so that the virtual object with the material can be displayed in the game scene. Finally, when the virtual object's material is destroyed, the attribute information of the target rendering parameters is written back into the target rendering parameter set stored in the target storage space. Since the target storage space is pre-allocated for the target rendering parameter set, when rendering virtual objects using the target shader, there is no need to call memory to allocate the target storage space again. It is only necessary to directly use the attribute information of the target rendering parameters stored therein. After use (that is, when the material of the virtual object is destroyed), there is no need to reclaim the target storage space. It is only necessary to write the attribute information of the target rendering parameters back into it. This means that the target storage space can be reused. For the same target shader, there is no need to repeatedly create and destroy the target rendering parameters, and thus no need to call memory frequently. It only needs to be called once, which greatly saves resources.
Smart Images

Figure CN122605185A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of rendering technology, and in particular to a material processing method for virtual objects and related products. Background Technology
[0002] With the rapid development of technology, in order to bring users a sense of immersion and realism, virtual objects displayed on terminal devices can be rendered to generate realistic visual effects, thereby creating a lifelike viewing experience for users. For example, in a game scene, shaders can be used to render game characters, giving them textures such as skin and clothing.
[0003] In related technologies, when generating materials for virtual objects, rendering parameters can be created for the shaders used to render the virtual objects. These parameters include names, types, and values. The rendering parameters created by the shader can generate the materials for the virtual objects, and these parameters are also destroyed when the virtual object's materials are destroyed. However, when the same shader renders materials for different virtual objects, or when the same shader renders different materials for the same virtual object, the same parameter names and types can be used, but different parameter values can be used. Each time a material is generated for a virtual object, storage space needs to be allocated for the created rendering parameters, and when the material is destroyed, the allocated storage space for the rendering parameters also needs to be reclaimed. This indicates frequent memory access and can easily lead to wasted resources. Summary of the Invention
[0004] This application provides a method for processing the material of virtual objects and related products, with the aim of reducing frequent memory access and thus saving resources.
[0005] The first aspect of this application provides a method for material processing of virtual objects, including:
[0006] Obtain the identification information of the target shader used to render the virtual object; the virtual object includes objects in the game scene.
[0007] Based on the correspondence between the shader's identification information and the storage space of the rendering parameter set, the target storage space of the target rendering parameter set corresponding to the target shader's identification information is determined; the rendering parameter set is used to store the attribute information of the rendering parameters.
[0008] The attribute information of the target rendering parameters is read from the target rendering parameter set stored in the target storage space;
[0009] Based on the attribute information of the target shader and the target rendering parameters, the virtual object is rendered to generate the material of the virtual object, so as to display the virtual object with material in the game scene;
[0010] If the material of the virtual object is destroyed, the attribute information of the target rendering parameters is written back into the target rendering parameter set stored in the target storage space.
[0011] A second aspect of this application provides a material processing apparatus for virtual objects, comprising:
[0012] The identification information acquisition module is used to acquire the identification information of the target shader used to render virtual objects; the virtual objects include objects in the game scene.
[0013] The storage space determination module is used to determine the target storage space of the target rendering parameter set corresponding to the identification information of the target shader based on the correspondence between the identification information of the shader and the storage space of the rendering parameter set; the rendering parameter set is used to store the attribute information of the rendering parameters.
[0014] The attribute information reading module is used to read the attribute information of the target rendering parameters from the target rendering parameter set stored in the target storage space;
[0015] The material generation module is used to render the virtual object and generate the material of the virtual object based on the attribute information of the target shader and the target rendering parameters, so as to display the virtual object with material in the game scene;
[0016] The attribute information writing module is used to write the attribute information of the target rendering parameters back into the target rendering parameter set stored in the target storage space when the material of the virtual object is destroyed.
[0017] A third aspect of this application provides a material processing device for virtual objects, the device comprising a processor and a memory:
[0018] The memory is used to store computer programs and to transfer the computer programs to the processor;
[0019] The processor is used to execute the steps of the material processing method for the virtual object provided in the first aspect according to the instructions in the computer program.
[0020] A fourth aspect of this application provides a computer-readable storage medium for storing a computer program that, when executed by a material processing device for a virtual object, implements the steps of the material processing method for a virtual object provided in the first aspect.
[0021] The fifth aspect of this application provides a computer program product, including a computer program that, when executed by a material processing device for a virtual object, implements the steps of the material processing method for a virtual object provided in the first aspect.
[0022] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0023] In this application's technical solution, the identification information of the target shader used to render the virtual object is first obtained. The virtual object may include objects in the game scene. Then, based on the correspondence between the shader's identification information and the storage space of the rendering parameter set, the target storage space of the target rendering parameter set corresponding to the target shader's identification information is determined. The rendering parameter set is used to store the attribute information of the rendering parameters, indicating that the target rendering parameter set stored in the target storage space can be used to store the attribute information of the target rendering parameters. The attribute information of the target rendering parameters can then be read from the target rendering parameter set stored in the target storage space. Subsequently, based on the attribute information of the target shader and the target rendering parameters, the virtual object is rendered to generate the virtual object's material, so that the virtual object with the material can be displayed in the game scene. Finally, when the virtual object's material is destroyed, the attribute information of the target rendering parameters is written back into the target rendering parameter set stored in the target storage space. Since the target storage space is pre-allocated for the target rendering parameter set, when rendering virtual objects using the target shader, there is no need to call memory to allocate the target storage space again. It is only necessary to directly use the attribute information of the target rendering parameters stored therein. After use (that is, when the material of the virtual object is destroyed), there is no need to reclaim the target storage space. It is only necessary to write the attribute information of the target rendering parameters back into it. This means that the target storage space can be reused. For the same target shader, there is no need to repeatedly create and destroy the target rendering parameters, and thus no need to call memory frequently. It only needs to be called once, which greatly saves resources.
[0024] Furthermore, when rendering virtual objects through the target shader, there is no need to wait for the creation of the target rendering parameter attribute information, which helps to reduce the display lag of virtual objects in game scenes, improve the display smoothness of virtual objects, and thus enhance the user experience. Attached Figure Description
[0025] Figure 1 A scene architecture diagram of a material processing method for virtual objects provided in an embodiment of this application;
[0026] Figure 2 A flowchart illustrating a material processing method for a virtual object provided in this application embodiment;
[0027] Figure 3A schematic diagram of a parameter value editing page provided in an embodiment of this application;
[0028] Figure 4 A schematic diagram of a game scene provided for an embodiment of this application;
[0029] Figure 5 This is a schematic diagram of a method for generating materials for virtual objects in related technologies;
[0030] Figure 6 A schematic diagram illustrating a material processing method for a virtual object provided in an embodiment of this application;
[0031] Figure 7 This is a schematic diagram of the structure of a material processing device for virtual objects provided in an embodiment of this application;
[0032] Figure 8 This is a schematic diagram of the server structure in an embodiment of this application;
[0033] Figure 9 This is a schematic diagram of the structure of a terminal device in an embodiment of this application. Detailed Implementation
[0034] The embodiments of this application will now be described with reference to the accompanying drawings.
[0035] First, we will explain several terms that may be involved in the embodiments of this application below.
[0036] Rendering, also known as drawing, refers to the process of displaying virtual objects on the screen of a terminal device or server. For example, in a game scene, rendering refers to the process of drawing game characters, buildings, and other objects onto the screen.
[0037] Model: A static resource used to represent various three-dimensional or two-dimensional objects in a game. A model can be static or dynamic. In this embodiment, the virtual object refers to the model.
[0038] Shader: A shader is a program that is mainly used to execute on the Graphics Processing Unit (GPU). It can control the rendering process of virtual objects, including vertex processing, pixel processing, geometry processing, etc. By writing and using shaders, the materials of virtual objects can be rendered, thereby displaying various complex display effects.
[0039] Constant Buffer: In shader programming, a constant buffer is a mechanism for efficiently transferring constant data between the GPU and the Central Processing Unit (CPU). Constant buffers are typically used to store infrequently changing global data. In this embodiment, a constant buffer refers to the storage space used to store attribute information of rendering parameters, such as the target storage space, first storage space, and second storage space described later. During the rendering phase of a virtual object, the constant buffer can be accessed to read the attribute information of the rendering parameters.
[0040] Material: A set of properties used to define the surface appearance of a virtual object. The material determines how a virtual object behaves under lighting conditions, and its corresponding rendering parameters can include color, gloss, transparency, reflectivity, etc.
[0041] Game resources refer to various resources used in a game, including models, images, etc. In this embodiment, game resources refer to a set of rendering parameters pre-configured in storage space for shaders, such as a set of target rendering parameters pre-configured in target storage space for a target shader.
[0042] A game object is an entity generated from game resources during the running of a game or game editor. A game object generated from a single virtual object can be one or more. In this embodiment, taking the target shader as an example, running the target shader based on a pre-configured set of target rendering parameters to render the materials of the virtual object constitutes running a game object. Furthermore, the target shader can render multiple materials of a single virtual object, or multiple virtual objects; this application does not limit this.
[0043] Currently, taking a game scenario as an example, when rendering virtual objects using shaders, the virtual object is created first, followed by its material. During material creation, rendering parameters required for the virtual object can be created, including parameter names, types, and values. For instance, a lookup table structure can be used to store these rendering parameters. There is a one-to-one binding between materials and rendering parameters; each creation or destruction of a material results in the creation or destruction of its corresponding rendering parameters. However, when the same shader renders different virtual objects, or different materials of the same virtual object, the same parameter names and types can be used, but with different values. Each creation of a rendering parameter requires allocating storage space, and destroying a rendering parameter requires reclaiming that allocated space. This means that even for the same shader, the same parameter names and types need to be repeatedly created or destroyed, leading to frequent memory access and wasted resources.
[0044] In view of the above problems, this application provides a method for processing the material of virtual objects and related products, aiming to reduce frequent memory access and thus save resources. In the technical solution provided in this application, the identification information of the target shader used to render the virtual object is first obtained; then, based on the correspondence between the shader identification information and the storage space of the rendering parameter set, the target storage space of the target rendering parameter set corresponding to the target shader identification information is determined, wherein the rendering parameter set is used to store the attribute information of the rendering parameters; then, the attribute information of the target rendering parameters is read from the target rendering parameter set stored in the target storage space; subsequently, based on the attribute information of the target shader and the target rendering parameters, the virtual object is rendered to generate the material of the virtual object; finally, when the material of the virtual object is destroyed, the attribute information of the target rendering parameters is written back into the target rendering parameter set stored in the target storage space.
[0045] In this way, by pre-allocating target storage space for the target rendering parameter set corresponding to the target shader, when rendering virtual objects using the target shader, the attribute information of the stored target rendering parameters can be directly accessed. Furthermore, after use, the attribute information of the target rendering parameters can be written back into the storage space. This means that for the same target shader, there is no need to repeatedly create and destroy target rendering parameters; instead, the target rendering parameter set in the target storage space can be reused. This avoids frequent memory access, requiring only a single access, thus saving resources. In addition, when rendering virtual objects through the target shader, there is no need to wait for the creation of the target rendering parameter attribute information, which helps reduce display stuttering and improves the smoothness of virtual object display.
[0046] Next, the subject of the material processing method for virtual objects provided in the embodiments of this application will be specifically introduced.
[0047] The execution subject of the virtual object material processing method provided in this application embodiment can be a terminal device. For example, the terminal device obtains the identification information of the target shader used to render the virtual object. As an example, the terminal device may include, but is not limited to, mobile phones, desktop computers, tablet computers, laptops, PDAs, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. The execution subject of the virtual object material processing method provided in this application embodiment can also be a server. For example, the server determines the target storage space of the target rendering parameter set corresponding to the identification information of the target shader in the correspondence between the shader identification information and the storage space of the rendering parameter set.
[0048] Furthermore, the material processing method for virtual objects provided in this application embodiment can also be executed collaboratively by a terminal device and a server. For example, the terminal device obtains the identification information of the target shader used to render the virtual object and sends the identification information of the target shader to the server; then, the server determines the target storage space of the target rendering parameter set corresponding to the identification information of the target shader in the correspondence between the shader identification information and the storage space of the rendering parameter set; subsequently, the server reads the attribute information of the target rendering parameters from the target rendering parameter set stored in the target storage space and sends the attribute information of the target rendering parameters to the terminal device; then, the terminal device renders the virtual object and generates the material of the virtual object based on the attribute information of the target shader and the target rendering parameters; finally, when the material of the virtual object is destroyed, the terminal device sends the attribute information of the target rendering parameters to the server, and the server writes the attribute information of the target rendering parameters back into the target rendering parameter set stored in the target storage space. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application. Therefore, the implementation subject of the technical solution of this application is not limited in this embodiment.
[0049] Figure 1 An exemplary scene architecture diagram of a material processing method for virtual objects is shown. Figure 1 It includes servers and various types of terminal devices. Figure 1 The server shown can be a standalone physical server, a server cluster consisting of multiple physical servers, or a distributed system. Additionally, the server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0050] Next, taking the terminal device as the execution subject, the material processing method for virtual objects provided in the embodiments of this application will be described in detail.
[0051] See Figure 2 This figure is a flowchart of a material processing method for a virtual object provided in an embodiment of this application. Figure 2 The material processing method for the virtual object shown includes the following steps:
[0052] S201: Obtain the identification information of the target shader used to render the virtual object.
[0053] In this embodiment of the application, based on the above-described content about rendering, virtual objects, and shaders, it is known that the target shader can render virtual objects to generate the material of the virtual objects.
[0054] Virtual objects refer to objects in a virtual environment, which are different from objects in the real world. For example, in a game scene, virtual objects can include objects within the game scene, such as game characters, like the game character "Arthur" in game A; virtual objects can also be game buildings, such as buildings, fountains, etc.
[0055] It should be noted that this application does not limit the scene in which the virtual object is located. The virtual object may also include objects in the film and television production scene. For example, the virtual object can be a film and television character, film and television scenery, film and television special effects, etc. This application does not limit it.
[0056] The target shader's identification information refers to the information that can be used to identify the target shader and distinguish it from other shaders.
[0057] For example, the identification information of the target shader can be the name of the target shader. For example, taking the rendered object as a game character, its corresponding target shader can be at least one of the skin shader, hair shader, or clothing shader.
[0058] Accordingly, the target shader can be named a skin shader, hair shader, eye shader, or clothing shader such as silk shader and leather shader, which are used to render the surface appearance of different parts of the game character.
[0059] For example, the identification information of the target shader can be information such as the numerical code of the target shader. For example, the identification information of the target shader is "12121", and the identification information of other shaders can be "12122", "12123", etc. Different numerical codes can indicate different shaders, such as skin shader, hair shader, eye shader, and clothing shader.
[0060] It should be noted that this application does not limit the identification information of the target shader; it is sufficient to identify the target shader and distinguish it from other shaders.
[0061] In this way, in a game scenario, the identification information of the target shader corresponding to the virtual object can be obtained to execute subsequent steps to complete the rendering of the virtual object, thus fully satisfying the user's gaming experience.
[0062] In some embodiments, a corresponding target shader can be pre-configured for the virtual object, for example, a corresponding configuration file can be configured for the virtual object, which includes the identification information of the target shader. When rendering the virtual object, the identification information of the corresponding target shader can be obtained by obtaining the configuration file of the virtual object.
[0063] S202: Determine the target storage space of the target rendering parameter set corresponding to the target shader's identification information in the correspondence between the shader's identification information and the storage space of the rendering parameter set.
[0064] In this embodiment, the rendering parameter set is used to store attribute information of rendering parameters. The rendering parameter set may include attribute information of at least one rendering parameter. Attribute information of a rendering parameter refers to information used to describe the characteristics of the rendering parameter. For example, the attribute information of a rendering parameter may include the parameter name, parameter type, and parameter value. For ease of understanding, this will be used as an example in the following explanation.
[0065] It should be noted that the above list of rendering parameter attribute information is only an example, and it may include more items than those mentioned above, which is not limited in this application.
[0066] For example, suppose the target rendering parameter set includes the attribute information corresponding to target rendering parameter 1 through target rendering parameter 3. Taking the skin shader as an example, the parameter name of target rendering parameter 1 can be roughness, which can be used to control the smoothness of the skin. Its parameter type can be floating-point type (Float), and its parameter value can be 3.2, etc.; the parameter name of target rendering parameter 2 can be color, which can be used to define the base color of the skin. Its parameter type can be texture type (Texture), and its parameter value can indicate yellow; the parameter name of target rendering parameter 3 can be blending mode (used to control transparency), which can be used to control the transparency of the skin. Its parameter type can be integer, and its parameter value can be 0.
[0067] For example, the target rendering parameter set includes the attribute information corresponding to target rendering parameters 2 through 4, respectively. Taking the clothing shader as the target shader, the descriptions of target rendering parameters 2 and 3 can be found in the example above and will not be repeated here. The parameter name of target rendering parameter 4 can be a normal map, which can be used to simulate the fine details of the clothing surface, such as bumps or textures. Its parameter type can be a texture type, and the parameter value can indicate that a texture is present.
[0068] In some embodiments, the shaders include shader 1 through shader N, and the storage space for the rendering parameter set includes storage space 1 through storage space N. Storage space 1 is used to store the rendering parameter set corresponding to shader 1, storage space 2 is used to store the rendering parameter set corresponding to shader 2, and so on. Storage space N is used to store the rendering parameter set corresponding to shader N. There is a one-to-one correspondence between shaders and storage spaces. Therefore, the identification information of shader 1 can be recorded as a correspondence with storage space 1, the identification information of shader 2 can be recorded as a correspondence with storage space 2, and so on, the identification information of shader N can be recorded as a correspondence with storage space N.
[0069] After obtaining the identification information of the target shader, it can be determined whether the identification information of the shader includes the identification information of the target shader in the correspondence between the identification information of the shader and the storage space of the rendering parameter set. If it is determined that the target shader exists, its corresponding storage space is the target storage space used to store the target rendering parameter set corresponding to the target shader.
[0070] In some embodiments, the terminal device can store the correspondence between the shader's identification information and the address information of the storage space for the rendering parameter set. In the terminal device, memory can be divided into multiple small storage spaces (also called memory units), and these small storage spaces are numbered and managed. The number of the storage space is its address information. Based on the address information of the storage space, the terminal device can accurately locate the location of the storage space. Based on the example above, determining the target storage space allows us to determine its address information, enabling the terminal device to accurately locate the target storage space and then access the target rendering parameter set.
[0071] S203: Read the attribute information of the target rendering parameters from the target rendering parameter set stored in the target storage space.
[0072] Based on the example above, the rendering parameter set is used to store the attribute information of the rendering parameters, indicating that the target rendering parameter set stores the attribute information of the target rendering parameters. Therefore, the terminal device can read the attribute information of the target rendering parameters from the target storage space.
[0073] S204: Based on the attribute information of the target shader and the target rendering parameters, render the virtual object to generate the material of the virtual object, so as to display the virtual object with the material in the game scene.
[0074] Understandably, materials using the same shader may have different parameter values. Therefore, after obtaining the attribute information of the target rendering parameters, the parameter values can be updated to obtain the updated attribute information of the target rendering parameters, where the parameter names and types remain unchanged. The target shader and the attribute information of the target rendering parameters can then be passed to the GPU. The shader can then run on the GPU using the attribute information of the target rendering parameters to render the virtual object, generate the virtual object's material, and thus display the virtual object with the material in the game scene. This results in a realistic effect that satisfies the user's visual experience.
[0075] The parameter values can be pre-defined by artists or other users for the materials to be rendered on the virtual object. For example, based on the configuration file for the virtual object described in the example above, the parameter values for the target rendering parameters corresponding to the material can be added to this configuration file. See also... Figure 3 This figure is a schematic diagram of a parameter value editing page provided in an embodiment of this application. Figure 3 As shown, this parameter value editing page can include multiple rendering parameters such as color, brightness, and roughness, which can be edited by users such as artists. For example, the parameter value editing page can be displayed on a terminal device running the Unity platform.
[0076] In some embodiments, the parameter values included in the attribute information of the target rendering parameters read can be the parameter values updated when the terminal device rendered the material last time.
[0077] For example, suppose the material generated by S204 is material B. Before generating material B, material A is also generated for another rendering virtual object through the target shader. Material A and material B are generated using the same target shader, and the parameter names and types of the rendering parameters required by them are the same, but the parameter values are different. Taking the target shader as including rendering parameter 1 and rendering parameter 2 as an example, the target rendering parameters of material A are: {rendering parameter 1: parameter value 1; rendering parameter 2: parameter value 2}. If material A is destroyed, the attribute information of the rendering parameters of material A can be written back into the target rendering parameter set stored in the target storage space, that is, {rendering parameter 1: parameter value 1; rendering parameter 2: parameter value 2} is written into the target rendering parameter set. Then, when S204 is executed, {rendering parameter 1: parameter value 1; rendering parameter 2: parameter value 2} is read, and updated based on the parameter values recorded in the configuration file to obtain {rendering parameter 1: parameter value 3; rendering parameter 2: parameter value 4}.
[0078] Furthermore, in some embodiments, the parameter values included in the attribute information of the read target rendering parameters may be randomly generated values or preset values. For example, when the terminal device rewrites the attribute information of the rendering parameters of material A into the target rendering parameter set, it may update the parameter values to randomly generated values or preset values. This application does not limit this.
[0079] As an example, see Figure 4 This figure is a schematic diagram of a game scene provided in an embodiment of this application. Figure 4 As shown, in this game scene, virtual objects can include game character A, which can be rendered using one or more target shaders and has materials such as hair, clothing, and backpack.
[0080] S205: If the material of the virtual object is destroyed, the attribute information of the target rendering parameters is written back into the target rendering parameter set stored in the target storage space.
[0081] It should be understood that the material of a virtual object may change. For example, if the appearance of a virtual object, such as clothing or hair, is changed to another style, the material of the virtual object will be modified, the original material will need to be destroyed, and a new material will be generated. Similarly, when a virtual object is destroyed, its material will also be destroyed accordingly.
[0082] When the material of the virtual object described above is destroyed, the attribute information of the target rendering parameters can be written back into the target rendering parameter set stored in the target space without destroying the attribute information of the target rendering parameters, and thus without reclaiming the target storage space allocated for the attribute information of the target rendering parameters.
[0083] For example, based on the example above, taking the latest target rendering parameter attribute information as {rendering parameter 1: parameter value 3; rendering parameter 2: parameter value 4} as an example, {rendering parameter 1: parameter value 3; rendering parameter 2: parameter value 4} can be written again into the target rendering parameter set stored in the target storage space.
[0084] In one possible implementation of this application, the target rendering parameter set includes multiple identical rendering parameter groups, each including attribute information of at least one target rendering parameter. For example, the target rendering parameter set includes 5 rendering parameter groups, each including attribute information of target rendering parameter 1 to target rendering parameter 3; that is, the content included in these 5 rendering parameter groups is identical.
[0085] It should be noted that this application does not limit the number of rendering parameter groups included in the target rendering parameter set, nor does it limit the attribute information of the target rendering parameters included in each rendering parameter group, as long as it satisfies the operation of the target shader.
[0086] Accordingly, S203 described above may specifically include: reading the attribute information of the target rendering parameters included in the target rendering parameter group from the target rendering parameter set stored in the target storage space, wherein the target rendering parameter group belongs to multiple identical rendering parameter groups included in the target rendering parameter set.
[0087] For example, if the target rendering parameter set includes 5 rendering parameter groups, specifically rendering parameter group 1 to rendering parameter group 5, then the attribute information of the target rendering parameters included in rendering parameter group 1 can be read. Rendering parameter group 1 is the target rendering parameter group.
[0088] Understandably, there may be situations where the target shader needs to render for multiple virtual objects or for multiple materials of a single virtual object. Taking the example of the target shader needing to render for multiple virtual objects, in this case, for each virtual object, the attribute information of the target rendering parameters included in a rendering parameter set can be read. For example, the target shader will render virtual objects 1 through 3. If the target rendering parameter set includes 5 rendering parameter sets, for virtual object 1, the attribute information of the target rendering parameters included in rendering parameter set 1 can be read; for virtual object 2, the attribute information of the target rendering parameters included in rendering parameter set 2 can be read; and for virtual object 3, the attribute information of the target rendering parameters included in rendering parameter set 3 can be read, so that the materials of different virtual objects can be generated separately subsequently.
[0089] Therefore, considering that in scenarios such as game scenes, the target shader may render multiple virtual objects or multiple materials of a single virtual object at the same time, multiple identical rendering parameter sets can be provided to the target shader to ensure that multiple materials can obtain the rendering parameter sets they need, avoid conflicts, and help ensure the successful rendering of virtual objects and generation of their materials.
[0090] Understandably, when the attribute information of the target rendering parameters included in a rendering parameter group is read out for use by the target shader or other shaders, it indicates that the storage space where the rendering parameter group resides (i.e., a part of the target storage space) is occupied. At this time, the terminal device can no longer read the attribute information of the target rendering parameters included in the rendering parameter group from the target storage space. To avoid the terminal device failing to read, the following method can be used to add marker information to the rendering parameter group that has already been read.
[0091] In one possible implementation of this application, the above-described "reading the attribute information of the target rendering parameters included in the target rendering parameter group from the target rendering parameter set stored in the target storage space" may specifically include: if it is determined from the target rendering parameter set stored in the target storage space that the target rendering parameter group does not have marking information, then reading the attribute information of the target rendering parameters included in the target rendering parameter group. Here, the target rendering parameter group can be any group of rendering parameters in the target rendering parameter set that does not have marking information.
[0092] The marker information is used to indicate that the attribute information of the rendering parameters included in the rendering parameter group is in use. For example, a marker field can be added to each rendering parameter group. When the marker field is a first value, such as 1, it indicates that the corresponding rendering parameter group has marker information, that is, the attribute information of the rendering parameters included in the rendering parameter group is in use. When the marker field is a second value, such as 0, it indicates that the corresponding rendering parameter group does not have marker information, that is, the attribute information of the rendering parameters included in the rendering parameter group has not been read.
[0093] For example, if the target rendering parameter set includes 5 rendering parameter groups, specifically rendering parameter group 1 to rendering parameter group 5, where the value of the marker field corresponding to rendering parameter group 1 to rendering parameter group 3 is the second value, and the value of the marker field corresponding to rendering parameter group 4 and rendering parameter group 5 is the first value, then the terminal device can read the attribute information of the rendering parameters included in any of the rendering parameter groups from rendering parameter group 1 to rendering parameter group 3.
[0094] Accordingly, after the attribute information of the target rendering parameters included in the target rendering parameter group is read, a marker can be added to the target rendering parameter group to indicate that the attribute information of the target rendering parameters included in the target rendering parameter group is in use, thus avoiding subsequent read failures. For example, the value of the marker field of the target rendering parameter group can be updated from the second value to the first value.
[0095] In this way, by adding the marking information, the terminal device can clearly understand the usage of the rendering parameter group, thereby reducing the occurrence of situations where the terminal device cannot successfully read the attribute information of the target rendering parameters, which is conducive to the stable generation of virtual object materials.
[0096] Accordingly, in one possible implementation, S205 may specifically include: when the material of the virtual object is destroyed, rewriting the attribute information of the target rendering parameters into the target rendering parameter group stored in the target storage space. After executing S205, the material processing method for the virtual object may further include: deleting the tag information of the target rendering parameter group. For example, the value of the tag field of the target rendering parameter group may be updated from a first value to a second value.
[0097] In this way, timely updates to the target rendering parameter group can prevent interference with the rendering of other materials.
[0098] In one possible implementation of this application, the material processing method for the virtual object may further include step 1: if it is determined from the target rendering parameter set stored in the target storage space that all rendering parameter groups have the marker information, indicating that the attribute information of the target rendering parameters included in all rendering parameter groups is in use and the terminal device cannot read the required content, then the corresponding attribute information of the target rendering parameters can be created for the target shader, and a first storage space can be allocated to store the created attribute information of the target rendering parameters. Accordingly, the material processing method for the virtual object may further include step 2: if the material of the virtual object is destroyed, the attribute information of the target rendering parameters is destroyed, and the first storage space allocated for the attribute information of the target rendering parameters is reclaimed.
[0099] It should be noted that in this implementation, after executing S201 and S202, step 1 can be executed, and then S204 can be executed. However, there is no need to execute S205; instead, step 2 can be executed.
[0100] In some embodiments, the terminal device can create attribute information for the target rendering parameters corresponding to the target shader. During the creation process, the system's underlying memory allocation function is called to allocate a first storage space for the attribute information of the target rendering parameters. Subsequently, the corresponding memory release function in the system's underlying layer is called to reclaim the first storage space (i.e., release the first storage space).
[0101] In this way, if the set of rendering parameters pre-configured for the target shader is unavailable, the attribute information of the target rendering parameters required by the target shader can be created on the spot for use, avoiding the situation where the rendering of virtual objects cannot proceed smoothly, which is beneficial to maintaining the user experience.
[0102] In one possible implementation of this application, the material processing method for the virtual object may further include the following steps:
[0103] A1: Get the usage frequency of each of the multiple shaders.
[0104] In this embodiment, for each shader, the usage frequency refers to the number of times or how frequently the shader renders virtual objects within a unit of time or a preset time period, reflecting the virtual object's demand for the shader. For example, the time granularity of the unit of time can be seconds, minutes, hours, or days, etc., and the preset time period can be 1 hour or 1 day, etc. This application does not limit the length of the preset time period.
[0105] In some embodiments, rendering a virtual object by a shader is considered as one use. Therefore, the number of materials rendered by a shader per unit time can be calculated as the shader's usage frequency. For example, taking one hour as a unit time, in a game scene, the terminal device can run the game and record that the number of materials rendered by shaders 1-5 within one hour are 20, 25, 12, 3, and 10 respectively. Then, the usage frequencies of shaders 1-5 are 20, 25, 12, 3, and 10 respectively.
[0106] A2: Select the shaders to be configured from the plurality of shaders whose usage frequency is greater than or equal to a preset frequency.
[0107] In this embodiment of the application, the shader to be configured includes the target shader, that is, the usage frequency of the target shader is greater than or equal to the preset frequency.
[0108] Understandably, compared to shaders used less frequently, shaders used more frequently will access memory more often, increasing the operating pressure on the terminal device. Therefore, shaders used more frequently can be selected based on a preset frequency. Shaders with a usage frequency greater than or equal to the preset frequency are considered high-frequency shaders (also known as shaders to be configured), while shaders with a usage frequency less than the preset frequency are considered low-frequency shaders. The preset frequency can be set based on the experience of technical personnel and other users; this application does not impose any limitations on it.
[0109] For example, if the preset frequency can be 15, then based on the usage frequencies of shaders 1-5 in the example above, which are 20, 25, 12, 3 and 10 respectively, it can be determined that shader 1 and shader 2 are shaders to be configured.
[0110] A3: Allocate a second storage space for the shader to be configured to store the corresponding set of rendering parameters.
[0111] For a shader to be configured, a second storage space can be configured to store the set of rendering parameters corresponding to the shader to be configured, that is, to store the attribute information of its corresponding rendering parameters.
[0112] In some embodiments, the terminal device may determine free storage space to allocate to the shader to be configured, specifically by using the memory allocation function described above.
[0113] A4: Write the set of rendering parameters corresponding to the shader to be configured into the second storage space, and record the identification information of the shader to be configured and the correspondence between the second storage space.
[0114] After allocating a second storage space for the shader to be configured, its corresponding set of rendering parameters can be written into the second storage space. At the same time, the correspondence between the identification information of the shader to be configured and the second storage space can be recorded, thereby obtaining the correspondence between the shader's identification information and the storage space of the set of rendering parameters.
[0115] In some embodiments, a configuration file can be added to the shader to be configured. This configuration file may include the identifier information of the shader to be configured, the attribute information of the rendering parameters corresponding to the shader to be configured, and the limit on the number of rendering parameter groups. For example, for the shader to be configured, it may be set that the number of rendering parameter groups included in a rendering parameter set cannot exceed 2000.
[0116] After the terminal device determines the shader to be configured, it can obtain the attribute information of the rendering parameters from its configuration file, and generate multiple rendering parameter groups less than or equal to the limited number of rendering parameter groups based on the limited number of rendering parameter groups. Each rendering parameter group includes the attribute information of the rendering parameters. Then, the rendering parameter set composed of these multiple rendering parameter groups is written into the second storage space, and the identification information of the shader to be configured is obtained from the configuration file. The correspondence between the identification information of the shader to be configured and the second storage space is recorded.
[0117] It's important to note that the contents of this configuration file can be adjusted at any time based on needs. For example, the number of rendering parameter groups included in the rendering parameter set can be adjusted, or the usage frequency of shaders can be changed. Shaders with higher usage frequency can be set as configurable shaders, while shaders with lower usage frequency can be set as shaders whose rendering parameters need to be created on the fly. In this way, the rendering method can be flexibly adjusted based on the configuration file without modifying the code, which simplifies the operation while improving scalability.
[0118] Based on the above description, on the one hand, for shaders used frequently, storage space can be pre-allocated to store the corresponding set of rendering parameters, avoiding the waste of resources caused by frequent memory access; on the other hand, for shaders used infrequently, there is no need to pre-store the corresponding set of rendering parameters, avoiding excessive memory usage on the terminal device and thus avoiding the problem of running lag.
[0119] In one possible implementation of this application, the material processing method for the virtual object may further include step 3: If, in the correspondence between the shader's identification information and the storage space of the rendering parameter set, a target storage space is determined that does not include the identification information of the target shader, it indicates that the target shader is a low-frequency shader as described above and its corresponding target rendering parameter set has not been pre-stored. In this case, attribute information of the corresponding target rendering parameters can be created for the target shader, and a first storage space is allocated for storing the created attribute information of the target rendering parameters. Correspondingly, the material processing method for the virtual object may further include step 2: In the event that the material of the virtual object is destroyed, the attribute information of the target rendering parameters is destroyed, and the first storage space allocated for the attribute information of the target rendering parameters is reclaimed.
[0120] It should be noted that in this implementation, after executing S201, there is no need to execute S202. Step 3 can be executed, followed by S204. However, there is no need to execute S205. Instead, step 2 can be executed.
[0121] It should be further explained that the implementation methods for allocating and reclaiming the first storage space can be found in the relevant content above, and will not be repeated here.
[0122] In this way, even without pre-configuring the set of rendering parameters for the target shader, the target rendering parameter attribute information required by the target shader can be created on the spot for the target shader to use, ensuring the accurate display of virtual objects and helping to maintain the user experience.
[0123] As an example, see Figure 5 This figure is a schematic diagram of a method for generating materials for virtual objects in related technologies. For example... Figure 5 As shown in the figure, the material described above can include the shader name and rendering parameters. The rendering parameters can include parameter name, parameter type and parameter value. Only the parameter type is shown in the figure. The parameter type of the rendering parameters can include Float, Int, Texture, etc.
[0124] As an example, see Figure 6 This figure is a schematic diagram of a material processing method for a virtual object provided in an embodiment of this application. Figure 6 As shown, a parameter pool can be pre-configured, which can include a set of rendering parameters corresponding to one or more shaders. Figure 6 The parameter pool shown includes the set of rendering parameters corresponding to shader 1 through shader 3, which is only an example.
[0125] Taking shader 1 as the target shader as an example, it has rendering parameters 1 and 2. During the rendering phase of the virtual object, the name of shader 1 (i.e., an example of the target shader's identification information) can be obtained. Then, based on the correspondence between the shader's identification information and the storage space of the rendering parameter set, the corresponding target storage space is determined, and the attribute information of rendering parameters 1 and 2 is read from it. Subsequently, using the attribute information of shader 1, rendering parameters 1, and rendering parameters 2, the virtual object is rendered to generate its material. Finally, when the virtual object's material is destroyed, the attribute information of rendering parameters 1 and 2 is written back into the target storage space.
[0126] In the game scenario, respectively adopt Figure 5 and Figure 6 The rendering of virtual objects is described separately, using the material processing method for virtual objects provided in the embodiments of this application (i.e. Figure 6 (As shown in the image), this method can reduce memory access operations by 90% due to the creation and destruction of rendering parameter attribute information, significantly saving resources and improving game performance. Furthermore, the storage space occupied by the pre-configured set of rendering parameters for shaders is minimal; for example, it may require an additional 10MB of memory, which is negligible for terminal devices.
[0127] Based on the virtual object material processing method provided in the preceding embodiments, this application also provides a virtual object material processing apparatus. The virtual object material processing apparatus provided in the embodiments of this application will be described in detail below.
[0128] See Figure 7 The figure is a schematic diagram of the structure of a material processing device for virtual objects provided in an embodiment of this application.
[0129] like Figure 7 As shown, the material processing device 700 for the virtual object may specifically include:
[0130] The identification information acquisition module 710 is used to acquire the identification information of the target shader used to render the virtual object; the virtual object includes objects in the game scene.
[0131] The storage space determination module 720 is used to determine the target storage space of the target rendering parameter set corresponding to the identification information of the target shader based on the correspondence between the identification information of the shader and the storage space of the rendering parameter set; the rendering parameter set is used to store the attribute information of the rendering parameters.
[0132] The attribute information reading module 730 is used to read the attribute information of the target rendering parameters from the target rendering parameter set stored in the target storage space;
[0133] The material generation module 740 is used to render the virtual object and generate the material of the virtual object based on the attribute information of the target shader and the target rendering parameters, so as to display the virtual object with material in the game scene.
[0134] The attribute information writing module 750 is used to write the attribute information of the target rendering parameters back into the target rendering parameter set stored in the target storage space when the material of the virtual object is destroyed.
[0135] As one implementation, the target rendering parameter set includes multiple identical rendering parameter groups, each rendering parameter group including attribute information of at least one target rendering parameter; the attribute information reading module 730 can be specifically used for:
[0136] The attribute information of the target rendering parameters included in the target rendering parameter group is read from the target rendering parameter set stored in the target storage space; the multiple identical rendering parameter groups include the target rendering parameter group.
[0137] As one implementation method, the attribute information reading module 730 can be specifically used for:
[0138] If it is determined from the target rendering parameter set stored in the target storage space that the target rendering parameter group does not have tag information, then the attribute information of the target rendering parameters included in the target rendering parameter group is read out; the tag information is used to indicate that the attribute information of the rendering parameters included in the rendering parameter group is in use;
[0139] Accordingly, the material processing device 700 for the virtual object may further include:
[0140] The marker information adding module is used to add the marker information to the target rendering parameter group.
[0141] As one implementation, the material processing device 700 for the virtual object may further include:
[0142] The first parameter creation and space allocation module is used to, from the target rendering parameter set stored in the target storage space, if it is determined that all rendering parameter groups have the marking information, create the corresponding target rendering parameter attribute information for the target shader, allocate the first storage space for the created target rendering parameter attribute information, and not perform the step of writing the target rendering parameter attribute information back into the target rendering parameter set stored in the target storage space when the material of the virtual object is destroyed;
[0143] Accordingly, the material processing device 700 for the virtual object may further include:
[0144] The first parameter destruction and space reclamation module is used to destroy the attribute information of the target rendering parameters and reclaim the first storage space when the material of the virtual object is destroyed.
[0145] As one implementation, the material processing device 700 for the virtual object may further include:
[0146] The frequency acquisition module is used to obtain the usage frequency of multiple shaders respectively.
[0147] A shader filtering module is used to filter out shaders to be configured from the plurality of shaders whose usage frequency is greater than or equal to a preset frequency; the shaders to be configured include the target shader;
[0148] The space configuration module is used to allocate a second storage space for the shader to be configured to store the corresponding set of rendering parameters;
[0149] The parameter set writing and relationship recording module is used to write the rendering parameter set corresponding to the shader to be configured into the second storage space, and record the identification information of the shader to be configured and the correspondence between the second storage space.
[0150] As one implementation, the material processing device 700 for the virtual object may further include:
[0151] The second parameter creation and space allocation module is used to determine, in the correspondence between the shader identification information and the storage space of the rendering parameter set, if a target storage space corresponding to the identification information of the target shader is not included, then create the attribute information of the target rendering parameters corresponding to the target shader, allocate the first storage space for the created attribute information of the target rendering parameters, and not perform the step of reading the attribute information of the target rendering parameters from the target rendering parameter set stored in the target storage space, and not perform the step of writing the attribute information of the target rendering parameters back into the target rendering parameter set stored in the target storage space when the material of the virtual object is destroyed;
[0152] Accordingly, the material processing device 700 for the virtual object may further include:
[0153] The second parameter destruction and space reclamation module is used to destroy the attribute information of the target rendering parameters and reclaim the first storage space when the material of the virtual object is destroyed.
[0154] In one implementation, the virtual object includes a game character; when the virtual object is the game character, the target shader is at least one of a skin shader, a hair shader, or a clothing shader.
[0155] The virtual object material processing device provided in this application embodiment has the same beneficial effects as the virtual object material processing method provided in the above embodiment, so it will not be described again.
[0156] This application provides a material processing device for virtual objects, which can be a server. Figure 8This is a schematic diagram of a server structure provided in an embodiment of this application. The server 900 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 922 (e.g., one or more processors) and memory 932, and one or more storage media 930 (e.g., one or more mass storage devices) for storing application programs 942 or data 944. The memory 932 and storage media 930 can be temporary or persistent storage. The program stored in the storage media 930 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the server. Furthermore, the CPU 922 may be configured to communicate with the storage media 930 and execute the series of instruction operations in the storage media 930 on the server 900.
[0157] Server 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input / output interfaces 958, and / or one or more operating systems 941, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0158] CPU 922 is used to perform the following steps:
[0159] Obtain the identification information of the target shader used to render the virtual object; the virtual object includes objects in the game scene.
[0160] Based on the correspondence between the shader's identification information and the storage space of the rendering parameter set, the target storage space of the target rendering parameter set corresponding to the target shader's identification information is determined; the rendering parameter set is used to store the attribute information of the rendering parameters.
[0161] The attribute information of the target rendering parameters is read from the target rendering parameter set stored in the target storage space;
[0162] Based on the attribute information of the target shader and the target rendering parameters, the virtual object is rendered to generate the material of the virtual object, so as to display the virtual object with material in the game scene;
[0163] If the material of the virtual object is destroyed, the attribute information of the target rendering parameters is written back into the target rendering parameter set stored in the target storage space.
[0164] This application also provides another material processing device for virtual objects, which can be a terminal device. For example... Figure 9 As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. Taking a mobile phone as an example:
[0165] Figure 9 The diagram shown is a block diagram of a portion of the structure of a mobile phone provided in an embodiment of this application. (Reference) Figure 9 The mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090, etc. Those skilled in the art will understand that... Figure 9 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0166] The following is combined with Figure 9 A detailed introduction to each component of a mobile phone:
[0167] The RF circuit 1010 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 1080; additionally, it transmits uplink data to the base station. Typically, the RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the RF circuit 1010 can also communicate wirelessly with networks and other devices. The aforementioned wireless communications may use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).
[0168] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0169] The input unit 1030 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1031), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1031 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 1080, and can also receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1031, the input unit 1030 may also include other input devices 1032. Specifically, other input devices 1032 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0170] The display unit 1040 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1040 may include a display panel 1041, which may optionally be configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel 1041. Further, a touch panel 1031 may cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it transmits the information to the processor 1080 to determine the type of touch event. Subsequently, the processor 1080 provides corresponding visual output on the display panel 1041 according to the type of touch event. Although in Figure 9 In this embodiment, the touch panel 1031 and the display panel 1041 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.
[0171] The mobile phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1041 according to the ambient light level, and the proximity sensor can turn off the display panel 1041 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0172] The audio circuit 1060, speaker 1061, and microphone 1062 provide an audio interface between the user and the mobile phone. The audio circuit 1060 converts the received audio data into electrical signals and transmits them to the speaker 1061, where the speaker 1061 converts them into sound signals for output. On the other hand, the microphone 1062 converts the collected sound signals into electrical signals, which are then received by the audio circuit 1060, converted into audio data, and then processed by the processor 1080 before being transmitted via the RF circuit 1010 to, for example, another mobile phone, or the audio data can be output to the memory 1020 for further processing.
[0173] WiFi is a short-range wireless transmission technology. Through the WiFi module 1070, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 9 The WiFi module 1070 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.
[0174] The processor 1080 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 1020 and calls data stored in the memory 1020 to perform various functions and process data, thereby collecting overall data and information from the phone. Optionally, the processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1080.
[0175] The mobile phone also includes a power supply 1090 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1080 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0176] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0177] In this embodiment of the application, the processor 1080 included in the mobile phone also has the following functions:
[0178] Obtain the identification information of the target shader used to render the virtual object; the virtual object includes objects in the game scene.
[0179] Based on the correspondence between the shader's identification information and the storage space of the rendering parameter set, the target storage space of the target rendering parameter set corresponding to the target shader's identification information is determined; the rendering parameter set is used to store the attribute information of the rendering parameters.
[0180] The attribute information of the target rendering parameters is read from the target rendering parameter set stored in the target storage space;
[0181] Based on the attribute information of the target shader and the target rendering parameters, the virtual object is rendered to generate the material of the virtual object, so as to display the virtual object with material in the game scene;
[0182] If the material of the virtual object is destroyed, the attribute information of the target rendering parameters is written back into the target rendering parameter set stored in the target storage space.
[0183] This application also provides a computer-readable storage medium for storing a computer program that, when run on a material processing device for a virtual object, causes the material processing device to execute any one of the implementation methods of a material processing method for a virtual object described in the foregoing embodiments.
[0184] This application also provides a computer program product including a computer program, which, when run on a virtual object material processing device, causes the virtual object material processing device to execute any one of the implementation methods of a virtual object material processing method described in the foregoing embodiments.
[0185] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system and equipment described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0186] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of the system is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple systems may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0187] The system described as separate components may or may not be physically separate. 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, depending on actual needs.
[0188] Furthermore, the functional units in the various embodiments of this application 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. The integrated unit can be implemented in hardware or as a software functional unit.
[0189] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part 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 a computer 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 application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing computer programs.
[0190] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0191] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications 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 application.
Claims
1. A method for processing the material of a virtual object, characterized in that, The method includes: Obtain the identification information of the target shader used to render the virtual object; the virtual object includes objects in the game scene. Based on the correspondence between the shader's identification information and the storage space of the rendering parameter set, the target storage space of the target rendering parameter set corresponding to the target shader's identification information is determined; the rendering parameter set is used to store the attribute information of the rendering parameters. The attribute information of the target rendering parameters is read from the target rendering parameter set stored in the target storage space; Based on the attribute information of the target shader and the target rendering parameters, the virtual object is rendered to generate the material of the virtual object, so as to display the virtual object with material in the game scene; If the material of the virtual object is destroyed, the attribute information of the target rendering parameters is written back into the target rendering parameter set stored in the target storage space.
2. The method according to claim 1, characterized in that, The target rendering parameter set includes multiple identical rendering parameter groups, and each rendering parameter group includes attribute information of at least one target rendering parameter; The step of reading the attribute information of the target rendering parameters from the target rendering parameter set stored in the target storage space includes: From the target rendering parameter set stored in the target storage space, read the attribute information of the target rendering parameters included in the target rendering parameter group; The plurality of identical rendering parameter groups include the target rendering parameter group.
3. The method according to claim 2, characterized in that, The step of reading the attribute information of the target rendering parameters included in the target rendering parameter group from the target rendering parameter set stored in the target storage space includes: If it is determined from the target rendering parameter set stored in the target storage space that the target rendering parameter group does not have tag information, then the attribute information of the target rendering parameters included in the target rendering parameter group is read out; the tag information is used to indicate that the attribute information of the rendering parameters included in the rendering parameter group is in use; The method further includes: Add the tagging information to the target rendering parameter group.
4. The method according to claim 3, characterized in that, The method further includes: If it is determined from the target rendering parameter set stored in the target storage space that all rendering parameter groups have the tag information, then the corresponding target rendering parameter attribute information is created for the target shader, and a first storage space is allocated for the created target rendering parameter attribute information. The step of writing the target rendering parameter attribute information back into the target rendering parameter set stored in the target storage space is not performed when the material of the virtual object is destroyed. The method further includes: If the material of the virtual object is destroyed, the attribute information of the target rendering parameters is destroyed, and the first storage space is reclaimed.
5. The method according to claim 1, characterized in that, Also includes: Obtain the usage frequency of each of the multiple shaders; From the plurality of shaders, select the shaders to be configured that have a usage frequency greater than or equal to a preset frequency; The shader to be configured includes the target shader; Allocate a second storage space for the shader to be configured to store the corresponding set of rendering parameters; Write the set of rendering parameters corresponding to the shader to be configured into the second storage space, and record the identification information of the shader to be configured and the correspondence between the second storage space.
6. The method according to claim 5, characterized in that, The method further includes: In the correspondence between the shader's identification information and the storage space of the rendering parameter set, if it is determined that the target storage space does not include the identification information of the target shader, then the attribute information of the target rendering parameter corresponding to the target shader is created, and the first storage space is allocated for the created attribute information of the target rendering parameter. The step of reading the attribute information of the target rendering parameter from the target rendering parameter set stored in the target storage space is not executed, and the step of writing the attribute information of the target rendering parameter back into the target rendering parameter set stored in the target storage space is not executed when the material of the virtual object is destroyed. The method further includes: If the material of the virtual object is destroyed, the attribute information of the target rendering parameters is destroyed, and the first storage space is reclaimed.
7. The method according to any one of claims 1-6, characterized in that, The virtual object includes a game character; when the virtual object is the game character, the target shader is at least one of a skin shader, a hair shader, or a clothing shader.
8. A material processing device for virtual objects, characterized in that, include: The identification information acquisition module is used to acquire the identification information of the target shader used to render virtual objects; the virtual objects include objects in the game scene. The storage space determination module is used to determine the target storage space of the target rendering parameter set corresponding to the identification information of the target shader based on the correspondence between the identification information of the shader and the storage space of the rendering parameter set. The rendering parameter set is used to store the attribute information of the rendering parameters; The attribute information reading module is used to read the attribute information of the target rendering parameters from the target rendering parameter set stored in the target storage space; The material generation module is used to render the virtual object and generate the material of the virtual object based on the attribute information of the target shader and the target rendering parameters, so as to display the virtual object with material in the game scene; The attribute information writing module is used to write the attribute information of the target rendering parameters back into the target rendering parameter set stored in the target storage space when the material of the virtual object is destroyed.
9. A material processing device for virtual objects, characterized in that, The device includes a processor and a memory: The memory is used to store computer programs and to transfer the computer programs to the processor; The processor is configured to execute the steps of the material processing method for the virtual object according to any one of claims 1 to 7, based on instructions in the computer program.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when executed by a material processing device for a virtual object, implements the steps of the material processing method for a virtual object as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, The method includes a computer program that, when executed by a material processing device for a virtual object, implements the steps of the material processing method for a virtual object as described in any one of claims 1 to 7.