• Advertisement

• Popular Now

• 9
• 10
• 9
• 11
• 14
• Advertisement
• Advertisement
• Advertisement

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

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 this post

Share on other sites
Advertisement

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

https://learnopengl.com/#!Model-Loading/Assimp

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 this post

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.

When  loading up, the mesh got splitted into 3 submeshes.

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 this post

Share on other sites

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

glEnable(GL_DEPTH_TEST)


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

• Advertisement