Offseting sub-meshes - positioning submeshes

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!

Offseting sub-meshes - positioning submeshes

Postby robmar » Fri Dec 15, 2017 4:05 pm

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.
robmar
 
Posts: 1007
Joined: Sun Aug 14, 2011 11:30 pm

Re: Offseting sub-meshes - positioning submeshes

Postby devsh » Fri Dec 15, 2017 5:09 pm

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.
User avatar
devsh
Competition winner
 
Posts: 1784
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: Offseting sub-meshes - positioning submeshes

Postby robmar » Sun Dec 17, 2017 12:27 am

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...
robmar
 
Posts: 1007
Joined: Sun Aug 14, 2011 11:30 pm

Re: Offseting sub-meshes - positioning submeshes

Postby Mel » Mon Dec 18, 2017 12:04 am

What are you trying?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 2235
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Offseting sub-meshes - positioning submeshes

Postby robmar » Thu Jan 11, 2018 12:57 pm

Just explode the model, it just requires a new transform for each submesh, the Irrlicht parent-child code does the same thing.
robmar
 
Posts: 1007
Joined: Sun Aug 14, 2011 11:30 pm

Re: Offseting sub-meshes - positioning submeshes

Postby Mel » Fri Jan 12, 2018 11:57 am

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 :)
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 2235
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Offseting sub-meshes - positioning submeshes

Postby mant » Sat Jan 13, 2018 6:12 am

Parent/child maybe the keyword for you to search for it.
mant
 
Posts: 77
Joined: Sun Jan 27, 2013 3:38 pm

Re: Offseting sub-meshes - positioning submeshes

Postby Mel » Sat Jan 13, 2018 12:45 pm

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
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 2235
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain


Return to Advanced Help

Who is online

Users browsing this forum: pandoragami and 1 guest