# C++ Assimp - Transformation Hierarchy

I have a question regarding model imports using ASSIMP. I've been working on an Entity and Component (e.g. unity gameobject component) based game engine for fun and to learn in my spare time. I've decided to tackle frustum culling, because it interests me and seems like a relatively simple optimisation to make. I had the algorithm implemented and noticed a problem, while the culling works as expected, the entire sponza scene i have loaded disappears when looking in certain orientations. This happens because it uses the entity the mesh is attached to's position, which in all cases is (0,0,0) or something similar.

This means, despite the fact each mesh of the sponza scene is drawn using it's own model matrix and each entity has the same position (Meaning each mesh should be overlapping surely?) the scene looks entirely normal. Now i know ASSIMP does provide you the transformation for each note (guessing this would be what im looking for) but I can't figure out why the scene just looks normal, does assimp pre-offset the vertices based on the node transform? if so how can i disable this feature?

Any and all literature / tidbits would be welcome, Apologies for not being a super well defined question.

TLDR; How do node transformations work in Assimp

I don't understood everything, but the anwser to this question :

does assimp pre-offset the vertices based on the node transform ?

is yes, or at least, I came across the same observation.

You extracted the vertices data from your_scene->mMeshes[]->mVertices[], right ?

EDIT

What you could do is getting the transformation matrices for all your meshes by reading the node hierarchy starting with your_scene->mMeshes->mRootNode and stacking the transforms. Once you have them, pre-transform the meshes by their inverse offset transform. That way you will have all your meshes overlapping at (0,0,0)

• Thats a great clarification. Yes I did, is there a way to avoid this offset? – tadge Aug 25 '19 at 22:04
• What you could do is getting the transformation matrices for all your meshes by reading the node hierarchy starting with your_scene->mMeshes->mRootNode and stacking the transforms. Once you have them, pre-transform the meshes by their inverse offset transform. That way you will have all your meshes overlapping at (0,0,0). – Kiord Aug 25 '19 at 22:13
• I am adding this as an edit to your response because this is exactly what I was looking for. Thank you so much :) – tadge Aug 25 '19 at 22:16
• See those links : learnopengl.com/Model-Loading/Assimp / ogldev.atspace.co.uk/www/tutorial38/tutorial38.html to know more about how Assimp organizes its data. – Kiord Aug 25 '19 at 22:17