Sign in to follow this  

multiple image loading for .obj

Recommended Posts

ashstampede    122
so when loading a model and getting to the material file I have some models with multiple textures. can I just binded them to the model and then blended them? or what is the appropriate method? I am not talking about shaders either, I am still not there and a bit lost on binormal and tangents for a model.

Share this post

Link to post
Share on other sites
BionicBytes    154
A data model in the Obj format can have one or more materials. Each material in the Obj format is typically associated with a set of faces.

Thus - typically the set of faces are not overlapping so no multi-texturing is required. For example a model might contain a 100 vertices and 50 faces. The first 20 faces reference material A and the remaining 30 faces reference material B.

The Vertex,Normal and texture values of an Obj file are referenced by the face index. This is an optimal format for storage but its not in the format required for openGL and rendering. You will need to correctly parse this and denormalize this optimal list as you read each face (ordered by material) - get the vertex, the normal and texture - store in a Vertex Array. Repeat for each face.

You now have a sorted set of per vertex data. You will also notice that not one of these per vertex attributes referenced a set set of texture coordinates as I don't think the Obj format supports this.

This should i hope clarify your question.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this