# How to sort or make a sorted draw call on a mesh hierarchy?

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

## Recommended Posts

I want to sort the meshes which were read from assimp.

The assimp just read the asset file from start to end, pushing the first node found to the list, then the next one over and over again

Recently, I got a material problem with those meshes during rendering,

I suspected there was the material problem, but it wasn't.

The problem was the mesh hierarchy was drawn in the wrong order.

Let's say, the Shirt and pants are drawn first, and lastly the body, which makes the body the last layer to be drawn.

But assimp has no concept of mesh sorting,

How do I go about sorting the meshes in a hierarchy anyways?

Thanks

Jack

##### Share on other sites

Well it gives you all the tools to do this yourself.  Have you looked at AssImp tutorials?

http://assimp.org/lib_html/index.html

https://github.com/assimp/assimp/tree/master/samples/SimpleOpenGL/

What areas exactly are you having issues with?  The first link should provide plenty of help honestly, as it kinda does what you want.  Extracts each mesh out.  You can also resort them yourself.  Or maybe your software is not exporting it correctly.  So many possibilities.

##### Share on other sites

Hi Mike,

Thanks for helping.

The mesh I am rendering with assimp is a human  body.

There is only one mesh in there, which encompasses the body, the shirt and the pants.

And the submeshes coordinates were recalculated.

The order probably didn't matter much

And the body skin say is tanned.

and the shirt is slightly yellow

and the pants are blue.

What I see is total yellow, which is not correct.

However, when I enlarge the pants slightly, I see the pants rendered correctly in blue.

So there is some fighting between the pants submesh and the body submesh.

I am not sure I got control over it, but let me read the articles you provided

Thanks

Jack

##### Share on other sites

Sounds like you need to turn on Z-testing (Depth testing)

glEnable(GL_DEPTH_TEST)


1. 1
2. 2
3. 3
4. 4
5. 5

• 14
• 9
• 9
• 10
• 12
• ### Forum Statistics

• Total Topics
632911
• Total Posts
3009183
• ### Who's Online (See full list)

There are no registered users currently online

×