Jump to content
  • Advertisement
Sign in to follow this  
IronFox

OpenGL materials vs matrices. questions about efficiency

This topic is 5138 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there I've been coding my new 3d-editor for quite some time and now I've come across some interesting problem. As you may or may not know in OpenGL (or other 3d languages) you have to draw primitives grouped to materials in order to put them on screen with the correct texture(s) and colors (and shaders and...) attached. Now taking the eventuality that multible objects do share materials across the scene resulting in two possibilities to approach the rendering-process. You can either draw the scene on an per-object-base, first choosing the matrix and then choosing the material (which results in least possible matrix-reloads but a lot more material-changes) or you can loop through the materials and choose the objects addressed by the selected material (causing potentially a lot of matrix-transformation but least possible material-changes). Now the decission is all about efficiency and usefulness. While loading an object-matrix may seem more expensive than changing some switches and texture-bindings there's yet some aspect about rendering transparent and non-transparent materials in an order that creates a correctly blended image (i.e. putting the transparent textures way to the back of the material-list). On the other hand having objects sharing materials may be less likely and some materials (i.e. cube-textures) do require texture-matrix-reloads... There are quite a lot of aspects for this and since i can't clearly figure out which would be best I'd like to raise this question in this forum. Any one here who's got experience in this and would like to share this experience?

Share this post


Link to post
Share on other sites
Advertisement
I'd be very very suprised if a change if texture was less expensive than a change in a matrix, given that both ATI and NV specifically say to draw objects grouped by shader/texture to ensure the best performance.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!