Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:56:17+00:00 2026-06-09T15:56:17+00:00

I am currently developing a framework that allows me to conveniently render a larger

  • 0

I am currently developing a framework that allows me to conveniently render a larger number of animated models.

A model is organized as a simple hierarchy of bones, with the root being the torso/pelvis, generally:

My simple modeling hierarchy

So, as pseudo code, I am currently rendering a model like this:

RenderBone(Bone b, Mat4x4 currentTransform){
    Mat4x4 pos = currentTransform * b.boneTransform;
    SetUniform("transformation", pos);
    Draw(bone.mesh);
    for each Bone bc in b.children do{
         RenderBone(bc, pos);
    }
}

So for a single actor that uses a model with n bones I need n SetUniform (not counting stuff like setting textures) and n draw calls.

Trying to reduce that overhead, and render all actors using the same model at once, I thought about switching to instanced rendering.

However, all information and tutorials I could find are about drawing cubes, spheres or similar simple objects. Nowhere I could see some simple, comprehensible information about how to use instanced drawing to render models where each part (bone) requires a different transformation matrix to be given to the shader.

So, the problem:
Using glVertexAttribDivisor or gl_InstanceID I can only specify an instance-related matrix, not a bone-realted matrix. How do I apply my bone transformations then?

The only feasible solution I could think of is – instead of instancing the entire model – I can instance each bone. Thus drawing all instances of one bone type, then another one, etc.
But then I would still have to update the buffer with the transformation matrices relatively often, and it’s more housekeeping code.

So is this best best option? Or, more generally, are there better not-too-complicated ways of rendering?
Or does instanced rendering only really shine when using it with static geometry?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:56:18+00:00Added an answer on June 9, 2026 at 3:56 pm

    Instancing is something you use when you need to draw thousands of copies of the same model. In general, meshes with bones are not the kinds of things you need to draw thousands of.

    Instancing is an optimization, and one that doesn’t always pay off. You shouldn’t bother trying to employ it unless you know that you need it (by profiling and seeing if you’re hitting performance targets). And even then, it can be very touchy as to when it is an actual performance improvement.

    Sometimes, it just doesn’t help. But here are some general rules of thumb:

    1. Instancing is not worthwhile unless you’re rendering thousands of instances.
    2. Instancing shouldn’t be used with meshes that have too many vertices or too few. 100-1,000 or so.

    Remember that these are general rules, not absolute laws. They’re also hardware-dependent.

    So, the problem: Using glVertexAttribDivisor or gl_InstanceID I can only specify an instance-related matrix, not a bone-realted matrix. How do I apply my bone transformations then?

    You’re thinking far too much in terms of what examples you’ve seen or what you’ve seen other people doing. Think like a programmer.

    gl_InstanceID is not “an instance-related matrix”; it is an index. What you do with that index is entirely up to you. Most examples you’ve seen use this index to lookup an array of matrices, likely stored in a uniform block or a buffer texture. This matrix is the transform you use for rendering. Each index represents the transform for a single instance.

    Each of your instances has multiple matrices, multiple transforms. But each instance has the same number of bones (otherwise it wouldn’t be instanced rendering). Let’s say you have 5 bones.

    Again, each index is the transform for a single instance. The difference between your case and the standard is how much information is needed per-instance. The regular case needs one matrix; you need five. But the idea is the same either way.

    If you need bone index 3 for your current instance, you simply access your matrix array with this expression: (gl_InstanceID * 5) + 3, where 5 is the number of bones per instance.

    The rest is a simple matter of using a per-vertex attribute to pass the bone index to be used to transform each vertex.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing a framework that basically executes another application, e.g. rails within the
Problem background I am currently developing a framework of Ant Colony System algorithms. I
Currently developing a PHP framework and have ran into my first problem. I need
I am currently developing a private framework for use on WebKit devices. I have
I am currently developing using the cxml-stp framework, but while parsing I do get
I am currently developing a PHP MVC Framework for a personal project. While I
I am currently developing a web application in ASP.NET Framework 4 and I am
I'm currently developing a video player for streamed-content using the AVPlayer Framework. I stumbled
We are currently building the framework for developing a C# .net application using visual
I am interested in developing a portal-based application that works with EAV models and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.