Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: What is Batch Rendering?

  1. #1
    Member Regular Contributor
    Join Date
    May 2016

    What is Batch Rendering?


    i'd like to know what is meant by "batch rendering". i've read several sites online (including that), couldn't figure it out. what i learnt is to optimize drawing, i have to reduce state changes and drawcalls as well as cpu <--> gpu data transfers (like uploading bufferdata, uniforms etc). and of course eliminate (implicit) syncronization when downloading data wherever possible.

    currently i'm using 1 VAO + VBO for all model meshes, and 1 progam (phong) to shade meshes, and sorting my stuff like that:
    Code cpp:
    /* to draw 1 mesh */
    struct DrawArrays {
    GLenum Mode;
    GLint First;
    GLsizei Count;
    struct RenderState {
    bool WireFrame; /* for glPolygonMode() */
    bool TwoSided; /* for culling */
    bool Blending; /* for "simple" transparency */
    struct MaterialData {
    vec3 Ambient, Diffuse, Specular, Emissive;
    float Shininess;
    struct Material {
    RenderState State;
    MaterialData Data;
    /* to draw 1 model */
    struct ModelInstance {
    /* location, orientation, size */
    mat4 Transformation;
    /* currently sorted by material */
    list< pair<Material, vector<DrawArrays>> > Components;
    /* later i'll add bones */

    all the "Components" for a model instance are generated once when i initialize the application and are then stored.

    so what i'm trying to do is to only upload materialdata once, and draw all meshes that use this material. later i'm trying to map them to renderstates to reduce GL state changes and maybe but all these drawcommands into a GL_DRAW_INDIRECT_BUFFER do reduce them to 1 "drawcommand".

    is this a kind of "batch rendering" (since i'm sort of "batching" drawcalls) or am i missing something? or is instanced rendering meant by "batching"?

    Last edited by john_connor; 05-28-2017 at 08:23 AM.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Two things, batch (noun) and batch (verb).

    Batch (noun) = Draw call (Reference from GDC 2003)
    Batch (verb) = Merging draw calls to reduce total draw call count (and often reduce state changes). Aka batching.

  3. #3
    Member Regular Contributor
    Join Date
    Jul 2012
    From what I know, there are mainly two distinct ways to do batching.

    Dynamic batching implies to dynamically (for each frames) fill the index arrays, so that is sent only what the application expects.

    Static batching may have different aspects. One of them is to pre-calculate all the indices at some 'map compilation time'. This could generate several different arrays for the same geometry. At rendering time, the application only chooses the right one to use.

    The first one might look more slow at first glance. But if it allows to do less draw calls, and eliminates more invisible triangles and to sort them better, some performance gain might be noticeable.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Quote Originally Posted by john_connor View Post
    what i learnt is to optimize drawing, i have to reduce state changes and drawcalls
    This is batching; everything else is just a collection of techniques to enable batching.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts