Vertex Color Morphing

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
ekt
Gremlin
Posts: 150
Joined: Thu Apr 01, 2004 5:55 pm
x 4
Contact:

Vertex Color Morphing

Post by ekt »

While a mesh is animating with morphing, it would be useful to be able to morph also color/alpha.
Today ogre manages only positional vertex buffer.
This would allow neat tricks like changing some mesh parts color or fading them during the animation. Artists could control this from their 3d app while designing the animation.

What do you think of it?
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: Vertex Color Morphing

Post by madmarx »

Maybe I am wrong but I thought this was already available through the Ogre::AnimableValue (OgreAnimable.h) + KeyFrame ?

Edit : well, I am wrong. Doing 1 animable for each vertex would be overkill !
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
User avatar
nedelman
Gnome
Posts: 315
Joined: Wed Feb 21, 2007 6:03 am
Location: San Francisco, California
x 6
Contact:

Re: Vertex Color Morphing

Post by nedelman »

I'd like to see normal morphing as well. As it is, the same normals are always used which results in incorrect lighting.
http://www.ogremax.com - Ogre3D Scene Exporter for 3DS Max, Maya, and Softimage
http://www.linkedin.com/in/dereknedelman - My LinkedIn Profile
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: Vertex Color Morphing

Post by sinbad »

The reason is that the overhead for storing snapshots of all vertex properties is quite large, so we limited it to the position buffer - you should use skeletal animation for efficient animation of normals. You can't even interpolate normals 'properly' with morphing anyway, although you may be able to get away with a linear interpolate and renormalise in some limited cases. It may be something we can add as an option, but it comes up as a request extremely rarely.

Regarding vertex colours, a far more efficient way of doing this is to use a shader, or even simply a set scrolling texture coords referencing a texture which describes the colour animation. This is orders of magnitude faster than actually physically animating the vertex colours.
berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger »

Hello,
I have a question that relates to this thread. I am developing a facial animation program using blend shapes. The blend shapes are derived from high-resolution shape capture and CANNOT be approximated by bones. I want to use Ogre pose animation for this, but the gist I'm getting from the forums is that Ogre modifies only the vertex positions and does not update the vertex normals as the mesh deforms. If that is the case, I would like to try to manually update the normals, I suppose by computing triangle normals, adding those to the incident vertices and renormalizing. I realize this is computationally expensive but accurate normals are essential for rendering these meshes.

So two questions:

1) Is there is a way for Ogre to update the normals automatically?
2) If there is no way for Ogre to do it automatically, can you recommend an optimal strategy for doing it manually? Should this be done as a shading program?

Many thanks,
Michael
User avatar
lordsme
Gremlin
Posts: 167
Joined: Sun Mar 11, 2007 1:11 pm
Location: Turin, Italy
x 10
Contact:

Re: Vertex Color Morphing

Post by lordsme »

1) Is there is a way for Ogre to update the normals automatically?
2) If there is no way for Ogre to do it automatically, can you recommend an optimal strategy for doing it manually? Should this be done as a shading program?
I have the same problem as Berger and the same questions... no idea?
My Portfolio
http://davidedigiannantonio.weebly.com

MESH - Mise-en-scene Helper
http://www.mesh-project.org/

ASALab @ Virtual Reality & Multimedia Park
http://www.vrmmp.it
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Vertex Color Morphing

Post by xavier »

The answer is #2. Sinbad already explained this all above.

How you deal with your normals is entirely up to you; regardless of the algorithm, doing this on the GPU is strongly recommended.
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger »

Then I guess I am looking for a way to update vertex normals using a shader. I'm not very experienced in shaders, so before I get into this I wanted to ask if what I want to do is feasible. My vertex shader would need access to the triangle list of the mesh, and refresh the triangle normals prior to updating the vertex normals. Is this possible or would I be wasting my time trying to figure out how to access triangles from a vertex program? Any suggestions or examples would be much appreciated.

If it is not feasible, I will have to recompute the normals in software and write the values to the hardware buffer.

On a further note, though I'm new to this forum, from what I've read I believe there *is* interest in having an option in Ogre to update vertex normals automatically during pose animation. I realize that blend shapes are not favored in games for performance reasons, but their use is on the rise (e.g. PS3's Heavenly Sword). And there are applications for Ogre other than games... such as the field of visual speech synthesis in which I work.

Thanks
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Vertex Color Morphing

Post by xavier »

berger wrote: Is this possible or would I be wasting my time trying to figure out how to access triangles from a vertex program?
It depends on the shader model you are expecting to use. With SM3.0 you can access texture samplers in the vertex shader, and with SM4 and above you have more features available as well.
If it is not feasible, I will have to recompute the normals in software and write the values to the hardware buffer.
This certainly will have the broadest compatibility. You can easily multithread this task (TBB or OpenMP parallel-for is probably easiest) to take advantage of multicore hardware to help with this.
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger »

Thanks for that. I will try a software solution for now, and later try to do it faster on the GPU.

I am trying to do this using optimized Ogre methods such as EdgeData::updateFaceNormals(), which relies on OptimisedUtil::calculateFaceNormals(). Unfortunately this produces homogeneous Vector4 normals which are not normalized to unit length. I must then convert these to 3D vectors and normalize them before building the vertex normals out of them. Wish there was an easier (and faster) way to do this...
berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger »

I am now finding that during vertex animation it is impossible to obtain current vertex positions from the hardware buffer. So in order to calculate vertex normals, I have to replicate the process of calculating vertex positions in software. This is totally redundant. Is there no other way??? I had no idea this would be such a problem.

What about VertexAnimationTrack::setAssociatedVertexData(). The documentation says this allows me to set the "target" of the vertex animation. I'm not sure what that means but could it be of use?

Thanks for your help.
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Re: Vertex Color Morphing

Post by Praetor »

The vertex animation itself stores its own separate buffers. The new vertex positions are not copied into the original buffer, which is why you don't see it changing. You need to grab the vertex buffer stored in the animation track.
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
berger
Gnoblar
Posts: 9
Joined: Tue Apr 20, 2010 6:44 pm

Re: Vertex Color Morphing

Post by berger »

Hmm, but how do I access that? When I call track->getAssociatedVertexData(), I get null.
User avatar
cin
Kobold
Posts: 36
Joined: Thu Sep 25, 2008 10:34 am
Location: Russia. Nakhodka.
x 4
Contact:

Re: Vertex NORMAL Morphing

Post by cin »

Vertex normal Morphing.
Low resolution object space normal maps. Interpolate in shader. This can be realized anyone? :?:
truckleasing
Gnoblar
Posts: 1
Joined: Sat Jul 17, 2010 4:28 pm

Re: Vertex Color Morphing

Post by truckleasing »

I'm attempting to do this using optimized Ogre methods like EdgeData::updateFaceNormals() which relies on OptimisedUtil::calculateFaceNormals(). The result is a homogeneous Vector4 normals which are not normalized to unit length. To fix it I have to convert these to 3D vectors and normalize them before building the vertex normals out of them. Can anyone tell me if there's an easier or faster way to do this? Thanks.
Post Reply