CN109816763A - A kind of method for rendering graph - Google Patents

A kind of method for rendering graph Download PDF

Info

Publication number
CN109816763A
CN109816763A CN201811579824.3A CN201811579824A CN109816763A CN 109816763 A CN109816763 A CN 109816763A CN 201811579824 A CN201811579824 A CN 201811579824A CN 109816763 A CN109816763 A CN 109816763A
Authority
CN
China
Prior art keywords
model
rendering
group
frame
scene
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.)
Withdrawn
Application number
CN201811579824.3A
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.)
Suzhou Snail Digital Technology Co Ltd
Original Assignee
Suzhou Snail Digital 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 Suzhou Snail Digital Technology Co Ltd filed Critical Suzhou Snail Digital Technology Co Ltd
Priority to CN201811579824.3A priority Critical patent/CN109816763A/en
Publication of CN109816763A publication Critical patent/CN109816763A/en
Withdrawn legal-status Critical Current

Links

Abstract

A kind of method for rendering graph, includes the following steps, by scene partitioning at multiple regions landform group, and is screened according to threshold value to all models in scene;The model filtered out is arranged, is merged, the model with same alike result is assigned in a model group, generates multiple model groups with same alike result;It calculates and generates data corresponding with the model group.Method for rendering graph of the invention significantly reduces rendering batch size, saves the CPU operation time, effectively improves rendering performance, program draws effect and program operation frame number.

Description

A kind of method for rendering graph
Technical field
The present invention relates to graph processing technique fields, more particularly to a kind of method for rendering graph.
Background technique
In graph image interactive program, one of the effective ways of abundant user experience be exactly present one it is genuine and believable The world, be filled with a large amount of various interesting objects and the object rich in various characteristics.From unnumbered thick grass, trees, river Stream, sundries to various buildings, landscape etc..All these objects can increase the visual experience of user and raising allows use Immerse substitution sense therein in family.But from the perspective of rendering, so various, a large amount of object is drawn similarly to program Bring huge pressure.
During figure rendering, it is a relatively slow operation that data, which are submitted to GPU rendering,.An object A Rendering operations process must at least be executed by being rendered on screen, this operating process is exactly a Draw Call, i.e., and one A rendering batch.According to the description in " GPU GEM2 " book: " Wloka2003 shows that the CPU of 1GHz is per second can only to be rendered greatly About 10000-40000 batch (batch).On more modern CPU, estimate this number probably in 30000-120000 per second Batch." in summary, that is to say, that if we want to draw a scene, each rendering batch is an object in scene, So, no matter how to operate, and the maximum rendering quantity of object can only achieve 4000 or so and (be to FPS in this scene General every 1000 to 4000 batch of frame for the system of 30frame/sec).And this operated in saturation will lead to program because CPU does not have time to handle other tasks and generate exception.Such case is clearly very undesirable, so needing one kind has The reduction of effect renders batch, promotes the solution of rendering performance to handle this problem.
Summary of the invention
In order to solve the shortcomings of the prior art, the purpose of the present invention is to provide a kind of method for rendering graph, effectively Saving frequently submit CPU calculation amount caused by rendering batch operation excessive, and simultaneously the GPU free time without operation or frequent switching The loss of rendering state bring performance, while reducing rendering batch size and effectively improving rendering performance.
To achieve the above object, a kind of method for rendering graph provided by the invention, comprising the following steps:
By scene partitioning at multiple regions landform group, and all models in scene are screened according to threshold value;
The model filtered out is arranged, is merged, the model with same alike result is assigned in a model group, generates tool There are multiple model groups of same alike result;
It calculates and generates data corresponding with the model group.
Further, the step of all models in scene screen further comprises:
Obtain present frame in rendering in need all objects model.
Further, the step of described pair of model filtered out is arranged, merged further comprises:
Obtain in each region landform point rendering in need valid model list;
The model in list is screened one by one;
Model with same alike result is assigned in a new model group, to generate multiple model groups with same alike result.
Further, described the step of calculating and generating data corresponding with above-mentioned model group, further comprise:
The duplicate attribute instance of model is turned into a attribute.
Further, described the step of calculating and generating data corresponding with above-mentioned model group, further comprise:
The model rendered in the render list of each frame to needs does replacement detection.
Further, the model rendered in the render list of each frame to needs does the step of replacement detection, Further comprise:
In current render list delete former frame or before it is any formulate frame do not need rendering model.
The implementation of method for rendering graph of the invention significantly reduces rendering batch size, when saving CPU operation Between, effectively improve rendering performance, program draws effect and program operation frame number.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification It obtains it is clear that understand through the implementation of the invention.
Detailed description of the invention
Attached drawing is used to provide further understanding of the present invention, and constitutes part of specification, and with it is of the invention Embodiment together, is used to explain the present invention, and is not construed as limiting the invention.In the accompanying drawings:
Fig. 1 is static batch merging method flow chart according to the present invention;
Fig. 2 is the relational graph of the static grouping of batch merging method mesorelief and model grouping according to the present invention;
Fig. 3 is dynamic batch merging method flow chart according to the present invention.
Specific embodiment
Hereinafter, preferred embodiments of the present invention will be described with reference to the accompanying drawings, it should be understood that preferred reality described herein Apply example only for the purpose of illustrating and explaining the present invention and is not intended to limit the present invention.
In rendering program, the cycle time and rendering batch size that CPU expends show linear relationship, rendering one 10,000 triangles of ten thousand identical triangles and primary rendering, the performance gap of the two be can not ignore.So having Attribute (such as material, texture, vertex or only spatial position, size, the phase of rotation difference according to certain rending models of effect With model etc.) reasonably merge some models into a rendering batch, it, will in the case where having no need to change rendering state Originally the object for needing multiple rendering batches to draw, merging are uniformly processed (such as: 100 of same material in a batch Tree, only spatial position, scaling, direction are different, we can be merged into a model, original by doing to the vertex after merging The data-bias of affiliated model calculates, and 100 trees need 100 rendering batches originally in this way, and 1 rendering batch is reduced to after merging It is secondary).In this way, not only can solve the submission bring CPU operation of a large amount of rendering batch originally, but also GPU can be reduced because every State switching bring redundancy between a rendering batch can be lost.
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, below by specific embodiment The present invention is described in further detail.
Embodiment one
Static batch merges
Fig. 1 is the flow chart that the static batch that the present embodiment is related to merges, below with reference to Fig. 1, to static batch of the invention Merging method is described in detail.
Firstly, in step 101, by a scene partitioning at multiple regions landform group.In reality, usual human eye is can not See behind and more than the object outside certain field range, so equally in the scene, we can be according to program or user Set a reasonable controllable field range critical value.The field range critical value represents maximum visual in current scene A threshold values i.e. field range critical value is arranged in a step 101 in distance or consolidation scope distance;According to the threshold values by one Scene partitioning is at multiple regions landform group.Thereby, it is possible to acquire 1-N region landform grouping (region landform group 1, region Landform group 2, region landform group 3, region landform group N ...).As shown in Fig. 2, in the present embodiment, a scene is divided into 4 areas Domain landform group, but the number of region landform group is without being limited thereto.The size of each region landform grouping can be identical, can also mutually not It is identical.
In step 102, screening is executed to each region landform group and is calculated.In a step 102, it obtains in each region landform grouping Rendering in need valid model list;The model in list is screened one by one, and will have same alike result (such as material, Texture, vertex etc.) model be assigned in a new model group, to generate multiple model group (models with same alike result Group 1, model group 2, model group 3, model group N ...).If not the model of same alike result can ignore without generate model Group.As a result, in the present embodiment, multiple models with same alike result feature that entire landform group 1 screens can be obtained Group.
In step 103, the multiple model groups filtered out are ranked up and it is merged.In step 103, according to It needs, such as according to the distance between model perhaps vertex quantity multiple models or list close to the distance of "current" model group A model is ranked up;To after sequence multiple models or single model merge.In the present embodiment, it is contemplated that rendering The problem of cutting, together by the close model sequence of distance in single grouping.Since in rendering program, video camera and human eye Equally there is certain visual range and hiding relation, will not be drawn out beyond the visual field or shielded model.If will The model nearest apart from video camera is together with model combination relatively far away from, then certain cutting out property of video camera will be slatterned Can, for another example fruit sets certain merging rules, such as vertex quantity, if then the current model needs for having 100 same alike results Merge, merging in regular critical value, merges the model that a part of maximum limitation is closed on, remerge remaining model, equally Video camera can also effectively be improved and cut performance.
In step 104, calculates and generate data corresponding with above-mentioned model group.Specifically, by calculating these models Duplicate attribute instance turns on a attribute (such as material, texture, vertex), and slightly discrepant data pass through corresponding offset A data (vertex position, scaling in such as space, rotation) is merged into after calculating.Pass through optimal feelings after calculating in this way Condition is original calculation amount for needing N number of rendering batch can be reduced to 1 rendering batch.
In step 105, repeat step 103 and step 104 until until entire scene joint account terminates.When After the union operation of above-mentioned model group 1, can be operated with circulating repetition remaining model group 2, model group N ... and it is remaining its He does same union operation at region landform group, until entire scene joint account terminates.
Embodiment two
Dynamic batch merges
Embodiment one provides a kind of method that preparatory static rendering batch merges, and effectively reduces the rendering batch in scene Quantity, still, in some cases, we be possible to also to need it is agile, dynamically increase in real time, decompose, deleting some scenes In object, so, the present invention also provides second for dynamic batch merge technical method.
Embodiment two is different from embodiment one according to presetting field range by user or consolidation scope numerical value is pre- The mode of shaped area is first divided, but only that obtaining the wash with watercolours in the video camera space that present procedure is presented on the display device Range is contaminated as combined region computer capacity.
Firstly, obtaining model list in present frame in step 301.In step 301, present procedure render list is obtained In it is in need present frame draw object.
In step 302, model list is carried out to execute screening calculating.It can use and matching mould identical in embodiment one The mode of type screens the model in current rendering frame, is grouped, merges to qualified model, ineligible Model do not operate, keep Rendering operations do not change.New screening conditions can also be used, such as: the material of specified limitation, line Reason etc..
In step 303, the model group filtered out is ranked up and it is merged.Can using in embodiment one Identical processing.Simultaneously, it is contemplated that be real-time operation, save render performance under the premise of, can also increase it is some relative to Merge merging rule more direct, stringent but more efficient for rule in embodiment one, such as: the limitation on vertex, face number Or whether it is necessary for same model etc. requirement.
In step 304, the model rendered in the render list of each frame to needs does replacement detection.Specifically, such as They are done union operation, then delete this by the model for not needing rendering in previous frame but needing to render in present frame It is not included in current render list in frame or in specified frame number (the 1-N frame as before) but in the mould being merged before Type.Circulate operation repeatedly just meets the demand scheme of model dynamic batch merging.
Those of ordinary skill in the art will appreciate that: the foregoing is only a preferred embodiment of the present invention, and does not have to In the limitation present invention, although the present invention is described in detail referring to the foregoing embodiments, for those skilled in the art For, still can to foregoing embodiments record technical solution modify, or to part of technical characteristic into Row equivalent replacement.All within the spirits and principles of the present invention, any modification, equivalent replacement, improvement and so on should all include Within protection scope of the present invention.

Claims (6)

1. a kind of method for rendering graph, comprising the following steps:
By scene partitioning at multiple regions landform group, and all models in scene are screened according to threshold value;
The model filtered out is arranged, is merged, the model with same alike result is assigned in a model group, generates tool There are multiple model groups of same alike result;
It calculates and generates data corresponding with the model group.
2. image rendering method according to claim 1, which is characterized in that it is described according to threshold value to all moulds in scene The step of type is screened further comprises:
Obtain present frame in rendering in need all objects model.
3. rendering image rendering method according to claim 1, which is characterized in that the described pair of model filtered out is arranged The step of column, merging, further comprise:
Obtain in each region landform point rendering in need valid model list;
The model in list is screened one by one;
Model with same alike result is assigned in a new model group, to generate multiple model groups with same alike result.
4. image rendering method according to claim 1, which is characterized in that the calculating simultaneously generates and above-mentioned model group pair The step of data answered, further comprise:
The duplicate attribute instance of model is turned into a attribute.
5. image rendering method according to claim 1, which is characterized in that the calculating simultaneously generates and above-mentioned model group pair The step of data answered, further comprise:
The model rendered in the render list of each frame to needs does replacement detection.
6. rendering image rendering method according to claim 5, which is characterized in that described in the render list of each frame The step of doing replacement detection to the model that needs render further comprises:
In current render list delete former frame or before it is any formulate frame do not need rendering model.
CN201811579824.3A 2018-12-24 2018-12-24 A kind of method for rendering graph Withdrawn CN109816763A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811579824.3A CN109816763A (en) 2018-12-24 2018-12-24 A kind of method for rendering graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811579824.3A CN109816763A (en) 2018-12-24 2018-12-24 A kind of method for rendering graph

Publications (1)

Publication Number Publication Date
CN109816763A true CN109816763A (en) 2019-05-28

Family

ID=66602323

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811579824.3A Withdrawn CN109816763A (en) 2018-12-24 2018-12-24 A kind of method for rendering graph

Country Status (1)

Country Link
CN (1) CN109816763A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111063032A (en) * 2019-12-26 2020-04-24 北京像素软件科技股份有限公司 Model rendering method and system and electronic device
CN111744182A (en) * 2020-07-03 2020-10-09 广州要玩娱乐网络技术股份有限公司 Batch rendering method and device of game scenes and server
CN111798361A (en) * 2019-09-20 2020-10-20 厦门雅基软件有限公司 Rendering method, rendering device, electronic equipment and computer-readable storage medium
CN111882636A (en) * 2020-07-24 2020-11-03 上海米哈游天命科技有限公司 Picture rendering method, device, equipment and medium
CN112423111A (en) * 2020-11-05 2021-02-26 上海哔哩哔哩科技有限公司 Graphic engine and graphic processing method suitable for player
CN113426130A (en) * 2021-07-01 2021-09-24 网易(杭州)网络有限公司 Batch processing method and device for models
CN115272549A (en) * 2022-08-02 2022-11-01 动森数字科技(重庆)有限公司 Method and device for storing, rendering and scheduling super-large digital scene

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111798361A (en) * 2019-09-20 2020-10-20 厦门雅基软件有限公司 Rendering method, rendering device, electronic equipment and computer-readable storage medium
CN111063032A (en) * 2019-12-26 2020-04-24 北京像素软件科技股份有限公司 Model rendering method and system and electronic device
CN111063032B (en) * 2019-12-26 2024-02-23 北京像素软件科技股份有限公司 Model rendering method, system and electronic device
CN111744182A (en) * 2020-07-03 2020-10-09 广州要玩娱乐网络技术股份有限公司 Batch rendering method and device of game scenes and server
CN111882636A (en) * 2020-07-24 2020-11-03 上海米哈游天命科技有限公司 Picture rendering method, device, equipment and medium
CN112423111A (en) * 2020-11-05 2021-02-26 上海哔哩哔哩科技有限公司 Graphic engine and graphic processing method suitable for player
CN113426130A (en) * 2021-07-01 2021-09-24 网易(杭州)网络有限公司 Batch processing method and device for models
CN115272549A (en) * 2022-08-02 2022-11-01 动森数字科技(重庆)有限公司 Method and device for storing, rendering and scheduling super-large digital scene
CN115272549B (en) * 2022-08-02 2023-12-15 动森数字科技(重庆)有限公司 Storage and rendering scheduling method and device for oversized digital scene

Similar Documents

Publication Publication Date Title
CN109816763A (en) A kind of method for rendering graph
US10964105B2 (en) Rendering views of a scene in a graphics processing unit
US7439982B2 (en) Optimized scene graph change-based mixed media rendering
JP7146091B2 (en) Information embedding method in video, computer equipment and computer program
US20130300741A1 (en) Adaptive mesh refinement
US9041773B2 (en) Conversion of 2-dimensional image data into 3-dimensional image data
CN106658139B (en) Focus control method and device
US9734551B1 (en) Providing depth-of-field renderings
DE112009002383T5 (en) Graphics processing using culling on groups of vertices
CN106339983A (en) Blurring animation realization method through Gaussian blurring and blurring animation realization device thereof
US20160111129A1 (en) Image edits propagation to underlying video sequence via dense motion fields
Cabral et al. Structure‐Preserving Reshape for Textured Architectural Scenes
DE112013003714T5 (en) Stochastic depth buffer compression by means of generalized plane coding
CN107679150A (en) Magnanimity three-dimensional data fast dispatch method
CN104506867B (en) Sample point self-adapted offset parameter method of estimation and device
CN115861510A (en) Object rendering method, device, electronic equipment, storage medium and program product
KR101667306B1 (en) Low-Complexity Topological Derivative-Based Image Segmentation Method and System
CN104517273A (en) Image super-resolution processing method and apparatus
CN105243652B (en) The method and device of image noise reduction
EP2821997A1 (en) Method and device for editing a video sequence
US9947114B2 (en) Modifying gradation in an image frame including applying a weighting to a previously processed portion of the image frame
CN116711301A (en) Virtual viewpoint generating, rendering and decoding methods and devices, equipment and storage medium
Buades et al. Separable soft shadow mapping
CN108876912A (en) Three-dimensional scenic physics renders method and its system
CN115686727B (en) Method for realizing synthesis rendering based on wlroots

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20190528

WW01 Invention patent application withdrawn after publication