Adding vertices to a mesh that has skeletal animation

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
michlbeck
Gnoblar
Posts: 5
Joined: Thu Aug 29, 2013 7:25 pm

Adding vertices to a mesh that has skeletal animation

Post by michlbeck »

Hi all,

I'm trying to programmatically add vertices to a skeletal animated mesh. Here's my original question in the Help forum, I guess it was too advanced for there: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=78809 . I've now looked further through the code and debugged using a debug build of the Ogre lib and it looks like I can't actually do what I need to do with Ogre, at least with version 1.8.1.

Essentially, I need the Entity's mSkelAnimVertexData to be rebuild after I add the vertices to the Mesh's sharedVertexData. However, the only lines of code I could find that could re-initialise the mSkelAnimVertexData with a different size were in Entity::prepareTempBlendBuffers(), which is protected and only called by Entity::_initialize().

It seems the best thing for me to do would be to subclass Entity so that I can expose the prepareTempBlendBuffers() as a public method, and then call it after modifying the Mesh's sharedVertexData so it can grow to the appropriate size. Is my thinking here correct?
User avatar
Lee04
Minaton
Posts: 945
Joined: Mon Jul 05, 2004 4:06 pm
Location: Sweden
x 1

Re: Adding vertices to a mesh that has skeletal animation

Post by Lee04 »

This is something I wouldn't do programmatically.

I would leave this to the artist.

I would use Ogre so you could group imported vertices and scale groups of vertices.

These groups you can change scale for zero 0 would be not visible at all 1 fully visible large. And if you want a half size 0.5

The artist would group an group of vertices and mark them as a group, possibly store scale group id in the W component of the UVW component of each vertice. Or something like that.

So you load the 3d file read in objects, go through all w's to figure out all the groups the artist made.
And then have a vertice shader that takes the w component and scales. You just set the shader constans reigster to the scale you want for each group.

Max number of scale groups would be the number of shader constants your shader model supports.

Or you can use a texture where you write the scale values to a pixel in the texture and then you hand the shader the texture that reads the scale values.
This allows you a lot of groups.
Ph.D. student in game development
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Adding vertices to a mesh that has skeletal animation

Post by Klaim »

Lee04 wrote:This is something I wouldn't do programmatically.

I would leave this to the artist.
What about creative coding and procedurally generated content?
The problem with this mindset is that it don't fit the current artistic world which strives for interactive visual creation which is hard to make smooth if you have to rebuild the whole bloody mesh each time a modification is done.
michlbeck
Gnoblar
Posts: 5
Joined: Thu Aug 29, 2013 7:25 pm

Re: Adding vertices to a mesh that has skeletal animation

Post by michlbeck »

Thasnk @Klaim, yes that is the point -- what I'm trying to do here is too complex to be done just by the artists -- think something like the Spore creature engine.

When I did what I suggested above it worked but it crashed as soon as the model came on screen, elsewhere in Ogre. I've given up on this aspect for now, but either doing what i suggested corrupts Ogre's inner state somewhere else, or (more likely) there is a bug in the way i'm adding the vertices that is destroying other data.

I'll post back here if I ever get what I want to work.
Post Reply