Ogre-rendering a large number of objects, batch (Batch)

Source: Internet
Author: User

Ogre renders objects as instancedgeometry, staticgeometry, and entity instances.

Differences:

Instancedgeometry: Pre-transforms and batches up meshes for efficient use as instanced geometry in a scene. That is to say, all the grids are used as an instance geometry.

This shader instancing implementation stores only 80 times the object, and then re-uses the vertex data with different shader parameter. you can only store the same object 80 times, and then reuse vertex data using different rendering parameters.

You can adjust the position, direction, and size of each frame.

Staticgeometry: uses all the grids as a static ry, so that each material is a batch. However, if you see a small part, all staticgeometry will be rendered.

Entity: each entity contains a mesh.

Each rendering operation is quite resource-consuming. Therefore, we should reduce the number of DIP calls.

Ogre rendering process

Void scenemanager: rendersingleobject (renderable * rend, const Pass * pass ,...)
{
//...
Static renderoperation ro;
Ro. srcrenderable = rend;
//...
Mdestrendersystem-> _ render (RO );
//...
}

Void scenemanager: scenemgrqueuedrenderablevisitor: visit (renderable * r)
{
// Give SM a chance to eliminate
If (targetscenemgr-> validaterenderableforrendering (musedpass, R ))
{
// Render a single object, this will set up auto Params if required
Targetscenemgr-> rendersingleobject (R, musedpass, scissoring, autolights, manuallightlist );
}
}
Void queuedrenderablecollection: acceptvisitorgrouped (
Queuedrenderablevisitor * visitor) const
{
Passgrouprenderablemap: const_iterator IPASS, ipassend;
Ipassend = mgrouped. End ();
For (IPASS = mgrouped. Begin (); IPASS! = Ipassend; ++ IPASS)
{
// Fast bypass if this group is now empty
If (IPASS-> second-> Empty () continue;

// Visit pass-Allow skip
If (! Visitor-> visit (IPASS-> first ))
Continue;

Renderablelist * rendlist = IPASS-> second;
Renderablelist: const_iterator irend, irendend;
Irendend = rendlist-> end ();
For (irend = rendlist-> begin (); irend! = Irendend; ++ irend)
{
// Visit renderable
Visitor-> visit (const_cast <renderable *> (* irend ));
}
}
}

For (IPASS = mgrouped. Begin (); IPASS! = Ipassend; ++ IPASS)
{
________//....

________ Renderablelist * rendlist = IPASS-> second;

________ For (irend = rendlist-> begin (); irend! = Irendend; ++ irend)
______________{

_____________ Visitor-> visit (const_cast <renderable *> (* irend ));

______________}
}

That is to say, each rendable calls dip once. When the rendable with the same pass is merged once, the call to dip can be reduced.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/zhangshuncai/archive/2010/06/30/5705055.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.