Archived

This topic is now archived and is closed to further replies.

dataman

3D object structure and Minimizing state changes

Recommended Posts

Take as example the famous Halo and it''s objects with min 4 pass render. How to construct an object that take complicated texturing? What structure to use? More important, how to render it ?... or mainly, how to render several objects ? My main problem is to minimize the state changes (like changing texture). The simplest way to render, is to process every object individually. Render object -> render children -> change textures, materials, render using multipass and/or several single pass multi texturing Render next object ..... But that way, we don''t use the GFX card optimally. But how we do ? If objects had only one texture (diffuse), it could be easy (was easy). But now, objects have a detail texture, light map, reflection map ... How to sort objects like this ? by first stage , second ...? Does it really worth to do a sort like this ? or only sort by Object Type is enough (sort and render characters , then cars ,then trees ...)? What object structure to use for optimal rendering/sorting ? Here is my solution to the structure , but i don''t like it. class TTextureMaterial { TTextureHandle cg_Diffuse; TTextureHandle cg_Lightmap; TTextureHandle cg_Detail; TTextureHandle cg_Reflection; ...................... }; class TMaterial { TColor cg_Diffuse,cg_Ambient,cg_Specular,cg_Emissive; }; class TObject { TGeometryHandle cg_Geometry; TTextureMaterial cg_TexMaterial; TMaterial cg_Material; TObject* cg_pChildren; }; On render, i simply sort the Geometry using the main texture(diffuse). I don''t take in to account the rest of the texture, or the material either . Some people suggested to sort by shader. But, what do you understand by shader? And what KEYs do you consider for the sorting ? Thank you for showing me the light .
The Aero Section : http://fly.to/TheAeroSection/
The Aero Section is a large military aircraft photo gallery.

Share this post


Link to post
Share on other sites