CN117671111A - Instantiation rendering method and system - Google Patents

Instantiation rendering method and system Download PDF

Info

Publication number
CN117671111A
CN117671111A CN202311760245.XA CN202311760245A CN117671111A CN 117671111 A CN117671111 A CN 117671111A CN 202311760245 A CN202311760245 A CN 202311760245A CN 117671111 A CN117671111 A CN 117671111A
Authority
CN
China
Prior art keywords
instance
data
subscript
activation
matrix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311760245.XA
Other languages
Chinese (zh)
Inventor
王鑫
谢帅
井刚
吴俊华
李鉴
芦世鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Youhao Technology Co ltd
Original Assignee
Beijing Youhao Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Youhao Technology Co ltd filed Critical Beijing Youhao Technology Co ltd
Priority to CN202311760245.XA priority Critical patent/CN117671111A/en
Publication of CN117671111A publication Critical patent/CN117671111A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an instantiation rendering method and system, and relates to the field of instantiation rendering. The method comprises the following steps: an instance management component is constructed, the instance management component is used for managing subscripts of the individual object matrixes in the instance matrixes, counting the number of the instances, setting an activation number interface for the instance management component, and the activation number interface is used for acquiring the activation number of the instances; registering an activation quantity change event with the instance management component, updating the value of the instance quantity to be the activation quantity through the activation quantity change event, and carrying out instance rendering according to the activation quantity. According to the invention, the instance number is modified to carry out the display and hidden control of the instance object, when part of the instance object needs to be hidden or displayed, the instance number can be increased or decreased, the rendering performance is greatly improved, meanwhile, the availability of instance rendering is improved through event driving, so that the individual object can be easily set and hidden, and the waste of the rendering performance is avoided.

Description

Instantiation rendering method and system
Technical Field
The present invention relates to the field of instantiation rendering, and in particular, to an instantiation rendering method and system.
Background
For n rendering nodes in the 3D engine where the geometry and material of the batch are the same, the means of instantiating rendering may be used for optimization. In using this approach, an instanceMatrix attribute is typically added to the geometry. The attribute internally contains matrix data of all the same n rendering nodes to be rendered, wherein the length of an array of single rendering nodes is 16, and therefore the total length of the attribute is n×16. Meanwhile, an instanceCount (number of instances) needs to be set to n. The materials definition attribute is then modified to support instantiated rendering. And finally, generating new rendering nodes by using the modified geometry and material to conduct instantiation rendering, wherein the number of the drawCall is reduced from n to 1, so that the performance is improved.
However, such an instantiated rendering approach currently has performance drawbacks, such as: when the saliency of a partial node optimized using instantiation rendering is to be modified, it can only be achieved by modifying the scaling component of the node matrix located in the instanceMatrix, instead of modifying instanceCount so that the instantiation rendering node does not render the node that needs to be hidden, which wastes greatly rendering performance.
Disclosure of Invention
The invention aims to solve the problem that the rendering performance is wasted because the existing instantiation rendering means is difficult to flexibly render the display of part of nodes, and provides an instantiation rendering method and system.
In a first aspect, an instantiation rendering method is provided, including:
an instance management component is constructed, the instance management component is used for managing subscripts of the individual object matrixes in the instance matrixes, counting the number of the instances, setting an activation number interface for the instance management component, and the activation number interface is used for acquiring the activation number of the instances;
registering an activation quantity change event with the instance management component, updating the value of the instance quantity to be the activation quantity through the activation quantity change event, and carrying out instance rendering according to the activation quantity.
In one possible implementation of the first aspect, before registering the activation quantity change event with the instance management component, the method further includes:
constructing a data segment uploading component, wherein the data segment uploading component is used for setting a buffer updating range based on a given subscript;
and using the data segment uploading component to carry out segment uploading on the data to be rendered in the buffer updating range.
In one possible implementation of the first aspect, the method further includes:
registering a subscript change event with the instance management component, the subscript change event for exchanging data in the instance matrix to which the changed subscript points;
and exchanging data in the instance matrix through the index change event.
In one possible implementation of the first aspect, exchanging data in the instance matrix through the index change event specifically includes:
the subscript change event determines a source subscript and a destination subscript of data to be exchanged, corresponding source data is taken out of the instance matrix according to the source subscript, and temporary variables are used for storing the source data;
according to the destination subscript, corresponding destination data is taken out from the instance matrix, and written into the source subscript in the instance matrix;
and writing the source data in the temporary variable into the destination index in the instance matrix to complete data exchange.
In one possible implementation of the first aspect, the method further includes:
and setting a subscript distribution interface, a release interface, an activation interface and a deactivation interface for the instance management component, wherein the subscript distribution interface is used for distributing subscripts for the instance matrix, the release interface is used for releasing the subscripts, the activation interface is used for activating the subscripts, and the deactivation interface is used for deactivating the subscripts.
In a second aspect, there is provided an instantiated rendering system comprising:
the first component construction unit is used for constructing an instance management component, wherein the instance management component is used for managing subscripts of the individual object matrix in the instance matrix, counting the number of instances, setting an activation number interface for the instance management component, and the activation number interface is used for acquiring the activation number of the instances;
and the first event registration unit is used for registering the activation quantity change event with the instance management component, updating the value of the instance quantity to be the activation quantity through the activation quantity change event, and carrying out instance rendering according to the activation quantity.
In one possible implementation of the second aspect, the method further includes:
a second component constructing unit configured to construct a data segment uploading component configured to set a buffer update range based on a given subscript;
and the segment uploading unit is used for carrying out segment uploading on the data to be rendered in the buffer updating range by using the data segment uploading component.
In one possible implementation of the second aspect, the method further includes:
a second event registration unit, configured to register a subscript change event with the instance management component, where the subscript change event is used to exchange data in the instance matrix pointed by the changed subscript;
and the data exchange unit is used for exchanging the data in the instance matrix through the index change event.
In one possible implementation manner of the second aspect, the data exchange unit is specifically configured to determine a source index and a destination index of data to be exchanged through an index change event, extract corresponding source data from the instance matrix according to the source index, and save the source data by using a temporary variable; according to the destination subscript, corresponding destination data is taken out from the instance matrix, and written into the source subscript in the instance matrix; and writing the source data in the temporary variable into the destination index in the instance matrix to complete data exchange.
In a possible implementation of the second aspect, the first component building unit is further configured to set a subscript allocation interface for allocating subscripts to the instance matrix, a release interface for releasing the subscripts, an activation interface for activating the subscripts, and a deactivation interface for deactivating the subscripts for the instance management component.
According to the invention, the instance number is modified to carry out the display and hidden control of the instance object, when part of the instance object needs to be hidden or displayed, the instance number can be increased or decreased, the rendering performance is greatly improved, meanwhile, the availability of instance rendering is improved through event driving, so that the individual object can be easily set and hidden, and the waste of the rendering performance is avoided.
In addition, based on the prior instance rendering method, redundant uploading exists when the instance matrix data is updated, because the current rendering engine adopts full uploading instead of only uploading partial data, the problem of reduced rendering performance is also caused, and the method and the device adopt a segmented and on-demand uploading mode to optimize when uploading the data, so that the uploading bandwidth is saved, and the rendering efficiency is improved.
Additional aspects of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
FIG. 1 is a flow chart of an exemplary rendering method embodiment of the present invention;
FIG. 2 is a schematic diagram of a subscript assignment flow according to another embodiment of the present invention;
FIG. 3 is a schematic diagram of a release process according to other embodiments of the present invention;
FIG. 4 is a schematic diagram of an activation flow provided in other embodiments of the present invention;
FIG. 5 is a schematic diagram of a deactivation process according to another embodiment of the present invention;
fig. 6 is a schematic diagram of a data exchange flow provided in other embodiments of the present invention.
Detailed Description
The principles and features of the present invention are described below with reference to the drawings, the illustrated embodiments are provided for illustration only and are not intended to limit the scope of the present invention.
As shown in fig. 1, a flowchart is provided for an embodiment of an exemplary rendering method of the present invention, where the exemplary rendering method includes:
an instance management component indiceManager is constructed, the instance management component indiceManager is used for managing the subscript of the individual object matrix in the instance matrix instanceMatrix, counting the number of instances instanceCount, setting an activation number interface for the instance management component indiceManager, and the activation number interface is used for acquiring the activation number activeCount of the instance;
it will be appreciated that the example matrix instanceMatrix is a large array that writes all of the individual object matrices, with subscripts indicating where the individual object matrices are located in the instanceMatrix array.
Registering an activation quantity change event ACTIVE_COUNT_CHANGED with an instance management component index, updating a value of an instance quantity instanceCount to be an activation quantity activeCount through the activation quantity change event ACTIVE_COUNT_CHANGED, and carrying out instance rendering according to the activation quantity activeCount.
For example, as shown in fig. 2, a stripe consisting of six blocks from left to right is an instance matrix array, and two specific rendering examples are given below.
In example one, individual objects are assigned subscripts in the example matrix instanceMatrix, but objects are not shown (allocateIndex & deactivateInex).
The operation is as follows: assigning at the subscript n+2 of the unassigned region; the allocatedCount count is incremented by one and enters the allocated inactive area, and the object is not displayed.
In example two, an individual object is assigned a subscript in the example matrix instanceMatrix, but the object is shown (allocateIndex & activateIndex).
The operation is as follows: assigning at the subscript n+2 of the unassigned region; the allocatedCount count is incremented by one; exchanging subscript n+2 with subscript n+1; the activeCount is incremented by one, the distribution and activation area is entered, and the object is displayed.
It will be appreciated that setting the instance number instanceCount will occur in the ACTIVE number change event active_count_change, which will provide the ACTIVE number activeCount parameter. After the activation quantity activeCount parameter is taken, setting the instance quantity instanceCount by directly using the activation quantity activeCount; if the active number activeCount is zero, then the operation of removing the instantiated rendered node from the scene tree is performed to improve performance.
It should be noted that instantiating rendering refers to an optimization capability provided by a rendering pipeline that is capable of rendering multiple identical primitives by sharing identical vertex data, but may have different attributes in each instance. Since this instantiated rendering optimization approach can significantly reduce drawCall, performance can be significantly improved in scenes where there are a large number of similar objects. It should be noted that, in instantiating rendering, the number of instances instanceCount needs to be set to tell the pipeline how many instances need to be drawn, so this value affects the performance of the instantiated rendering, and drawCall refers to a process of rendering a draw call, i.e., a rendering primitive, in the pipeline.
The instance management component directives manager enables dynamic control of instantiated rendering by providing interfaces for index assignment, release, activation, deactivation, etc.
According to the embodiment, the instance number is modified to carry out the display and hidden control of the instance object, when part of the instance object needs to be hidden or displayed, the instance number can be increased or decreased, the rendering performance is greatly improved, meanwhile, the availability of instance rendering is improved through event driving, the individual object can be easily set and hidden, and the rendering performance waste is avoided.
Optionally, in some possible embodiments, before registering the activation quantity change event with the instance management component, further includes:
constructing a data segment uploading component BufferUtils, wherein the data segment uploading component BufferUtils is used for setting a buffer updating range based on a given subscript;
and using a data segment uploading component BufferUtils to carry out segment uploading on the data to be rendered in the updating range of the buffer.
By setting the Buffer updating range instead of updating the whole Buffer, the data size uploaded from the CPU to the GPU can be reduced, the data uploading efficiency is improved, and the rendering performance is improved.
For example, as shown in FIG. 6, when the data at subscripts n+1 and n+2 of instanceMatrix Buffer need to be updated, then by calling BufferUtils.
BufferUtils.updateBufferRange(n+2);
A description of the update scope is generated internally, the offset of the update start: n+1, update size: 2*16. And the updated description is set to Buffer so that the engine can upload segments as required.
Specifically, the data segment uploading component BufferUtils exposes an updateBufferRange interface to the outside, and provides a buffer update range set based on a given subscript.
Based on the prior instance rendering method, redundant uploading exists when the instance matrix data is updated, because the current rendering engine adopts full uploading instead of only uploading partial data, the problem of reduced rendering performance is also caused, and the embodiment optimizes in a segmented and on-demand uploading mode when uploading the data, saves uploading bandwidth and improves rendering efficiency.
Optionally, in some possible embodiments, the method further includes:
registering a subscript change event INDEX_CHANGED with the instance management component indiceManager, the subscript change event INDEX_CHANGED being used to exchange data in the instance matrix to which the CHANGED subscript points;
the data in the instance matrix instanceMatrix is exchanged by the INDEX change event index_changed.
Optionally, in some possible embodiments, exchanging data in the instance matrix through the subscript change event specifically includes:
the INDEX change event INDEX_CHANGED determines a source INDEX and a destination INDEX of data to be exchanged, corresponding source data is taken out from the instance matrix instanceMatrix according to the source INDEX, and temporary variables are used for storing the source data;
according to the destination index targetIndex, corresponding destination data are taken out from the instance matrix instanceMatrix, and the destination data are written into the source index in the instance matrix instanceMatrix;
and writing the source data in the temporary variable into a destination index in the instance matrix instanceMatrix to complete data exchange.
Optionally, in some possible embodiments, the method further includes:
an index allocation interface allowander, a release interface releaseiindex, an activation interface activateIndex and a deactivation interface deactivateIndex are set for the instance management component directives, the index allocation interface allowander is used for allocating an index for the instance matrix instanceMatrix, as shown in fig. 2, the release interface releaseiindex is used for releasing the index, as shown in fig. 3, the activation interface activateIndex is used for activating the index, as shown in fig. 4, and the deactivation interface deactivateIndex is used for deactivating the index, as shown in fig. 5.
The present invention also provides an instantiated rendering system comprising:
the first component construction unit is used for constructing an instance management component, the instance management component is used for managing subscripts of the individual object matrixes in the instance matrixes, counting the number of the instances, setting an activation number interface for the instance management component, and the activation number interface is used for acquiring the activation number of the instances;
and the first event registration unit is used for registering the activation quantity change event to the instance management component, updating the value of the instance quantity to be the activation quantity through the activation quantity change event, and carrying out instance rendering according to the activation quantity.
According to the embodiment, the instance number is modified to carry out the display and hidden control of the instance object, when part of the instance object needs to be hidden or displayed, the instance number can be increased or decreased, the rendering performance is greatly improved, meanwhile, the availability of instance rendering is improved through event driving, the individual object can be easily set and hidden, and the rendering performance waste is avoided.
Optionally, in some possible embodiments, the method further includes:
a second component constructing unit configured to construct a data segment uploading component configured to set a buffer update range based on a given subscript;
and the segment uploading unit is used for carrying out segment uploading on the data to be rendered in the buffer area updating range by using the data segment uploading component.
Optionally, in some possible embodiments, the method further includes:
the second event registration unit is used for registering a subscript change event to the instance management component, wherein the subscript change event is used for exchanging data in an instance matrix pointed by a changed subscript;
and the data exchange unit is used for exchanging the data in the instance matrix through the index change event.
Optionally, in some possible embodiments, the data exchange unit is specifically configured to determine a source index and a destination index of data to be exchanged through an index change event, extract corresponding source data from the instance matrix according to the source index, and save the source data by using a temporary variable; according to the destination index, the corresponding destination data is taken out from the instance matrix and written into the source index position in the instance matrix; and writing the source data in the temporary variable into a destination index position in the instance matrix to finish data exchange.
Optionally, in some possible embodiments, the first component building unit is further configured to set a subscript allocation interface for allocating subscripts to the instance matrix, a release interface for releasing the subscripts, an activation interface for activating the subscripts, and a deactivation interface for deactivating the subscripts for the instance management component.
It should be understood that the foregoing embodiments are product embodiments corresponding to the previous method embodiments, and the description of the product embodiments may refer to the description of the previous method embodiments, and will not be repeated herein.
It is understood that any combination of the above embodiments can be made by a person skilled in the art without departing from the concept of the invention, and the combination is within the scope of the invention.
The reader will appreciate that in the description of this specification, a description of terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the method embodiments described above are merely illustrative, e.g., the division of steps is merely a logical function division, and there may be additional divisions of actual implementation, e.g., multiple steps may be combined or integrated into another step, or some features may be omitted or not performed.
The above-described method, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-only memory (ROM), a random access memory (RAM, randomAccessMemory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The present invention is not limited to the above embodiments, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the present invention, and these modifications and substitutions are intended to be included in the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (10)

1. An instantiated rendering method, comprising:
an instance management component is constructed, the instance management component is used for managing subscripts of the individual object matrixes in the instance matrixes, counting the number of the instances, setting an activation number interface for the instance management component, and the activation number interface is used for acquiring the activation number of the instances;
registering an activation quantity change event with the instance management component, updating the value of the instance quantity to be the activation quantity through the activation quantity change event, and carrying out instance rendering according to the activation quantity.
2. The instantiated rendering method of claim 1, prior to registering an activation quantity change event with the instance management component, further comprising:
constructing a data segment uploading component, wherein the data segment uploading component is used for setting a buffer updating range based on a given subscript;
and using the data segment uploading component to carry out segment uploading on the data to be rendered in the buffer updating range.
3. The instantiated rendering method of claim 2, further comprising:
registering a subscript change event with the instance management component, the subscript change event for exchanging data in the instance matrix to which the changed subscript points;
and exchanging data in the instance matrix through the index change event.
4. An instantiated rendering method as claimed in claim 3, wherein exchanging data in said instance matrix via said index change event comprises:
the subscript change event determines a source subscript and a destination subscript of data to be exchanged, corresponding source data is taken out of the instance matrix according to the source subscript, and temporary variables are used for storing the source data;
according to the destination subscript, corresponding destination data is taken out from the instance matrix, and written into the source subscript in the instance matrix;
and writing the source data in the temporary variable into the destination index in the instance matrix to complete data exchange.
5. The instantiated rendering method of claim 1, further comprising:
and setting a subscript distribution interface, a release interface, an activation interface and a deactivation interface for the instance management component, wherein the subscript distribution interface is used for distributing subscripts for the instance matrix, the release interface is used for releasing the subscripts, the activation interface is used for activating the subscripts, and the deactivation interface is used for deactivating the subscripts.
6. An instantiated rendering system, comprising:
the first component construction unit is used for constructing an instance management component, wherein the instance management component is used for managing subscripts of the individual object matrix in the instance matrix, counting the number of instances, setting an activation number interface for the instance management component, and the activation number interface is used for acquiring the activation number of the instances;
and the first event registration unit is used for registering the activation quantity change event with the instance management component, updating the value of the instance quantity to be the activation quantity through the activation quantity change event, and carrying out instance rendering according to the activation quantity.
7. The instantiated rendering system of claim 6, further comprising:
a second component constructing unit configured to construct a data segment uploading component configured to set a buffer update range based on a given subscript;
and the segment uploading unit is used for carrying out segment uploading on the data to be rendered in the buffer updating range by using the data segment uploading component.
8. The instantiated rendering system of claim 7, further comprising:
a second event registration unit, configured to register a subscript change event with the instance management component, where the subscript change event is used to exchange data in the instance matrix pointed by the changed subscript;
and the data exchange unit is used for exchanging the data in the instance matrix through the index change event.
9. The instantiation rendering system of claim 8, wherein the data exchange sheet is specifically configured to determine a source index and a destination index of data to be exchanged through an index change event, extract corresponding source data from the instance matrix according to the source index, and save the source data using a temporary variable; according to the destination subscript, corresponding destination data is taken out from the instance matrix, and written into the source subscript in the instance matrix; and writing the source data in the temporary variable into the destination index in the instance matrix to complete data exchange.
10. The instantiated rendering system of claim 6, wherein the first component building element is further configured to set a subscript assignment interface for assigning subscripts to the instance matrix, a release interface for releasing subscripts, an activation interface for activating subscripts, and a deactivation interface for deactivating subscripts for the instance management component.
CN202311760245.XA 2023-12-20 2023-12-20 Instantiation rendering method and system Pending CN117671111A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311760245.XA CN117671111A (en) 2023-12-20 2023-12-20 Instantiation rendering method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311760245.XA CN117671111A (en) 2023-12-20 2023-12-20 Instantiation rendering method and system

Publications (1)

Publication Number Publication Date
CN117671111A true CN117671111A (en) 2024-03-08

Family

ID=90069695

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311760245.XA Pending CN117671111A (en) 2023-12-20 2023-12-20 Instantiation rendering method and system

Country Status (1)

Country Link
CN (1) CN117671111A (en)

Similar Documents

Publication Publication Date Title
US11004172B2 (en) Memory management for systems for generating 3-dimensional computer images
US20020109682A1 (en) Method, system and computer program product for efficiently utilizing limited resources in a graphics device
CN107256531B (en) Memory management system and method
DE102013018139A1 (en) Technique for storing common vertices
CN103810669A (en) Caching Of Adaptively Sized Cache Tiles In A Unified L2 Cache With Surface Compression
US6181346B1 (en) Graphics system
CN111143039B (en) Scheduling method and device of virtual machine and computer storage medium
CN113409411A (en) Rendering method and device of graphical interface, electronic equipment and storage medium
CN107885597B (en) Method for managing graphics rendering resources
CN117311621A (en) Cache disk space allocation method and device, computer equipment and storage medium
CN117671111A (en) Instantiation rendering method and system
CN100468346C (en) Drawing resource management method and system
CN116188242A (en) Map rendering method, device, equipment and program product
CN113936114B (en) BIM model component class-level lightweight method and system
US20190266694A1 (en) Graphics processing method utilizing predefined render chunks
JP5309560B2 (en) Drawing data management device
US11474720B1 (en) Systems and methods for implementing a custom heap memory manager to optimize compute kernel performance
WO2022222494A1 (en) Direct-write lithography data processing system and method
CN103488472A (en) Method and system for processing three-dimensional objects
JP4012715B2 (en) Three-dimensional shape processing apparatus, triangle set representation data creation method, triangle set representation data creation program, and storage medium storing program according to the method
CN117667865A (en) Data distributed storage method, device, equipment and medium
CN116048412A (en) Method, device and medium for processing disk read-write request
CN115858455A (en) Method, device and storage medium for realizing sparse file migration
CN117312425A (en) Quick release method for scattering point data of three-dimensional map, terminal equipment and medium
JPS63192126A (en) Processing system for space control of data set

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination