Does one change vertex positions in 3D space or only use matrices for that?

Hello dear JGO,

When you have a model in 3D space, you load it by giving it an origin and the vertices are positioned relative to that origin.
Now, when you do physics calculations/rendering etc, do you ever change the positions of the vertices or do you just use the matrices for that purpose?

I would guess, that for performance reasons, you only load the model at lets say x:0|y:0|z:0 and Scale/Rotate/Transform for rendering and never change the vertex position itself again?!
But for physics calculations, how do you do that? If for example a model is deformed, how would you store this data?

Thank you very much in advance!

Performance wise, often the bottleneck is moving transformed vertices over to the graphics memory. So what you can do is do as normal for rendering and then also calculate and store deformed vertices cpu side on a as-per-needed basis. By as-per-needed I mean obviously there is no need to recalculate vertices unless you both need to do some collision test and the mesh has moved since the last time.

That’s quite a good general approach, but as ever it depends on your usage case.

I’ll mention a couple things in addition to what quew8 said (maybe this is stuff you already know). First, it’s very common to use simplified shapes for intersection testing rather than arbitrary meshes. These would be things like boxes, spheres, capsules, or simple convex polytopes. Such shapes are generally cheap to transform, so transforming them as needed usually isn’t an issue.

If you do have a more complex mesh that you want to perform an intersection test against, another trick is to perform the test in the local space of the model. For example, to intersect a ray with a mesh, you would transform the ray into the local space of the model, perform the test, then transform the result back to world space, rather than transforming the entire mesh to world space. Even if you have two complex meshes, transforming one into the local space of the other will be cheaper than transforming both to world space.

In general though it’s easiest just to use simplified shapes if you can get away with it.

Rendering and physics are separate tasks…no one requires that they share data. The results simply need to be plausible to the player.