A method, device, storage medium and computing device for creating a rendering pipeline
By configuring static switches and context switches, determining material templates and render batch types, calculating the values of context switches, finding pipeline descriptions from pipeline variants, and creating render pipelines, solving the problems of complex and inefficient render pipeline configuration in the existing technology, and achieving efficient render pipeline management and adaptation to the new generation of graphics APIs.
Patent Information
- Application Number
- CN202111425330.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-22
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2040-12-22
AI Technical Summary
In the prior art, by directly configuring rendering pipeline data and interacting with rendering API, it is not friendly to users, resulting in excessive pipeline generation, reducing game operation efficiency, and not in line with the design of mobile GPUs, and failing to fully utilize its efficiency.
By receiving configuration operations of static switches and context switches, determine the material template and render batch types, calculate the value of the context switch, find the pipeline description from the pipeline variant, create the render pipeline based on the pipeline description, avoid directly operating the render pipeline data, and simplify the configuration process.
It effectively reduces the number of unnecessary pipeline descriptions, improves rendering efficiency, and adapts to the design of the new generation of graphics APIs, and can directly switch the rendering pipeline during the game running stage without changing the rendering state or shader.
Smart Images

Figure CN114064039B_ABST
Abstract
Description
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on December 22, 2020, with application number 202011531506.7 and application name “A method, device, storage medium and computing device for creating a rendering pipeline”, the entire contents of which are incorporated by reference into the application. Technical Field
[0002] The present invention relates to the field of game rendering technology, and in particular to a method, device, storage medium and computing equipment for creating a rendering pipeline. Background Art
[0003] In the existing technology, the method of directly configuring the rendering pipeline data and interacting with the rendering API (Application Programming Interface) is not user-friendly. The material system of the commercial engine encapsulates more details and easily generates too many pipelines, thereby reducing the efficiency of the game. Dynamically switching the rendering state during the game running stage does not conform to the design of the current mobile GPU (Graphics Processing Unit) and cannot give full play to its efficiency. In addition, the existing technology requires that objects rendered in multiple batches will be drawn in the order of the rendering objects, and the pipeline needs to be switched repeatedly during the drawing process, resulting in low rendering efficiency. Summary of the Invention
[0004] In view of the above problems, the present invention is proposed to provide a method, apparatus, storage medium and computing device for creating a rendering pipeline that overcomes the above problems or at least partially solves the above problems. It can avoid the complicated configuration process of rendering pipeline data and can easily adjust the configuration content according to actual rendering requirements, so that the same source material can generate corresponding pipeline descriptions under different switch branches, effectively reducing the number of unnecessary pipeline descriptions.
[0005] According to one aspect of an embodiment of the present invention, a method for creating a rendering pipeline is provided, comprising:
[0006] Receive configuration operations for a static switch and a context switch of a source material of an object to be rendered, wherein the static switch is used to configure source material parameters and the context switch controls a search rule for a pipeline description;
[0007] Determine a material template according to the source material and the static switch, and search the material template for a pipeline variant corresponding to a rendering batch type of the object to be rendered;
[0008] The context switch value is calculated using the context data of the object to be rendered, a pipeline description is searched from the pipeline variant according to the context switch value, and a rendering pipeline is created based on the pipeline description.
[0009] Optionally, after searching the pipeline description from the pipeline variant according to the value of the context switch, the method further includes: using a collector to collect rendering instances of the object to be rendered according to the pipeline description;
[0010] After creating a rendering pipeline based on the pipeline description, the method further includes: merging renderings of rendering instances having the same pipeline description through the created rendering pipeline.
[0011] Optionally, merge rendering of render instances with the same pipeline description through the created render pipeline, including:
[0012] Get the pre-configured pipeline description sequence;
[0013] The rendering instances of the object to be rendered are rendered according to the pipeline description order through the created rendering pipeline, and the rendering instances with the same pipeline description belonging to the same sequence level are merged for rendering.
[0014] Optionally, the source material parameters configured by the static switch include at least one of source material model parameters, source material rendering mode of the object to be rendered, and source material usage mode.
[0015] Optionally, searching the material template for a pipeline variant corresponding to a rendering batch type of the object to be rendered includes:
[0016] Determine a rendering mode to be used for the object to be rendered, and obtain a rendering batch type corresponding to the rendering mode through a collector;
[0017] The pipeline variant corresponding to the obtained rendering batch type is searched from the material template.
[0018] Optionally, before searching the material template for the pipeline variant corresponding to the rendering batch type of the object to be rendered, the method further includes:
[0019] Defining a collector corresponding to a rendering camera in a scene to which the object to be rendered belongs, wherein one collector corresponds to one rendering camera;
[0020] Initialization parameters are passed into the collector, and the collector is initialized using the initialization parameters.
[0021] Optionally, initialization parameters are passed to the collector, including:
[0022] Setting the rendering mode of the object to be rendered;
[0023] Configuring a corresponding rendering batch type for each rendering mode, and passing the correspondence between the rendering mode and the rendering batch type as an initialization parameter to the collector;
[0024] Set the pipeline description order and pass the sequence number of the pipeline description as an initialization parameter to the collector.
[0025] Optionally, the rendering mode includes at least one of a normal rendering mode, a rendering mode with outlines, and an instanced rendering mode.
[0026] Optionally, after searching the pipeline description from the pipeline variant according to the value of the context switch, the method further includes:
[0027] Classify and store the material template used by the object to be rendered, the pipeline variant corresponding to the rendering batch type of the object to be rendered, and the pipeline description found from the pipeline variant according to the value of the context switch respectively;
[0028] Among them, all material templates used by the object to be rendered belong to the same category, the pipeline variants corresponding to the rendering batch type of the object to be rendered belong to the same category, and the pipeline descriptions found from the pipeline variants belong to the same category.
[0029] According to another aspect of an embodiment of the present invention, a device for creating a rendering pipeline is provided, including:
[0030] a configuration module adapted to receive configuration operations for a static switch and a context switch of a source material of an object to be rendered, wherein the static switch is used to configure source material parameters and the context switch controls a search rule for a pipeline description;
[0031] a search module, adapted to determine a material template according to the source material and the static switch, and search the material template for a pipeline variant corresponding to a rendering batch type of the object to be rendered;
[0032] The creation module is adapted to calculate the value of the context switch using the context data of the object to be rendered, search for a pipeline description from the pipeline variant according to the value of the context switch, and create a rendering pipeline based on the pipeline description.
[0033] According to another aspect of an embodiment of the present invention, a computer storage medium is provided, wherein the computer storage medium stores computer program code. When the computer program code is executed on a computing device, the computing device executes the method for creating a rendering pipeline of any of the above embodiments.
[0034] According to another aspect of an embodiment of the present invention, a computing device is provided, comprising: a processor; a memory storing computer program code; when the computer program code is executed by the processor, the computing device executes the method for creating a rendering pipeline of any of the above embodiments.
[0035] The embodiment of the present invention configures static switches and context switches for the source materials of the rendering objects, so that relevant technical personnel do not need to directly operate the rendering pipeline data, thus avoiding the complicated configuration process of the rendering pipeline data. Moreover, through the configuration operation of the static switches and context switches, the configuration content can be conveniently adjusted according to the actual rendering requirements, so that the same source material can generate corresponding pipeline descriptions under different switch branches, effectively reducing the number of unnecessary pipeline descriptions. In addition, the present invention implements the generation of corresponding pipeline descriptions based on the static switches and context switches of the configured source materials, and creates a rendering pipeline based on the pipeline description, so that the rendering pipeline can be directly switched during the game running stage without having to change the rendering state or shader separately, which can effectively adapt to the design of the new generation of graphics API.
[0036] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below.
[0037] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0039] Figure 1 A schematic diagram showing a process of creating a rendering pipeline according to an embodiment of the present invention is shown;
[0040] Figure 2 A schematic diagram showing a flow chart of a method for creating a rendering pipeline according to another embodiment of the present invention is shown;
[0041] Figure 3 A schematic structural diagram of a device for creating a rendering pipeline according to an embodiment of the present invention is shown;
[0042] Figure 4 A schematic structural diagram of a device for creating a rendering pipeline according to another embodiment of the present invention is shown;
[0043] Figure 5 A schematic structural diagram of a device for creating a rendering pipeline according to yet another embodiment of the present invention is shown;
[0044] Figure 6 A schematic structural diagram of a device for creating a rendering pipeline according to another embodiment of the present invention is shown. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of this application. It should be noted that, in the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.
[0046] It should be noted that the terms "first", "second" etc. in the specification of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable in appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprise" and "have" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, product or equipment comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or that are inherent to these processes, methods, products or equipment.
[0047] To solve the above technical problems, an embodiment of the present invention provides a method for creating a rendering pipeline. Figure 1 FIG2 shows a flow chart of a method for creating a rendering pipeline according to an embodiment of the present invention. Figure 1 , the method includes steps S102 to S106.
[0048] Step S102 : receiving configuration operations of a static switch and a context switch of a source material of an object to be rendered, wherein the static switch is used to configure source material parameters, and the context switch controls a search rule for a pipeline description.
[0049] The switches in the embodiment of the present invention are divided into two levels, namely static switches and context switches. Static means that these switches can be statically determined in the configuration stage, and there is no switching during the game operation. For example, static switches may include Skeleton switches, Instance switches, and so on. The context switch can be dynamically switched according to the context during the game operation. The value related to the context switch cannot be determined in the configuration stage, and the value of the context switch needs to be calculated based on the context data of the object to be rendered. The embodiment of the present invention can configure appropriate static switches and context switches according to actual needs.
[0050] Step S104 : determining a material template based on the source material and the static switch, and searching the material template for a pipeline variant corresponding to the rendering batch type of the object to be rendered.
[0051] Step S106 , using the context data of the object to be rendered to calculate the value of the context switch, searching for a pipeline description from the pipeline variant according to the value of the context switch, and creating a rendering pipeline based on the pipeline description.
[0052] The embodiment of the present invention configures static switches and context switches for the source materials of the rendering objects, so that relevant technical personnel do not need to directly operate the rendering pipeline data, thus avoiding the complicated configuration process of the rendering pipeline data. Through the configuration operation of the static switch and the context switch, the configuration content can be conveniently adjusted according to the actual rendering requirements, so that the same source material can generate corresponding pipeline descriptions under different switch branches, effectively reducing the number of unnecessary pipeline descriptions. In addition, the present invention implements the generation of corresponding pipeline descriptions based on the static switch and context switch of the configured source material, and creates a rendering pipeline based on the pipeline description, so that the rendering pipeline can be directly switched during the game running stage without having to change the rendering state or shader separately, which can effectively adapt to the design of the new generation of graphics API.
[0053] Traditional graphics APIs typically support changing rendering states or switching shaders individually, which can change a small portion of the rendering pipeline. However, new-generation graphics APIs can handle pipeline switching when changing the rendering pipeline, switching the entire pipeline when the rendering pipeline changes. Changing a small portion of the rendering pipeline is done in the same way as changing the entire pipeline. These new-generation graphics APIs may include the cross-platform 2D and 3D graphics application programming interface Vulkan, the graphics programming interface Metal, and the graphics interface DX12 (i.e., DirectX 12). The embodiments of the present invention do not specifically limit the types of new-generation graphics APIs.
[0054] Typically, rendering a single render batch only requires a pipeline description, but directly manipulating the render pipeline is complex for technical personnel. Because the source material system of the object being rendered encapsulates the rendering effects, and each rendering effect is encapsulated as a material, embodiments of the present invention generate a pipeline description based on the relevant parameters of the render object. This pipeline description contains the rendering state and shader static configuration data required for a single render batch. The generated pipeline description is then passed to the renderer, which uses the pipeline description to create the rendering pipeline.
[0055] The pipeline description generation process described in the preceding example involves several layers: source materials, material templates, pipeline variants, and pipeline descriptions. Specifically, the process from configuring the source material's static switch and context switch to ultimately generating the pipeline description can be divided into these layers: source materials, material templates, pipeline variants, and pipeline descriptions. The following describes each layer separately.
[0056] The source material is the material that is ultimately provided to the technician for use, and represents a certain rendering effect. The static switches configured for the source material in the embodiment of the present invention include multiple "name-value" combinations. Each game project has a set of optional configurations of static switches (such as a static switch set), and the required static switches can be selected for each source material. Therefore, when executing step S102 to receive the configuration operation of the static switch of the source material of the object to be rendered, the static switch selected by the technician for the source material from the corresponding static switch set can be received. When selecting the static switch, it can be selected based on the functions that the source material needs to support. The richer the functions supported by the source material, the more static switches are selected.
[0057] The following describes the "name-value" combination of a static switch using different embodiments.
[0058] For example, a Skeleton switch can contain two name-value pairs: "Skeleton-0" and "Skeleton-1." Here, Skeleton is the static switch name, and 0 or 1 represents the value of the static switch, with 0 representing a static model and 1 representing a skeletal animation model. Therefore, by configuring the Skeleton switch, you can configure the model type corresponding to the skeleton.
[0059] For example, an instance switch can contain two name-value combinations: "Instance-0" and "Instance-1." Instance is the static switch name, and 0 or 1 represents the value of the static switch, with 0 indicating normal rendering and 1 indicating GPU instance rendering. Therefore, by configuring the instance switch, you can configure the rendering method for the object being rendered.
[0060] For another example, the Normal switch can contain three sets of "name-value" combinations, namely "Normal-Normal", "Normal-TBN" and "Normal-NULL". In the switch value, Normal means that the vertex stream contains normals, TBN means the vertex stream tangents and normals, and NULL means normals and tangents.
[0061] The above examples are merely illustrative, and the embodiments of the present invention do not specifically limit the content of the static switch. In conjunction with the above examples, the source material parameters configured by the static switch may include source material usage mode, source material model parameters, and source material rendering mode for the object to be rendered.
[0062] For material templates, a material template contains multiple batch types. Batch types are logically classified enumeration types. Each material template needs to define pipeline variants for supported batches. Material templates can be determined by the source material and static switches during the editing phase. The batches included in the objects to be rendered using the material template are determined by the collector configuration parameters and the configuration of the objects to be rendered. Unused pipeline variants and pipeline descriptions are not included in the material template during the export phase.
[0063] For pipeline variants, an embodiment of the present invention queries the pipeline variant corresponding to the rendering batch type from the material template. A rendering batch corresponds to a set of all possible pipeline descriptions, and the final pipeline description can be determined from the pipeline description set through the context switch. The context switch contains a "name-value" combination, but the value of the context switch is not directly specified by the technician, but is calculated according to the rules defined by the code. The embodiment of the present invention uses the context data of the object to be rendered to calculate the value of the context switch. Each game project has a set of optional configurations of context switches (such as a context switch set). All pipeline variants in each game project can select multiple context switches as needed from the same context switch set. The pipeline descriptions corresponding to the possible values of all configured context switches will be generated during the export stage.
[0064] Context switches are code-defined rules that control how pipeline descriptions are searched. The input parameter is context data, and the rule's code reads the required parameters to obtain the pipeline description. The context is a fixed input structure, and render objects can set context data. The values of each context switch are calculated based on the context data provided by the render object. The context switch values are used to search the pipeline description.
[0065] The following describes the name-value combination of a context switch using different embodiments. Each context switch has a set of rules.
[0066] For example, the context variable related to the context switch ReceiveShadow (whether the object receives shadows) is intshadow, and the corresponding rule is that shadow is set to 0 for no shadow, shadow is set to 1 for low-effect shadow, and shadow is set to 2 for high-effect shadow.
[0067] For example, the context variable associated with the context switch ColorBlendByAlpha (pipeline color blending) is floatalpha. The corresponding rule is: if alpha>0.95, select the opaque pipeline; if alpha<0.95, select the semi-transparent pipeline, whose pixel shader has an alpha parameter.
[0068] For the pipeline description, the embodiment of the present invention searches for the pipeline description from the pipeline variant according to the calculated value of the context switch. The pipeline description is used to be transmitted to the renderer, and the rendering pipeline is created by the renderer.
[0069] Referring to step S104 above, in one embodiment of the present invention, when searching for a pipeline variant corresponding to a render batch type of an object to be rendered from a material template, the rendering method used by the object to be rendered can be first determined, and the render batch type corresponding to the rendering method can be obtained through a collector. The pipeline variant corresponding to the obtained render batch type can then be searched from the material template.
[0070] In an embodiment of the present invention, the object to be rendered includes the value of the rendering mode EntityRenderType. The material template of the object to be rendered can be determined in the editing stage. Each frame can be submitted to multiple collectors for rendering in the running stage. Specifically, the result of camera cropping can determine which collector each frame is submitted to.
[0071] During the definition process, the collector of this embodiment pre-establishes a mapping between the rendering method EntityRenderType and the rendering batch type. Therefore, after determining the rendering method used by the object to be rendered, the collector can obtain the rendering batch type corresponding to the rendering method. For details on the process of defining the collector, please refer to the embodiments below. The rendering method of the object to be rendered can include a normal rendering method, a rendering method with outlines, an instantiation rendering method, etc. The embodiment of the present invention does not specifically limit the rendering method of the object to be rendered.
[0072] In one embodiment of the present invention, a collector may be used to collect rendering instances of the object to be rendered, and rendering instances with the same pipeline description may be merged for rendering to improve the rendering efficiency of the object to be rendered. Figure 2 , an embodiment of the present invention further provides another method for creating a rendering pipeline, including steps S202 to S210.
[0073] Step S202 : receiving configuration operations of a static switch and a context switch for a source material of an object to be rendered, wherein the static switch is used to configure source material parameters, and the context switch controls a search rule for a pipeline description.
[0074] Step S204 : determining a material template based on the source material and the static switch, and searching the material template for a pipeline variant corresponding to the rendering batch type of the object to be rendered.
[0075] Step S206 : Calculate the value of the context switch using the context data of the object to be rendered, and search the pipeline variant for the pipeline description based on the value of the context switch.
[0076] For details about steps S202 to S206 above, please refer to the above embodiment.
[0077] Step S208: using a collector to collect rendering instances of the objects to be rendered according to the pipeline description.
[0078] Because some objects to be rendered require more than one render batch, each render batch corresponds to a pipeline description. Therefore, when executing step S208, multiple render instances of the objects to be rendered can be collected into containers corresponding to corresponding pipeline descriptions, where one pipeline description corresponds to one container. Finally, render instances with the same pipeline description can be rendered together, that is, the render instances in one container can be rendered together.
[0079] Step S210 : creating a rendering pipeline based on the pipeline description, and merging rendering instances with the same pipeline description through the created rendering pipeline.
[0080] In this embodiment, if the same context switch value is calculated based on the context data of different objects to be rendered, then the same pipeline description may be found from the pipeline variants based on the same context switch value, and the rendering instances of the objects to be rendered with the same pipeline description can be merged for rendering. For example, if the context switch values calculated based on the context data of objects to be rendered A and B are the same, and the pipeline descriptions found based on the same context switch value are also the same, then objects to be rendered A and B can be rendered together.
[0081] Therefore, the embodiment of the present invention optimizes the rendering efficiency of the current mobile graphics processor GPU. By collecting rendering instances according to the rendering pipeline and subsequently merging the rendering instances with the same rendering pipeline for rendering, it not only effectively improves the rendering efficiency of the object to be rendered, but also effectively reduces the number of times the rendering API switches pipelines, saving the overhead generated by switching pipelines.
[0082] In an embodiment of the present invention, a material template can be determined for an object to be rendered during the editing phase. During the runtime phase, each frame can be submitted to multiple collectors for rendering. When an object to be rendered is submitted to a collector, since the pipeline description contains the rendering state required for a rendering batch, when searching for the pipeline description, it can be determined whether the rendering state of the pipeline description has changed. If the rendering state has changed, the pipeline variant corresponding to the rendering batch type of the object to be rendered is searched from the material template, and the pipeline description is searched from the pipeline variant based on the value of the context switch. If the rendering state has not changed, the pipeline description of the previous frame can be directly used.
[0083] In an optional embodiment of the present invention, when executing step S210 and merging rendering instances with the same pipeline description through the created rendering pipeline, a pre-configured pipeline description order may be first obtained, and then the created rendering pipeline may render the rendering instances of the to-be-rendered object according to the pipeline description order. Furthermore, during the rendering of the rendering instances according to the pipeline description order, rendering instances with the same pipeline description belonging to the same sequence level may be merged for rendering.
[0084] In this embodiment, the collector sets the pipeline description order during the definition process, presetting multiple ordered [pipeline description, id] combinations, which are used to specify the logical rendering order. For details on the collector definition process, please refer to the following embodiments.
[0085] For example, if object A is rendered first, the corresponding pipeline description id is set to 1, and object B is rendered later, the corresponding pipeline description id is set to 2. In this case, even if the pipeline descriptions queried for objects A and B are the same, because the ids corresponding to the pipeline descriptions are different, the two objects will be collected into different containers corresponding to [pipeline description, id]. Objects corresponding to the same [pipeline description, id] will be rendered together. Here, the rendering instances of the objects corresponding to the same [pipeline description, id] belong to the rendering instances with the same pipeline description at the same sequence level.
[0086] In the multiple ordered sets of [pipeline description, id] provided by the embodiment of the present invention, no combination is repeated. The id is mainly used when the same pipeline description appears multiple times. In most cases, the default value of id is 0. In addition, each [pipeline description, id] corresponds to a container for collecting rendering instances.
[0087] The embodiment of the present invention renders the rendering instance according to a pre-configured rendering pipeline sequence, which has higher rendering efficiency than the prior art process of rendering in a sequence from far to near of the objects to be rendered.
[0088] In an embodiment of the present invention, before searching for the pipeline variant corresponding to the rendering batch type of the object to be rendered obtained from the material template, a collector can also be defined and initialized. The specific process is to first define a collector corresponding to the rendering camera in the scene to which the object to be rendered belongs, where one collector can correspond to one rendering camera. Then, initialization parameters are passed to the collector and the collector is initialized using the initialization parameters. In this embodiment, the initialization parameters passed to the collector include the correspondence between the rendering method and the rendering batch type, the sequence number of the pipeline description, etc.
[0089] When passing initialization parameters to the collector, you first set the rendering method (EntityRenderType) for the object to be rendered. Then, configure the corresponding rendering batch type for each rendering method. The mapping between rendering methods and rendering batch types is passed to the collector as an initialization parameter. Next, you set the pipeline description order and pass the sequence number of the pipeline description as an initialization parameter to the collector. This embodiment of the present invention does not specifically limit the order in which different initialization parameters are passed to the collector.
[0090] In this embodiment of the present invention, a single rendering method (EntityRenderType) can be configured with multiple rendering batch types, where each rendering batch corresponds to a pipeline variant. Rendering methods can include standard rendering, edge-based rendering, and instanced rendering. Furthermore, collectors can have different rendering modes, such as forward rendering and deferred rendering. The following describes the process of configuring multiple rendering batch types for different rendering methods (EntityRenderType).
[0091] For example, a forward rendering collector can support the default rendering mode and the rendering mode with outlines. In this case, it is necessary to configure the rendering batch types corresponding to these two rendering modes EntityRenderType, that is, to configure multiple rendering batch types corresponding to the default rendering mode in the forward rendering mode, and to configure multiple rendering batch types corresponding to the rendering mode with outlines in the forward rendering mode.
[0092] For another example, a deferred rendering collector can support the default rendering mode and the rendering mode with outlines. Then, multiple rendering batch types corresponding to the deferred rendering mode can be configured for the default rendering mode, and multiple rendering batch types corresponding to the deferred rendering mode can be configured for the rendering mode with outlines.
[0093] In an embodiment of the present invention, after executing step S106 to search for the pipeline description from the pipeline variant according to the value of the context switch, the material template used by the object to be rendered, the pipeline variant corresponding to the rendering batch type of the object to be rendered, and the pipeline description found from the pipeline variant according to the value of the context switch can also be classified and stored separately.
[0094] This embodiment can be divided into three parts for storage: all material templates used by the object to be rendered are grouped into the same category and stored. The pipeline variants corresponding to the rendering batch type of the object to be rendered are grouped into the same category and stored. The pipeline descriptions found from the pipeline variants are grouped into the same category and stored.
[0095] By adopting the embodiment of the present invention, the same material template can be configured with multiple rendering batch types during the configuration stage. For example, the pipeline variants corresponding to the rendering batches required for the delayed rendering mode and the forward rendering mode are all configured in the material template. During the resource storage stage, only the pipeline variants and pipeline descriptions corresponding to the rendering modes that need to be used are stored. Therefore, the game only needs to load these pipeline variants and pipeline descriptions, without loading all pipeline variants and pipeline descriptions, thereby improving the game running speed.
[0096] Based on the same inventive concept, an embodiment of the present invention further provides a device for creating a rendering pipeline, which is used to implement the above-mentioned embodiments and preferred implementation methods. The details that have been described will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
[0097] Figure 3 FIG2 shows a schematic diagram of a structure of a device for creating a rendering pipeline according to an embodiment of the present invention. Figure 3 The rendering pipeline creation device includes a configuration module 310, a search module 320 and a creation module 330.
[0098] The configuration module 310 is adapted to receive configuration operations of a static switch and a context switch of a source material of an object to be rendered, wherein the static switch is used to configure source material parameters and the context switch controls the search rules of the pipeline description.
[0099] The search module 320 is adapted to determine a material template according to the source material and the static switch, and search the material template for a pipeline variant corresponding to a rendering batch type of an object to be rendered.
[0100] The creation module 330 is adapted to calculate a context switch value using context data of the object to be rendered, search for a pipeline description from the pipeline variant according to the context switch value, and create a rendering pipeline based on the pipeline description.
[0101] The embodiment of the present invention configures static switches and context switches for the source materials of the rendering objects, so that relevant technical personnel do not need to directly operate the rendering pipeline data, thus avoiding the complicated configuration process of the rendering pipeline data. Through the configuration operation of the static switch and the context switch, the configuration content can be conveniently adjusted according to the actual rendering requirements, so that the same source material can generate corresponding pipeline descriptions under different switch branches, effectively reducing the number of unnecessary pipeline descriptions. In addition, the present invention implements the generation of corresponding pipeline descriptions based on the static switch and context switch of the configured source material, and creates a rendering pipeline based on the pipeline description, so that the rendering pipeline can be directly switched during the game running stage without having to change the rendering state or shader separately, which can effectively adapt to the design of the new generation of graphics API.
[0102] See also Figure 4 In one embodiment of the present invention, the above Figure 3 The rendering pipeline creation device in the illustrated embodiment further includes a collection module 340 and a rendering module 350 .
[0103] The collection module 340 is adapted to use a collector to collect rendering instances of objects to be rendered according to the pipeline description after the creation module 330 searches for the pipeline description from the pipeline variant according to the value of the context switch.
[0104] The rendering module 350 is adapted to merge and render rendering instances having the same pipeline description through the created rendering pipeline after the creation module 330 creates the rendering pipeline based on the pipeline description.
[0105] In one embodiment of the present invention, the rendering module 350 is adapted to obtain a pre-configured pipeline description order;
[0106] The created rendering pipeline renders the rendering instances of the rendering object in the order of the pipeline description, and merges the rendering instances with the same pipeline description belonging to the same sequence level.
[0107] In one embodiment of the present invention, the source material parameters configured by the static switch include at least one of a source material model parameter, a source material rendering method of an object to be rendered, and a source material usage method.
[0108] In one embodiment of the present invention, the search module 320 is further adapted to determine the rendering mode used by the object to be rendered, obtain the rendering batch type corresponding to the rendering mode through the collector, and search the material template for the pipeline variant corresponding to the obtained rendering batch type.
[0109] See also Figure 5 In one embodiment of the present invention, the above Figure 3 The rendering pipeline creation device in the illustrated embodiment further includes an initialization module 360 .
[0110] The initialization module 360 is suitable for defining a collector corresponding to a rendering camera in a scene to which the object to be rendered belongs before the search module 320 searches for a pipeline variant corresponding to a rendering batch type of the object to be rendered obtained from a material template, wherein one collector corresponds to one rendering camera; passing initialization parameters into the collector, and initializing the collector using the initialization parameters.
[0111] In one embodiment of the present invention, the initialization module 360 is further adapted to set the rendering mode of the object to be rendered; configure a corresponding rendering batch type for each rendering mode, and pass the correspondence between the rendering mode and the rendering batch type into the collector as an initialization parameter; set the pipeline description order, and pass the sequence number of the pipeline description into the collector as an initialization parameter.
[0112] In an embodiment of the present invention, the rendering mode includes at least one of a normal rendering mode, a rendering mode with outlines, and an instanced rendering mode.
[0113] See also Figure 6 In one embodiment of the present invention, the above Figure 3 The rendering pipeline creation device in the illustrated embodiment further includes a storage module 370 .
[0114] The storage module 370 is suitable for classifying and storing the material template used by the object to be rendered, the pipeline variant corresponding to the rendering batch type of the object to be rendered, and the pipeline description found from the pipeline variant according to the value of the context switch after the creation module 330 searches for the pipeline description from the pipeline variant according to the value of the context switch; wherein, all material templates used by the object to be rendered belong to the same category, the pipeline variant corresponding to the rendering batch type of the object to be rendered belong to the same category, and the pipeline description found from the pipeline variant belongs to the same category.
[0115] Based on the same inventive concept, an embodiment of the present invention further provides a computer storage medium storing computer program code. When the computer program code runs on a computing device, the computing device executes the method for creating a rendering pipeline of any of the above embodiments.
[0116] Based on the same inventive concept, an embodiment of the present invention further provides a computing device, comprising: a processor; a memory storing computer program code; when the computer program code is executed by the processor, the computing device executes the method for creating a rendering pipeline of any of the above embodiments.
[0117] Those skilled in the art will clearly understand that the specific working processes of the systems, devices, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and for the sake of brevity, they will not be further described here.
[0118] In addition, the functional units in various embodiments of the present invention may be physically independent of each other, or two or more functional units may be integrated together, or all functional units may be integrated into a single processing unit. The above-mentioned integrated functional units may be implemented in the form of hardware, software, or firmware.
[0119] Those skilled in the art will understand that if the integrated functional unit is implemented in the form of software 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 the present invention can essentially or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, which includes a number of instructions for enabling a computing device (such as a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention when running the instructions. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0120] Alternatively, all or part of the steps of implementing the aforementioned method embodiments may be accomplished by hardware associated with program instructions (such as a computing device such as a personal computer, a server, or a network device), and the program instructions may be stored in a computer-readable storage medium. When the program instructions are executed by a processor of a computing device, the computing device executes all or part of the steps of the method described in each embodiment of the present invention.
[0121] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that within the spirit and principles of the present invention, they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some or all of the technical features therein. However, these modifications or replacements do not deviate from the scope of protection of the present invention.
Claims
1. A method for creating a rendering pipeline, characterized in that: include: Receiving a configuration operation of a static switch and a context switch of a source material of an object to be rendered, wherein the static switch is used to configure source material parameters, and the context switch controls a search rule for a pipeline description; Determine a material template according to the source material and the static switch, determine a rendering mode to be used for the object to be rendered, obtain a rendering batch type corresponding to the rendering mode through a collector, and search the material template for a pipeline variant corresponding to the obtained rendering batch type; wherein the pipeline variant is a pipeline description set, and the pipeline description includes rendering states and static configuration data of a shader required for a rendering batch; Calculating the value of the context switch using the context data of the object to be rendered, searching for a pipeline description from the pipeline variant according to the value of the context switch, and creating a rendering pipeline based on the pipeline description; wherein, if the same context switch value is calculated according to the context data of different objects to be rendered, searching for the same pipeline description from the pipeline variant according to the same context switch value; The created rendering pipeline is used to merge and render rendering instances of the to-be-rendered objects corresponding to the same pipeline description.
2. The method according to claim 1, characterized in that After searching the pipeline description from the pipeline variant according to the value of the context switch, the method further includes: using a collector to collect rendering instances of the object to be rendered according to the pipeline description; After creating a rendering pipeline based on the pipeline description, the method further includes: merging renderings of rendering instances having the same pipeline description through the created rendering pipeline.
3. The method according to claim 2, characterized in that Merge rendering of render instances with the same pipeline description through the created render pipeline, including: Get the pre-configured pipeline description sequence; The rendering instances of the object to be rendered are rendered according to the pipeline description sequence through the created rendering pipeline, and the rendering instances with the same pipeline description belonging to the same sequence level are merged for rendering.
4. The method according to any one of claims 1 to 3, characterized in that The source material parameters configured by the static switch include at least one of the model parameters adopted by the source material, the rendering method of the source material of the object to be rendered, and the usage method of the source material.
5. The method according to any one of claims 1 to 3, characterized in that: Searching the material template for a pipeline variant corresponding to the rendering batch type of the object to be rendered includes: Determine a rendering mode used by the object to be rendered, and obtain a rendering batch type corresponding to the rendering mode through a collector; The obtained pipeline variant corresponding to the rendering batch type is searched from the material template.
6. The method according to claim 5, characterized in that Before searching the obtained pipeline variant corresponding to the rendering batch type of the object to be rendered from the material template, the method further includes: Define a collector corresponding to a rendering camera in a scene to which the object to be rendered belongs, wherein one collector corresponds to one rendering camera; Initialization parameters are passed into the collector, and the collector is initialized using the initialization parameters.
7. The method according to claim 6, characterized in that Initialization parameters are passed to the collector, including: Setting the rendering mode of the object to be rendered; Configuring a corresponding rendering batch type for each rendering mode, and passing the corresponding relationship between the rendering mode and the rendering batch type as an initialization parameter into the collector; The pipeline description sequence is set, and the sequence number of the pipeline description is passed into the collector as an initialization parameter.
8. The method according to any one of claims 1 to 3, characterized in that The rendering mode includes at least one of a normal rendering mode, a rendering mode with outline, and an instantiation rendering mode.
9. The method according to any one of claims 1 to 3, characterized in that: After searching the pipeline description from the pipeline variant according to the value of the context switch, the method further includes: The material template used by the object to be rendered, the pipeline variant corresponding to the rendering batch type of the object to be rendered, and the pipeline description found from the pipeline variant according to the value of the context switch are classified and stored respectively; Among them, all material templates used by the object to be rendered belong to the same category, the pipeline variants corresponding to the rendering batch type of the object to be rendered belong to the same category, and the pipeline descriptions found from the pipeline variants belong to the same category.
10. A rendering pipeline creation device, characterized in that: include: A configuration module, adapted to receive configuration operations of a static switch and a context switch of a source material of an object to be rendered, wherein the static switch is used to configure source material parameters, and the context switch controls a search rule for a pipeline description; A search module, adapted to determine a material template according to the source material and the static switch, determine a rendering mode adopted by the object to be rendered, obtain a rendering batch type corresponding to the rendering mode through a collector, and search the material template for a pipeline variant corresponding to the obtained rendering batch type; wherein the pipeline variant is a pipeline description set, and the pipeline description includes a rendering state required for a rendering batch and static configuration data of a shader; A creation module, adapted to calculate the value of the context switch using the context data of the object to be rendered, search for a pipeline description from the pipeline variant according to the value of the context switch, and create a rendering pipeline based on the pipeline description; wherein, if the same context switch value is calculated according to the context data of different objects to be rendered, search for the same pipeline description from the pipeline variant according to the same context switch value; The rendering module is adapted to perform merged rendering of rendering instances of to-be-rendered objects corresponding to the same pipeline description through the created rendering pipeline.
11. A computer storage medium storing a computer program code, wherein when the computer program code is executed on a computing device, the computing device is caused to execute the method for creating a rendering pipeline according to any one of claims 1 to 9.
12. A computing device comprising: processor; a memory storing computer program code; When the computer program code is executed by the processor, the computing device is caused to execute the method for creating a rendering pipeline according to any one of claims 1 to 9.
Citation Information
Patent Citations
Image rendering method, apparatus, image processing apparatus, and storage medium
CN109242943A
Game picture rendering method and device, terminal and storage medium
CN110152291A