Page 1 of 1

Offseting sub-meshes - positioning submeshes

Posted: Fri Dec 15, 2017 4:05 pm
by robmar
Anyone knows how to offset the position of sub-meshes?

I'd like to explode something by manipulating the position and rotation of the submeshes.

Re: Offseting sub-meshes - positioning submeshes

Posted: Fri Dec 15, 2017 5:09 pm
by devsh
You can't.... the reason is that you'd have to re-set the world transformation matrix for your shader/program or the thing that emulates it in fixed function pipeline.

In theory its possible but you'd need to do it before every draw call of a meshbuffer.

Re: Offseting sub-meshes - positioning submeshes

Posted: Sun Dec 17, 2017 12:27 am
by robmar
How about multiply the sub-mesh offset matrix by the original transform matrix, call SetTransform with that in the node's Render() proc, having passed the same offset matrix to the shader previously, and the following mesh or node render, reset the matrix... that should work, right? The GPU will simply recalc the vertices using the last matrix set. My shader code knows which sub-mesh is which, so that's covered...

Re: Offseting sub-meshes - positioning submeshes

Posted: Mon Dec 18, 2017 12:04 am
by Mel
What are you trying?

Re: Offseting sub-meshes - positioning submeshes

Posted: Thu Jan 11, 2018 12:57 pm
by robmar
Just explode the model, it just requires a new transform for each submesh, the Irrlicht parent-child code does the same thing.

Re: Offseting sub-meshes - positioning submeshes

Posted: Fri Jan 12, 2018 11:57 am
by Mel
How do you split the model? -separate it into submeshes- or is it already "exploded"? Perhaps you could create a particle system out of the model's triangles and move each triangle as a single particle randomly, or following any other method (if it doesn't have many triangles, namely 3000-5000 it may very well run completely on the CPU :)

Re: Offseting sub-meshes - positioning submeshes

Posted: Sat Jan 13, 2018 6:12 am
by mant
Parent/child maybe the keyword for you to search for it.

Re: Offseting sub-meshes - positioning submeshes

Posted: Sat Jan 13, 2018 12:45 pm
by Mel
Skinning also does something similar. Each bone is in essence, a transformation matrix for a subset of the mesh, which holds parent/child relationships, so, you could use a sort of skinned mesh